Skip to Content
Block descriptionsCANCAN Receive

CAN Receive

This block handles receiving messages via the CAN bus in STM microcontrollers.



CAN Receive block

Table of Contents

Inputs

This block does not have any inputs.

Outputs

Output NameTypeDescription
Statusuint8Transmission status. Returns:
1 transmission successful
0 transmission failed
IDuint32ID number of the received message.
DLCuint8Data length of the received frame.
Data[ ]uint8Data from the received frame.

Block Parameters

ParameterDescription
Module numberCAN module number
ID TypeMessage ID number type:
Standard ID - standard number (11 bits)
Extended ID - extended number (29 bits)
Init filter in loopEnables initialization of the filter on every block execution loop
TypeMessage filtering method selection:
CAN_FILTERMODE_IDMASK - filtering messages by mask
CAN_FILTERMODE_IDLIST - filtering messages by ID numbers
Config FIFOReceive buffer configuration:
CAN_FILTER_FIFO0 - messages are received into FIFO0 buffer
CAN_FILTER_FIFO1 - messages are received into FIFO1 buffer
IDConditional Parameter
Message ID number used for filtering. This setting is visible only when the Type parameter is configured as CAN_FILTERMODE_IDMASK.
MaskConditional Parameter
Mask used for message filtering. This setting is visible only when the Type parameter is configured as CAN_FILTERMODE_IDMASK.
ID1Conditional Parameter
Message ID number used for filtering. This setting is visible only when the Type parameter is configured as CAN_FILTERMODE_IDLIST.
ID2Conditional Parameter
Message ID number used for filtering. This setting is visible only when the Type parameter is configured as CAN_FILTERMODE_IDLIST.
Data length (bytes)Maximum data length per frame (in bytes)
Num of bufferNumber of receive buffers. This setting affects the amount of messages that can be stored in the receive buffer before being processed.
Data output modeWay data from the received frame is represented:
Matrix - data is represented as a matrix
Vectors - data is represented as vectors
TimeoutHow long the system will wait for the block execution
Sample time [s]Function refresh rate


Block parameters for CAN Receive

CubeMX Configuration for a Given MCU

Configuration for CAN can be found on the CubeMX Configuration for a Given MCU subpage.

See Also

Last updated on