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) |
(→Особенности работы драйвера I²C) |
||
Line 206: | Line 206: | ||
<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". | |
=== Режим экономии энергии (режим пониженного энергопотребления) === | === Режим экономии энергии (режим пониженного энергопотребления) === |
Revision as of 06:09, 18 March 2016
Contents
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".
Режим экономии энергии (режим пониженного энергопотребления)
Для экономии энергии спецификацией LIN предусмотрена возможность перехода всех узлов сети LIN в режим пониженного энегропотребления. Чаще всего, такой переход инициируется ведущим устройством путем отправки соответствующего сообщения в шину, либо осуществляется ведомыми устройствами самостоятельно, при отсутствии активности на шине в течение определенного интервала времени. Выход из режима сна может быть инициирован любым узлом шины. MASTER-узел инициирует пробуждение шины обычным началом опроса SLAVE-узлов. Пробуждение же по инициативе SLAVE-узла, осуществляется кратковременной установкой на линии потенциала GND.
В драйвере LIN контроллеров CANNY 7 для пробуждения шины MASTER-устройству достаточно начать передачу данных или запросов ведомым устройствам. SLAVE-узлы отправляют запрос на пробуждение шины передачей сообщения с любым идентификатором, но имеющим нулевую длину, т. е. «Регистр сообщения передачи LINх LEN» = 0.