HCS08 and stop3 mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS08 and stop3 mode

Jump to solution
854 Views
zorrotz
Contributor III

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.

Labels (1)
0 Kudos
Reply
1 Solution
453 Views
bigmac
Specialist III

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

 

View solution in original post

0 Kudos
Reply
2 Replies
454 Views
bigmac
Specialist III

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

 

0 Kudos
Reply
453 Views
zorrotz
Contributor III

Hello,

 

Yes I tried. Stopping the MTIM or disabling MTIM interrupt works.

 

Thank you. 

0 Kudos
Reply