Why is the parameter msg_id needed in the FLEXCAN_DRV_ConfigRxMb function?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why is the parameter msg_id needed in the FLEXCAN_DRV_ConfigRxMb function?

251 Views
Sang-Hoon_Ahn
Contributor I

Hi I am currently creating a firmware that receives messages with CAN message ID 0x100-200.(Do not use the FlexCAN Filter feature)

When designing the can data send function based on the flexcan example in the S32 SDK, I understood the composition of the FLEXCAN_DRV_ConfigTxMb function and parameters and the FLEXCAN_DRV_Send function and parameters.

However, the parameter msg_id of the FLEXCAN_DRV_ConfigRxMb function is not understood why it is needed and for what purpose.
Why does the documentation for the FLEXCAN_DRV_ConfigRxMb function describe msg_id as "ID of the message to transmit"?

Why does the FLEXCAN_DRV_ConfigRxMb function, which performs the FlexCAN receive message buffer field configuration function, need a parameter in the 'transmit' category?

Why does FLEXCAN_DRV_ConfigRxMb need to receive the id of the can message to be transmitted as a parameter?

If I need to receive messages with can message ids 0x100-200, do I also need to pre-define 160 msg_ids for the FLEXCAN_DRV_ConfigRxMb function?

I question the need for msg_id in the FLEXCAN_DRV_ConfigRxMb function, it seems to be a contradictory parameter.

0 Kudos
1 Reply

233 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the msg_id of the FLEXCAN_DRV_ConfigRxMb function is the ID of the message to receive.
Description in the documentation is most probably just a copy from transmit function description.
During frame reception a matching process is started and scans the MB memory looking for Rx MBs programmed with the same ID as the one received from the CAN bus. If a matching ID is found then MB is updated with message content.
So you have to specify the ID for your RX MB using FLEXCAN_DRV_ConfigRxMb function.
Mask acceptance registers allows you to define the masks for ID filtering in Rx MBs and the Rx FIFO. The mask bit in respective mask register determines if the corresponding bit in the filter/ID specified is checked against the one received. This way you can create a ID range to be accepted into a single MB.
The driver sets global mask registers to have ones in all bits and global masking scheme is used, thus there must be exact match between received ID and programmed one to receive message into an MB.
For you scenario, to receive CAN message with IDs 0x100-200, you will need to use mask registers, as there is max 96 MBs available within FlexCAN module.

BR, Petr

0 Kudos