Hi,
I have a problem with the stop3 mode in MC9S08SH16.
After executing the STOP instruction the MCU enters in stop3 mode, but sometimes stop3 is exited when MTIM (modulo timer) interrupt occurs.
The datasheet doesn't say that MTIM interrupt is a source to exit from stop3 mode, but I have checked that it is.
The STOP instruction first enables the interrupts (the I bit in the condition code register (CCR) is cleared to
enable interrupts) and then inhibits the oscillator to put MCU into the stop condition.
My question is: if the MTIM interrupt takes place between the two steps of the STOP instruction, that is, MTIM interrupt takes place after the STOP instruction enables the interrupts but before the oscillator is inhibited, the MCU doesn't enter in stop3 mode?
Thanks in advance.
Solved! Go to Solution.
Hello,
Did you try explicitly stopping the MTIM counter prior to executing the STOP instruction. This can be accomplished with MTIMSC_TSTP = 1;
This would then be re-enabled on exit from stop 3 mode.
Regards,
Mac
Hello,
Did you try explicitly stopping the MTIM counter prior to executing the STOP instruction. This can be accomplished with MTIMSC_TSTP = 1;
This would then be re-enabled on exit from stop 3 mode.
Regards,
Mac
Hello,
Yes I tried. Stopping the MTIM or disabling MTIM interrupt works.
Thank you.