CAN Rx

CAN Rx block

This block implements receiving data by CAN interface on STM microcontrollers.

Contents

Inputs

None

Outputs

  • Status – status of receive operation (1 – new message available)
  • Id – id of received frame
  • DLC – data length of received frame
  • Data – received data

Block parameters

  • Module number – number of CAN module used in model
  • ID Type – type of ID to receive
  • Init filter in loop
  • Type – type of filter (IDMASK – ID and mask / IDLIST – 2 IDs)
  • Config FIFO – FIFO to receive frames to
  • ID/ID1 – ID or ID1 setting for filter (11 bit for standard, 29 for extended)
  • Mask/ID2 – Mask or ID2 setting for filter (11 bit for standard, 29 for extended)
  • Data length (bytes) – Max data length to receive per frame
  • Num of buffer – Frame buffer (software fifo) size
  • Data output mode – Data output layout (vectors or matrix)
  • Timeout [ms] – Receive timeout
  • Sample time – period of function refreshing (-1 means that a particular block takes sample time from its input block or if it doesn’t have any input block it takes the fastest sample time in a model)

CubeMX settings

  • Connectivity->CANx->Activated
  • Connectivity->CANx->NVIC Settings tab->CANx RX0 interrupts enabled
  • Connectivity->CANx->NVIC Settings tab->CANx RX1 interrupts enabled