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:
"18.104.22.168 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
I could be wrong but I don't think you can use the bus clock to exit STOP3 mode.
Have a look at this (also noting: "The system integration module (SIM) holds the CPU in a non-clocked state"):
Thanks for the reply.
CPU is like module for MCUs and is clocked from the ICS. Bus Clock is not generated from CPU but from ICS module as image above informs us.
So the Bus Clock that is controlled from ICS and it is equal to ICSCLK, must be on at Wati mode
and Optionally On at Stop3 mode.