This documentation is out of date.
The new version of the documentation is here: https://cannylogic.com/docs |
Difference between revisions of "CANNY 7, I²C Driver"
[unchecked revision] | [unchecked revision] |
(→I²C Driver Registers) |
(→Смотри также) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 84: | Line 84: | ||
{|border="0" align="left" | {|border="0" align="left" | ||
|- valign="top" | |- valign="top" | ||
− | |style="padding-left:0.5em;"|I²C Error | + | |style="padding-left:0.5em;"|I²C Error Register |
|} | |} | ||
|valign="top"| | |valign="top"| | ||
Line 155: | Line 155: | ||
{|border="1" style="border-collapse:collapse;" align="left" width="100%" | {|border="1" style="border-collapse:collapse;" align="left" width="100%" | ||
|- align="center" valign="top" | |- align="center" valign="top" | ||
− | !width="250px"| | + | !width="250px"|Address |
− | ! | + | !Expected Values |
|- valign="top" | |- valign="top" | ||
| | | | ||
Line 168: | Line 168: | ||
|width="70px" style="padding-left:0.5em;"|1 | |width="70px" style="padding-left:0.5em;"|1 | ||
|style="padding-left:0.5em;"|= | |style="padding-left:0.5em;"|= | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"|load data from the transmit registers in to the transmit buffer / load data from the receive buffer in to I²C receive data registers; |
|- valign="top" | |- valign="top" | ||
|width="70px" style="padding-left:0.5em;"|0 | |width="70px" style="padding-left:0.5em;"|0 | ||
|style="padding-left:0.5em;"|= | |style="padding-left:0.5em;"|= | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"|do not load data to the transmission buffer / do not read data from I²C receive data registers. |
|} | |} | ||
|- valign="top" | |- valign="top" | ||
Line 185: | Line 185: | ||
|width="70px" style="padding-left:0.5em;"|0...16 | |width="70px" style="padding-left:0.5em;"|0...16 | ||
|style="padding-left:0.5em;"|= | |style="padding-left:0.5em;"|= | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"|the number of I²C message bytes that will be transmitted when receiving command to send data. |
|} | |} | ||
|- valign="top" | |- valign="top" | ||
Line 201: | Line 201: | ||
|width="70px" style="padding-left:0.5em;"|0...65535 | |width="70px" style="padding-left:0.5em;"|0...65535 | ||
|style="padding-left:0.5em;"|= | |style="padding-left:0.5em;"|= | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"|the value corresponding I²C message bytes for transmission, two bytes per register. |
|} | |} | ||
|} | |} | ||
<br clear="all"> | <br clear="all"> | ||
− | === | + | === I²C Driver Operation Features === |
− | + | data exchange on I²C network using CANNY 7 controller is determined by the combination of transmitted and received message length register values set by user (see table). | |
{|border="1" style="border-collapse:collapse;" align="left" width="100%" | {|border="1" style="border-collapse:collapse;" align="left" width="100%" | ||
|- align="center" valign="top" | |- align="center" valign="top" | ||
− | !width="250px"| | + | !width="250px"|I²C register value of transmitting message length |
− | ! | + | !I²C register value of receiving message length |
− | ! | + | !Data exchange direction |
|- valign="top" | |- valign="top" | ||
|style="padding-left:0.5em;"| > 0 | |style="padding-left:0.5em;"| > 0 | ||
|style="padding-left:0.5em;"| = 0 | |style="padding-left:0.5em;"| = 0 | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"| Only data transmission from CANNY7 (Master) to Slave node with the address specified in the relevant register. |
|- valign="top" | |- valign="top" | ||
|style="padding-left:0.5em;"| > 0 | |style="padding-left:0.5em;"| > 0 | ||
|style="padding-left:0.5em;"| > 0 | |style="padding-left:0.5em;"| > 0 | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"| data transmission from CANNY7 (Master) to Slave node with the address specified in the relevant register, and receiving response data from it. |
|- valign="top" | |- valign="top" | ||
|style="padding-left:0.5em;"| = 0 | |style="padding-left:0.5em;"| = 0 | ||
|style="padding-left:0.5em;"| > 0 | |style="padding-left:0.5em;"| > 0 | ||
− | |style="padding-left:0.5em;"| | + | |style="padding-left:0.5em;"| Only data reception by CANNY7 (Master) from Slave node with the address specified in the relevant register. |
|} | |} | ||
− | + | Example functional diagram of the data receiving from TCN75 sensor. In operation, the controller acts as I²C bus Master node, carrying the temperature sensor interrogation 2 times per second. | |
[[File:6_11_3_1.png|center]] | [[File:6_11_3_1.png|center]] | ||
− | + | In this example CANNY7 (Master) acts as a receiver, requesting data and temperature sensor (Slave) - as a transmitter. This data transmission direction given by the entry in I²C transmitting message length registers(I²C Transmit Data Length Register) and the length of I²C receiving message (I²C Received Data Length Register) values other than "0", corresponding to the number of transmitting (temperature request) and receiving (temperature value) data. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | To connect controller to the thermal sensor, channels #8 (SCL) and #9 (SDA) used. Every 500ms transmitting a request for temperature value to the slave node with address 0x90. In response is expected to receive two data bytes. | |
− | + | After receiving data from the temperature sensor is performed pretreatment, then results of which are stored in the network named "sensor data". | |
− | == | + | == See also == |
[[CANNY 7]] | [[CANNY 7]] | ||
[[CANNY 7, Dallas 1-Wire Driver]] | [[CANNY 7, Dallas 1-Wire Driver]] |
Latest revision as of 05:14, 21 March 2016
General Description
As communication lines (SDA and SCL) can be assigned to any pair of controller channels. In this case, the data channels must be pulled up to 5V with resistor of 1 k to 10 k outside of he controller. Particularity of I²C protocol implementation in CANNY7 controller is that CANNY7 can only act as a Master node. Data exchange between devices, which can be either mono- or bidirectional, occurs in separate sessions, the maximum message length I²C within one session is 16 bytes, ie opening of multiple sessions with different devices is not allowed. The rate of exchange is fixed at 100 kbit/s. The total number of slaves on the line can reach several tens.
I²C driver operates using the controller channel resources, but has a higher priority than a discrete input-output driver. Thus, upon activation I²C driver, for channels involved in to its operation, changing values in registers associated with digital input-output driver will be ignored by the controller.
I²C Driver Registers
The following are descriptions of valid register values for I²C driver control operation.
I²C Driver Configuration Registers.
Address | Expected Values | |||||||
---|---|---|---|---|---|---|---|---|
|
| |||||||
|
| |||||||
|
| |||||||
|
|
Note: | Individual controller channels must be assigned for SDA and SCL lines. |
I²C driver diagnostic registers.
Address | Return values | |||||||
---|---|---|---|---|---|---|---|---|
|
|
I²C Receive Registers.
Address | Return values | |||||||
---|---|---|---|---|---|---|---|---|
|
| |||||||
|
| |||||||
|
|
I²C Transmit Registers.
Address | Expected Values | |||||||
---|---|---|---|---|---|---|---|---|
|
| |||||||
|
| |||||||
|
|
I²C Driver Operation Features
data exchange on I²C network using CANNY 7 controller is determined by the combination of transmitted and received message length register values set by user (see table).
I²C register value of transmitting message length | I²C register value of receiving message length | Data exchange direction |
---|---|---|
> 0 | = 0 | Only data transmission from CANNY7 (Master) to Slave node with the address specified in the relevant register. |
> 0 | > 0 | data transmission from CANNY7 (Master) to Slave node with the address specified in the relevant register, and receiving response data from it. |
= 0 | > 0 | Only data reception by CANNY7 (Master) from Slave node with the address specified in the relevant register. |
Example functional diagram of the data receiving from TCN75 sensor. In operation, the controller acts as I²C bus Master node, carrying the temperature sensor interrogation 2 times per second.
In this example CANNY7 (Master) acts as a receiver, requesting data and temperature sensor (Slave) - as a transmitter. This data transmission direction given by the entry in I²C transmitting message length registers(I²C Transmit Data Length Register) and the length of I²C receiving message (I²C Received Data Length Register) values other than "0", corresponding to the number of transmitting (temperature request) and receiving (temperature value) data.
To connect controller to the thermal sensor, channels #8 (SCL) and #9 (SDA) used. Every 500ms transmitting a request for temperature value to the slave node with address 0x90. In response is expected to receive two data bytes.
After receiving data from the temperature sensor is performed pretreatment, then results of which are stored in the network named "sensor data".