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.