AnsweredAssumed Answered

Reading CAN msgs upon Wakeup

Question asked by Peter Tang on Sep 10, 2013
Latest reply on Sep 11, 2013 by Peter Tang

I'm playing around with an S12 micro to help me understand how to use CAN interrupts with a sleeping uP.


What I have in place is an infinite loop - while(1) - that puts the micro to sleep.

I (think I) have only enabled the CAN RXFIE - Receiver Full Interrupt Enable.

When the uP wakes up due to an inbound CAN msg, I get it to read the msg and then send a msg based on the contents of the received message.

The uP then goes to sleep again due to the loop.


Here's the problem - the msgs sent by the uP are not the ones I expected.

Upon startup it doesn't seem to always respond to my first few command msgs.

After a few msgs are sent, it then seems to lag behind my commands by 4 msgs.


Obviously I want it to respond to the command I just sent...

Does anyone know why this is the case? Have I just setup something wrong, or am I going about it the wrong way?