CAN ID mask issue on MPC5744P

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

CAN ID mask issue on MPC5744P

Jump to solution
987 Views
qwesxrfvbgthujm
Contributor I

Hi,
I met an issue about CAN ID filter. Following is part of my code
CAN.jpg
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!

0 Kudos
1 Solution
933 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

leaving Freeze mode will be issue in you code. You are using below

PetrS_1-1683004643954.png

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

View solution in original post

4 Replies
976 Views
PetrS
NXP TechSupport
NXP TechSupport

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

0 Kudos
946 Views
qwesxrfvbgthujm
Contributor I

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

0 Kudos
934 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

leaving Freeze mode will be issue in you code. You are using below

PetrS_1-1683004643954.png

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

927 Views
qwesxrfvbgthujm
Contributor I

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. 

 

 

 

0 Kudos