
Pro II: Extension and Interface Modules
Pro II-CAN-FD-2 Rev. E
ADwin
166
ADwin-Pro II
Hardware, manual Dec. 2018
Message objects require space in the controller memory. Overall, there is 2kB
memory which can be distributed to message objects and the transmit event
Fifo.
Initialization
For initialization, a data array is created where all properties of the CAN FD
controller (operation mode, bit rate, transmitter delay compensation) as well as
properties of used message objects (e.g. size, identifier) are stored. With
P2_CANFD_Init_Controller
, all stored information from the data array are
transferred to the appropriate controller registers. Then, the controller is ready
for operation.
Sending messages
Sending a message is made as follows:
– You configure a message object to send using
P2_CANFD_Enable_Transmit_Fifo
or
P2_CANFD_Enable_Transmit_Queue
. Then, initialize the controller
with
P2_CANFD_Init_Controller
– You transfer a message including the identifier to the controller
(
P2_CANFD_Write_TMO
).
– You enable the message object for sending
(
P2_CANFD_Transmit_MSG
). As soon as the bus is ready, the mes-
sage is sent (with the identifier of the message object).
Please note: If messages are ready for sending in several message objects,
the message with the lowest identifier is sent first.
While sending, the controller reads back data from the bus in order to enable
reactions to conflicts according to the bus protocol. During read back, a delay
can occur compared to the sent data; a transmitter delay compensation can be
set (
P2_CANFD_Set_TDC
) with controller initialization.
Controlling sent
messages
You can define a transmit event fifo in order to control sent messages. The Fifo
can store the message header and an optional timestamp for each sent mes-
sage. You read a message object EFO with
P2_CANFD_Read_EFO
.
If you want to control and distinguish messages with identical header, enter a
specific parameter SEQ when sending a message. After sending, you find the
parameter in the header being stored in the transmit event fifo.
Receiving messages
Receiving a message is made as follows:
– You configure a message object to receive and define the identifier of
the object (
P2_CANFD_Enable_Receive_Fifo
). Then, initialize the
controller with
P2_CANFD_Init_Controller
– The controller monitors the CAN bus for incoming messages and stores
messages with the appropriate identifier in the input Fifo.
– You read the message object from the input Fifo
(
P2_CANFD_Read_RMO
).
If all defined elements of the input Fifo are full, the next incoming message
overwrites the oldest stored data, which will be definitely lost. Therefore, pay
attention to reading out the data faster than you are receiving them. A data loss
can be queried separately.
Assigning messages
The allocation of an incoming message to an input Fifo is automatically con-
trolled by comparing its identifiers. Each input Fifo has a mask which controls
this comparison as follows:
– The identifier of the message is bit by bit compared to the identifier of the
input Fifo. If the relevant bits are identical, the message is transferred to
the input Fifo. Not relevant bits are not compared to each other, that is,
the message is transferred to the input Fifo (if it depends on this bit).
– Relevant bits are defined in the mask by setting them to 1.