Hello! In an application I have the problem of reading the contents of the TwinCAN Controller A Status Register. Below you will see a code snipped and what the compiler creates out of it:
773: mem=CAN_ASR; 00010C5A D7408000 EXTP #0x0080,#1 00010C5E F2F40402 MOV R4,DPP0:0x0204 00010C62 E4801E00 MOVB [R0+#0x001E],RL4
Hi Patrick, No, reading should not clear the LEC information. According to the µcontroller documentation, reading the register just clears the status change interrupt request, but this is not used in the application. Also, the effect described above seems to happen, if I run the application in Release configuration out of the controllers flash. Then my application tells me that an error occurred on the CAN, but the LEC information says 'No Error' But thanks for the suggestion! Andreas
The ASR is telling you that you are in a bus off state. The LEC will no longer be updated since the bus is disconnected. Is your software making use of the Error Interrupt or the Status Change Interrupt? An Ack Error will not cause you to go bus-off. So you need to first track down the reason for the bus-off.