I am trying to wake up from Stop3 mode by internal interrupt from RTC module in a MC9S08PA MCU.
Setting up the RTC module Clock Source Select work with LPO(~1KHz) working properly in Stop3 mode so RTC waking up the MCU after desired time, BUT while I am setting the RTC module with the Bus clock as Selected Clock Source, the RTC module dose not wake up the MCU.
As I read in Stop3 state :
" To enter stop3, the user must execute a STOP instruction with stop mode enabled
(SOPT1[STOPE] = 1). Upon entering the stop3 mode, all of the clocks in the MCU are
halted by default, but OSC clock and internal reference clock can be turned on by setting
the ICS control registers."
So that's the reason RTC dose not generate wake up situation.
After that I have to Enable ICS in Stop3 mode in order to make the RTC module work with Bus Clock timing.
As I read in Chapter 8: Clock Managment:
"188.8.131.52 Stop (STOP)
In stop mode, the FLL is disabled and the internal clock source can be enabled or
disabled. The BDC clock is not available and the ICS does not provide MCU clock
Stop mode is entered whenever the MCU enters a stop state. In this mode, all ICS clock
signals are static except in the following cases:
• ICSIRCLK will be active in stop mode when all of the following conditions occur:
• ICS_C1[IRCLKEN] bit is written to 1
• ICS_C1[IREFSTEN] bit is written to 1
• OSCOUT will be active in stop mode when all of the following conditions occur:
• ICS_OSCSC[OSCEN] bit is written to 1
• ICS_OSCSC[OSCSTEN] bit is written to 1
The DCO frequency changes from the pre-stop value to its reset
value and the FLL need to re-acquire the lock before the
frequency is stable. Timing sensitive operations must wait for
the FLL acquisition time, tAquire, before executing."
The Problem is that until now I cannot start the ICS in Stop3 mode in any way , while I have already done what the above informs me.
Please tell me if I miss something in order to start the ICS module in a Stop3 situation.
It is very critical for me to timing the RTC module with Bus Clock while we need more precise time on wake up situation, than LPO can give.
P.s. : I have already test that ICS work without FLL but direct with ICR(Internal Reference Clock) (ICS_C1_CLKS=01), and work properly, so the only problem is to make ICS module work at Stop3.
Thanks in advance