I am using S12ZVML MCU.
I want to put the MCU in Sleep Mode and perform Wake up through a GPIO.
GPIO meaning the wake up functionality through either PORT AD or PORT S (/SCK0 or /SS0)
Will the /IRQ or /XIRQ interrupt occur beacuse of the prescence of active edge on the 1 of the above said GPIO pin beacuse of which wake up procedure will be initiated.
Can someone please provide me with a sample code as to how to perform the same.
Thank you in advance.
Hi,
Interrupt on a falling edge on PS5 can be configured as:
DDRS_DDRS5 = 0; /* PS5, input */
PPSS_PPSS5 = 0; /* PS5. Pull-up device selected, falling edge selected */
PERS_PERS5 = 1; /* PS5, Pull device enabled */
PIES_PIES5 = 1; /* PS5, Interrupt enabled */
To put the MCU into stop mode use:
asm ANDCC #0x7f; /* Clear S bit, enable STOP instruction */
asm STOP;
And clear the interrupt flag in the PortS_ISR after wakeup:
interrupt VectorNumber_Vports void PortS_ISR(void){
PIFS_PIFS5 = 1; /* Clear the PS5 interrupt flag */
}
Regards,
Daniel
Hi,
I also have some other queries to be resolved:
1. In Full Stop mode since the oscillator is stopped and clocks are switched off, internal peripherals like timer and ADC wont work,but watchdog will run. Is this understanding correct.
2.In Full Stop mode what is the MCU behaviour if it receives other interrupt requests(other than wake up)
3.What is the MCU behaviour after it leaves the stop mode. Does it start the execution where it last left or does it start from the init sequence.?
Thanks in advance.
Hi,
Yes, the KWU function can be used with the general-purpose or related peripheral functions.
1. COP can be active in Full-Stop Mode if the clock source of the counter is ACLK, as described in Section 8.1.3.3, RM r2.11.
2. Any interrupt that can occur in Stop mode will bring the MCU from Stop mode.
3. It starts with the execution of the ISR and the subsequent instructions after the STOP instruction.
Regards,
Daniel
Hi danielmartynek
I have one doubt .
Here you have used PS5 which also has serial Interface functionality as the pin is used as /SS0.
Is it OK to use that pin for keywake up as well as serial IF
Thanks in advance