Hi,
I met an issue about CAN ID filter. Following is part of my code
I suppossed to get 0x7XX and 0x6XX ID of CAN message, but it only got 0x700 and 0x600. And the IRMQ was 1.
Then I changed IRMQ to 0 and check, it only got the CAN with ID 0x700 and 0x600, and IRMQ was 0.
IRMQ and RXIMR is setted under the freeze mode, the codo to enter freeze mode be like
while (!CAN_0.MCR.B.FRZACK) {} /* Wait for freeze acknowledge to set */
......
while (CAN_0.MCR.B.FRZACK & CAN_0.MCR.B.NOTRDY) {} /* Wait to clear */
Another interesting thing is when I set IRMQ to 1, it will be changed after interrupt of CAN message received. Is that normal?
Any suggestion about these issue?Thanks!
Solved! Go to Solution.
Hi,
leaving Freeze mode will be issue in you code. You are using below
First line clears IMRQ in fact. Either keep IMRQ set in MCR register write or use just HALT bit clearing
(CAN_0.MCR.B.HALT=0) to leave Freeze mode, assuming MCR was set previously wit desired configuration.
BR, Petr
Hi,
seems the IRMQ is finally not set. Share full code for entering/leaving Freeze mode.
Moreover, mask should be set as 0x700<<18 for both RXIMR registers, meaning highest 3 bits will be checked and lower 8bits are don't care.
IMRQ can be only modified by user in Freeze mode or module soft reset clears it too. Thus it is not expected it is changed in module interrupt unless done by user.
BR, Petr
Hi Petrs,
Thank you for your reply. I checked the code again and I found I didn't set the FRZ to enter the freeze mode, so I setted the bit and tried again. But it only received the message with ID 0x700 and 0x600. Atached txt is the function for these setting, any suggestion about this if I want to receive message with ID 0x7xx and 0x6xx?
Thank you
Hi,
leaving Freeze mode will be issue in you code. You are using below
First line clears IMRQ in fact. Either keep IMRQ set in MCR register write or use just HALT bit clearing
(CAN_0.MCR.B.HALT=0) to leave Freeze mode, assuming MCR was set previously wit desired configuration.
BR, Petr
Hi PetrS,
Thanks for your advices. I change lines from
CAN_0.MCR.R = 0x0000003F;
CAN_0.MCR.B.FRZ = 0;
to
CAN_0.MCR.B.MAXMB = 0x3F;
CAN_0.MCR.B.HALT = 0;
and it works. It seems I forgot to modify the MCR setting from the example, and thanks for your help.