FlexCAN Rx mailbox locking not working

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

FlexCAN Rx mailbox locking not working

Jump to solution
313 Views
ola_gook
Contributor II

I have a setup with an MPC5744P and am following the reference manual instruction for FlexCAN reception.

The problem is that after reading the Control/Status word of a certain MB (in an interrupt disabled context, the Can_Isr), the contents of the MB is still constantly updating.

Not sure if it is the debugger (Lauterback( that is causing this of if I am missing some crucial setting in the FlexCAN register.

As a result, every now and then the data passed from the Isr (ID + contents) is inconsistent.

Code extract from the Can_Rx ISR:
          McuE_DisableInterrupts();

          data = canHw->MB[mbNr].CS.R;

          while( data & 0x01000000 )      // Check BUSY bit (of the CODE field)

          {

            data = canHw->MB[mbNr].CS.R;  // If set, wait for it to be cleared

          }

          memcpy(dataTmp,(uint8 *)&canHw->MB[mbNr].DATA.W[0], 8);

 

Any help greatly appreciated.

0 Kudos
1 Solution
294 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

an MB is unlocked when the CPU reads the Free Running Timer Register (TIMER) or the C/S word of another MB. So if debugger displays registers or MB area it can cause this too.

BR, Petr

View solution in original post

0 Kudos
1 Reply
295 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

an MB is unlocked when the CPU reads the Free Running Timer Register (TIMER) or the C/S word of another MB. So if debugger displays registers or MB area it can cause this too.

BR, Petr

0 Kudos