This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

Difference between revisions of "CANNY 5.2 duo, CAN Gateway Driver"

From CANNY Wiki
Jump to: navigation, search
[checked revision][checked revision]
(Driver's registers)
Line 1: Line 1:
 
== General Description ==
 
== General Description ==
  
Используя драйвер шлюза CAN возможно организовать высокоскоростную асинхронную ретрансляцию сообщений между аппаратными CAN-интерфейсами контроллера с возможностью автоматической модификации ретранслируемых сообщений.
+
Using the CAN gateway driver you can to implement the high-speed asynchronous relaying of messages between the CAN hardware interfaces with optional filtering and altering particular CAN messages.
  
 +
The CAN gateway driver allows you to realize individual processing of incoming CAN messages by configuring up to eight selection rules (selectors).
  
Драйвер шлюза CAN позволяет организовать индивидуальную обработку полученных сообщений CAN путем настройки восьми правил отбора.
+
Each rule (selector) allows you to select CAN messages by the following user-defined properties:
 +
* CAN interface number via which the message was coming to the controller;
 +
* CAN ID of incoming message (CAN gateway selector value).
  
Каждое правило позволяет отбирать сообщения CAN по следующим, задаваемым пользователем признакам:
+
When some incoming CAN message hit the selector, the CAN gateway driver perform one of the following user-defined actions:
* номер интерфейса CAN по которому сообщение поступило в контроллер;
+
* relay the message to another CAN interface of the controller "as is", without any changes;
* идентификатор поступившего сообщения (Значение отбора).
+
* modify the message, and then relay the modified message to another CAN interface of the controller;
 
+
* discard the message.
 
+
При поступлении сообщения удовлетворяющего заданным признакам, драйвер позволяет выполнить одно из следующих действий:
+
* ретранслировать сообщение на другой интерфейс CAN контроллера без изменений;
+
* модифицировать полученное сообщение, а затем ретранслировать сообщение на другой интерфейс CAN контроллера;
+
* отбросить сообщение.
+
 
+
Модификация сообщения производится путем замены по маске любых бит исходного сообщения включая значения его идентификатора, длины и байт данных.
+
  
 +
Modification of the message is performed by replacing using a bitmask any bits of the original message, including the values of its ID, length and byte of data.
  
 
Для всех сообщений, поступивших с определенного интерфейса CAN, но не удовлетворяющих признакам ни одного из включенных правил отбора шлюза возможно задать одно из следующих действий:  
 
Для всех сообщений, поступивших с определенного интерфейса CAN, но не удовлетворяющих признакам ни одного из включенных правил отбора шлюза возможно задать одно из следующих действий:  

Revision as of 15:32, 19 May 2018

General Description

Using the CAN gateway driver you can to implement the high-speed asynchronous relaying of messages between the CAN hardware interfaces with optional filtering and altering particular CAN messages.

The CAN gateway driver allows you to realize individual processing of incoming CAN messages by configuring up to eight selection rules (selectors).

Each rule (selector) allows you to select CAN messages by the following user-defined properties:

  • CAN interface number via which the message was coming to the controller;
  • CAN ID of incoming message (CAN gateway selector value).

When some incoming CAN message hit the selector, the CAN gateway driver perform one of the following user-defined actions:

  • relay the message to another CAN interface of the controller "as is", without any changes;
  • modify the message, and then relay the modified message to another CAN interface of the controller;
  • discard the message.

Modification of the message is performed by replacing using a bitmask any bits of the original message, including the values of its ID, length and byte of data.

Для всех сообщений, поступивших с определенного интерфейса CAN, но не удовлетворяющих признакам ни одного из включенных правил отбора шлюза возможно задать одно из следующих действий:

  • ретранслировать сообщение на другой интерфейс CAN контроллера без изменений;
  • отбросить сообщение.


Для работы драйвера шлюза CAN необходимо задать конфигурацию драйверов обоих CAN-интерфейсов контроллера, при этом заданные для интерфейсов конфигурации CAN могут отличаться.


При включенном драйвере шлюза CAN, средствами пользовательской диаграммы возможно, используя регистры Драйвера CAN0 и Драйвера CAN1:

  • отправлять сообщения через любой из CAN-интерфейсов контроллера в обычном режиме;
  • получать сообщения CAN удовлетворяющие правилам отбора установленным для соответствующего интерфейса CAN драйвером шлюза CAN.


В процессе работы пользовательской диаграммы возможно многократно изменять любые параметры конфигурации драйвера шлюза CAN средствами пользовательской диаграммы, организуя таким образом, с некоторыми временными ограничениями, динамический режим работы шлюза.

Driver's registers

Below is a description of the permissible values ​​of the CAN gate driver control registers, which allow setting the controller operation parameters for high-speed asynchronous relaying of messages between the CAN hardware interfaces.

Common registers of the CAN gateway driver.

Register Expected values
CAN gateway driver enable register
≥ 1 = Enable the CAN gateway driver;
= 0 = Disable the CAN gateway driver.
CAN gateway configuration register
≥ 1 = Apply the new settings of the CAN gateway driver (see note);
= 0 = Do not update the settings of the CAN gateway driver.
CAN gateway filter enable for CANx interface
≥ 1 = switch on the filtering mode of the CAN gateway for the corresponding interface: relay to the second CAN interface of the controller and transmit only CAN messages that are accepted by the gateway selections, the remaining messages are discarded;
= 0 = the filtering mode of the CAN gateway for the corresponding interface is disabled: it automatically retransmits messages that have not entered the gateway selections to the second CAN-interface of the controller in unchanged form.
CAN gateway logging mode enable for CANx interface
≥ 1 = enable the CAN gateway logging mode for the corresponding interface: transmit to the function chart (in the CAN driver) all CAN messages received on this interface. The gateway driver will select, replace and relay CAN messages according to the corresponding gateway settings of the specified CAN interface;
= 0 = disable the CAN gateway logging mode for the corresponding interface: only CAN messages that are included in the gateway's selections are transmitted to the diagram (in the CAN driver), the remaining messages are discarded.


CAN gateway configuration registers.

Common CAN gateway driver selection registers.

Registers Expected values
CAN gateway selector X enable register
≥ 1 = enable the appropriate selection of the CAN gateway;
= 0 = the corresponding CAN gateway selection is disabled.
CAN gateway selector X linked CAN interface number register
= 0 = apply the appropriate selection to the messages coming to the controller via the CAN0 interface;
= 1 = apply the appropriate selection to the messages coming to the controller via the CAN1 interface.
CAN gateway excluding mode register for CANx interface
≥ 1 = discard all messages which match an enabled selection;
= 0 = allow processing and automatic retransmission to another CAN interface of all messages which match an enabled selection.


CAN gateway selection registers.

The value of the selection - is a parameter which, when satisfied, selects an incoming CAN message for special processing.

Register Expected value
CAN gateway selector X value, IDL
0...0xFFFF = the value of the lower part of the identifier (bits 0 ... 10 of the standard format identifier or bits 0 ... 15 of the extended format identifier) ​​of the CAN message the selection will accept.
CAN gateway selector X value, IDH
0...0x1FFF = the value of the highest part of the identifier (bits 16 ... 28 of the extended format identifier) ​​of the CAN message the selection will accept.


The registers of the gateway driver selection masks.

The selection masks - is a group of values ​​whose bits define the bitwise modifications to be made when the gateway retransmits a part of the message that has been accepted by the appropriate selection. If the value of the mask bit is "0", the corresponding bit of the received message will be relayed to the other interface without changes. If the value of the mask bit is "1", the corresponding bit of the received message will be replaced by a corresponding bit from the value of the Substitution Substitution

Register Expected value
CAN gateway selector X mask setup register, IDL
0...0xFFFF = set the value of the mask of the lower part of the CAN message identifier (bits 0 ... 10 of the standard format identifier or bits 0 ... 15 of the extended format identifier) ​​of the corresponding selection.
CAN gateway selector X mask setup register, IDH
0...0x1FFF = set the mask value of the upper part of the CAN message identifier (bits 16 ... 28 of the extended format identifier) ​​of the appropriate selection.
CAN gateway selector X mask setup register, ERL
0...0xFFFF = Set the mask value of the ERL register of the CAN message of the appropriate selection.
CAN gateway selector X mask setup register, CAN D1:D0
...
CAN gateway selector X mask setup register, CAN D7:D6
0...0xFFFF = set the value of the mask for the corresponding byte of data of the CAN message of the corresponding selection.


Registers for replacing the selections of the CAN gateway driver.

Replacement of selection - is a group of values ​​whose bits replace the original bits in the retransmitted message that has fallen into the appropriate selection. If the value of the replacement bit is "0", the corresponding bit of the relayed message will be replaced by zero, with the replacement bit value equal to "1", the corresponding bit of the relayed message will be replaced by one. The replacement will only be applied to those bits whose selection mask value is "1".

Register Expected value
CAN gateway selector X replace setup register, CAN IDL
0...0xFFFF = set the value of the replacement of the lower part of the CAN message identifier (bits 0 ... 10 of the standard format identifier or bits 0 ... 15 of the extended format identifier) ​​of the corresponding selection.
CAN gateway selector X replace setup register, CAN IDH
0...0x1FFF = set the value of the replacement of the highest part of the CAN message identifier (bits 16 ... 28 of the extended format identifier) ​​of the corresponding selection.
CAN gateway selector X replace setup register, CAN ERL
0...0xFFFF = set the replacement value of the ERL register of the CAN message of the selection being used.
CAN gateway selector X replace setup register, CAN D1:D0
...
CAN gateway selector X replace setup register, CAN D7:D6
0...0xFFFF = set the replacement values ​​of the corresponding data bytes of the CAN message of the corresponding selection.


Блок-схема работы контроллера в режиме CAN-шлюза

800px

See also

CANNY 5.2 duo

CANNY 5.2 duo, CAN Driver