Base on RTM 1.0.0 firmware library,CAN Reception for any number of incoming message ID's

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

Base on RTM 1.0.0 firmware library,CAN Reception for any number of incoming message ID's

872 Views
jason1zhao
Contributor I

We are working on Evaluation Board S32K144 and RTM 1.0.0 firmware library. I just want to receive the data for whatever incoming Id without Rx FIFO(Id's are unknown).
I have done with the single Id configuration for particular message buffer and its working fine.

         FLEXCAN_DRV_ConfigRxMb(INST_CANCOM2, RX_MAILBOX, &dataInfo, RX_MSG_ID);

         FLEXCAN_DRV_Receive(INST_CANCOM2, RX_MAILBOX, &recvBuff);
         while (FLEXCAN_DRV_GetTransferStatus(INST_CANCOM2, RX_MAILBOX) == STATUS_BUSY);

      Now,I have hundred,thousands of unknown incoming IDs What changes do I need to make,interrupt should be generated for all incoming ID's, with the above approach its seems impossible to achieve the task.

   Base on RTM 1.0.0 firmware library, how should I modify it?

Thanks,

Jason

      

Tags (1)
0 Kudos
Reply
1 Reply

699 Views
AnaAldescu
NXP Employee
NXP Employee

Hello Jason,

When you configure a message buffer for receiving, you must specify a matching ID for the incoming frame. But you can also configure an additional ID filtering using the mask registers. This mask is applied over the ID of the incoming frame and each bit of the mask means that the corresponding bit in the ID must match the configured ID or not (0b - The corresponding bit in the filter is "don't care", 1b - The corresponding bit in the filter is checked).

So, if you need to receive any ID, there are two possible ways to do this: you either use individual masking or global masking.

  • for individual masking: FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL); -> enables individual masking

                      FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_STD, x, mask); -> sets the ID mask for MB x

  • for global masking: FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_GLOBAL); -> enables global masking

                   FLEXCAN_DRV_SetRxMbGlobalMask(INST_CANCOM1, FLEXCAN_MSG_ID_STD, mask); -> sets the same ID mask for all MBs except MB14  and MB15

So, in order to receive any ID, the mask should be set with value 0, which means that the ID bits don't need to match.

Please let me know if you have any other questions.

Regards,

Ana