Hi all, firstly I would like to apologise if this question has already been answered. I have seen a lot of questions on these boards that are related to MSCAN but so far I have not found a question/answer that is exactly similar.
PSEUDO CODE (steps before entering Stop mode):
1) Set SLPRQ = 1
2) Wait until SLPAK == 1
3) Set WUPE and WUPIE to 1
4) 10 ms Delay (executing other tasks, ISRs)
5) Enter STOP mode (interrupts are NOT globally disabled)
Usually the above steps in our source code allow the MSCAN to wake the S9KEAZ64 up from STOP mode. However I discovered that if a new CAN packet arrives during step #4 above, then MSCAN wakes up and automatically resets SLPRQ and SLPAK to 0. If this happens, MSCAN will not wake the MCU from STOP mode because SLPRQ and SLPAK are no longer 1.
Is there a way of overcoming this? The delay in Step #4 is more than 10 milliseconds. Should I enter STOP mode immediately after SLPAK becomes 1? If so, what is the maximum delay that can be used.