CAN Receive

From OpenMBD
< HANcoder‎ | STM32‎ | Blocks
Jump to: navigation, search
Supported Targets: Olimexino, E407, P405

General information about CAN Receive

Reads a CAN message that has been received. If a CAN message with the same identifier is received more than once between executions of this block the data of the last message will be displayed.





Block inputs (inports)

CAN identifier, the CAN identifier number used to identify the message. This identifier can be changed run-time. The data type is uint32
Note: Set the 32nd bit to 1 in the CAN ID to configure it as a 29-bit Extended CAN identifier. For example 0x80000200 for CAN ID 0x200 as 29-bit identifier
Tip: Use the hex2dec function to be able to use hexadecimal numbers, e.g.: hex2dec('24F') to receive a CAN message with identifier 0x24F.

Block outputs (outports)

output 1: 'new' A value indicating if a CAN message was received since the last time the block has been executed, output is 1 when a message was received. Data type is int8. output 2..9: The received data. (Number of outputs depends on the setting)

Block parameters

Parameter Description
CAN channel The CAN channel to be used, the E407 and P405 have two CAN channels, the Olimexino has only one.
Output ports The number of output ports, the maximum number of bytes in a message is 8 so the maximum number of output ports is also 8. If for example uint16's are received you can only receive 4 per message so you can select a maximum of 4 output ports per message.
Ouput data type The output data type to be used. This assumes all signals in a message are the same datatype. If this is not the case then just use uint8 and do the

processing of the bits and bytes in Simulink.

Byte order Byte order or endianness can be selected. If the checkbox is selected then the Most Significant Byte order, big-endian or Motorola order is used, if not then the Lease Significant Byte, little-endian or Intel order is used.
Sample time Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model.


CAN Communication Example | OBD reader example

See Also

CAN send | CAN config | XCP on CAN config