FlexCAN Reception for any number of incoming message ID's

cancel
Showing results for 
Search instead for 
Did you mean: 

FlexCAN Reception for any number of incoming message ID's

Jump to solution
450 Views
nitinverma
Contributor III

We are working on Evaluation Board S32K144. 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(FSL_CAN0, 1UL, &gstr_vRx_Info_Cfg_CAN, 0x0au);

FLEXCAN_DRV_ConfigRxMb(FSL_CAN0, 2UL, &gstr_vRx_Info_Cfg_CAN, 0x0bu);

FLEXCAN_DRV_RxMessageBuffer(FSL_CAN0, 1UL, &gastr_vRXMsgBuffer[0]);

FLEXCAN_DRV_RxMessageBuffer(FSL_CAN0, 2UL, &gastr_vRXMsgBuffer[1]);

These are the APIs which I have used, as you can see MB1 is configured for ID 0x0A and MB2 is configured for ID 0x0B and we get the interrupt only for these mentioned ID's and able to receive data.Interrupt won't be generated for any other ID's.

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.

Kindly let me know what needs to be done with limited number of message buffer and more number of incoming ID's.

Thanks,

Nitin verma

Labels (1)
0 Kudos
1 Solution
100 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Nitin verma,

There is a register called "Rx Mailboxes Global Mask Register (CANx_RXMGMASK)", which is for all the Message Buffer excluding MB14-15, since you used MB1 and MB2 in your application  code, you may just set up this register to ignore the ID checking, Please kindly refer to the following for more details.

pastedImage_1.png

pastedImage_2.png


Hope that helps,
Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
6 Replies
101 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Nitin verma,

There is a register called "Rx Mailboxes Global Mask Register (CANx_RXMGMASK)", which is for all the Message Buffer excluding MB14-15, since you used MB1 and MB2 in your application  code, you may just set up this register to ignore the ID checking, Please kindly refer to the following for more details.

pastedImage_1.png

pastedImage_2.png


Hope that helps,
Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
100 Views
nitinverma
Contributor III

Hi Kan_Li,
Thanks for the reply.
Now I have used register CAN_RXMGMASK with bit position 18 to 28 set as zero(i.e dont care) for Standard ID's.Now in this case I am getting an reception interrupt for Tx ID's as well.
Case 1: I have configured MB0 for TX and cyclic Tx ID's are sent.For these Tx ID's I am getting an reception interrupt where i have not sent any Rx ID from CANoe.
Case 2: If I transmit any Rx ID from CANoe other than TX ID, I am getting a reception interrupt for that particular Rx ID.
Kindly let me know what other changes need to be done.
Here in my case MB0 is used for TX and MB1 is used for RX, how to set the masking register only for MB1 which is for reception.

Thanks,
Nitin verma

0 Kudos
100 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Nitin verma,

Please kindly check Module Configuration Register (CANx_MCR), and if bit 17 is set or not. Please kindly refer to the following for more details.

pastedImage_1.png


Hope that helps,
Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
100 Views
nitinverma
Contributor III

Hi Kan_Li,
Thanks for the reply now its working . I have another doubt now, what is the importance of the ID as the 4th argument in the config API 

FLEXCAN_DRV_ConfigRxMb(FSL_CAN0, 1UL, &gstr_vRx_Info_Cfg_CAN, 0x0au);

FLEXCAN_DRV_RxMessageBuffer(FSL_CAN0, 1UL, &gastr_vRXMsgBuffer[0]);

 

Question 1. since we are using mask register, ID parameter as an argument will be don't care, what should be the value in that config API?

 

 Question 2. Also, now in my case I am using XCP so i need one MB for reception ID 0x12 and another MB for remaining reception ID's(which is set to don't care), how to make use of masking register for two different MB's (i.e MB1 is having one fixed ID for XCP(0x12) and MB2 should receive all other remaining ID's except 0x12.)

 

Thanks,
Nitin verma

0 Kudos
100 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Nitin verma,

The APIs use the ID parameter to set up the corresponding message buffers, like below:

pastedImage_1.png

so if you set the mask register to check all the bits in the ID field, it would take effect.

and as I said before, there are another two mask register for MB14 and MB15, so it is possible to implement that function, but as the matching process always goes from the lowest number Message Buffer toward the higher ones, you have to set MB1 with ID 0x12 as RX buffer, and MB14/15 set to receive all other remaining ID's except 0x12. so you also have to set MB1's ID as 0x12 and the global mask register should set to check each bit in ID field to match 0x12, and mask register for MB14/15 can be set to ignore any ID.


Hope that helps,
Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
100 Views
nitinverma
Contributor III

Hi Kan_Li,
Thanks for the reply. Sorry I forgot to mention that I am using CAN FD.So I have MB0 to MB6 avaliable with me. In these MB's , I have used MB0 for Tx and I am left with MB1 to MB6, in which I want one MB for XCP and another for remaining Rx Id's.

So as per your reply I cannot make use of MB14 and 15.And the "Rx Mailboxes Global Mask Register (CANx_RXMGMASK)" which I have already used, how can I differentiate with MB's available with me for Rx.

Thanks,
Nitin verma

0 Kudos