Hello,
I'm doing an IoT project with the Kl25z freedom board, and I have a problem switching between power modes. I want to put the kl25z into LLS mode and wake it up with a pulse counting event from the LPTMR or a RTC clock alarm. I manage to put the kl25z to LLS but then it never wakes up. I tested the RTC and LPTMR ISRs and they work fine while the MCU is in Run mode. I'm using KDS and KDSK v1.2. I'm sourcing the RTC_CLKIN pin with a 32.768kHz lab function generator oscillator. Here goes the pictures of my PE configuration:
clock config:
SIM config:
SMC init config
LLWU init config
Also I attach my main.c and event.c files.
I have read a bunch of app notes and the mcu reference manual but they didn't help solving my problem.
Thanks
Rocco
Original Attachment has been moved to: sources.rar
Solved! Go to Solution.
Hello Rocco,
I made a quick review on your files and could notice that you are masking the LLWU interrupt, but if you check KL25's reference manual, in section 15.1.2.1 LLS mode, there is a note that specifies about LLWU interrupt must not be masked by the interrupt controller to avoid a scenario where the system does not fully exit stop mode on an LLS recovery, so i think that is your problem.
In addition, i am also attaching a basic project where RTC, GPIO and Power Mode are included, in this case, i can wake up from LLS either using external pin (PTD6) and/or RTC Alarm interrupt, i hope this can help you as guidance.
I tested this project and it works well to demostrate that RTC can wake MCU from LLS mode (please notice that i am not using an external 32.768kHz RTC clock and accuracy is not achieved in this simple project, but it serves as guidance to understand the process to wake-up by using external and internal modules).
For more information about RTC clocking in FRDM-KL25Z i can suggest to watch this post: RTC in KL devices - should it be possible to use OSC32KCLK?
If you have another question please let me know it!
Best Regards,
Isaac
----------------------------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------------------------
Hello Rocco,
I made a quick review on your files and could notice that you are masking the LLWU interrupt, but if you check KL25's reference manual, in section 15.1.2.1 LLS mode, there is a note that specifies about LLWU interrupt must not be masked by the interrupt controller to avoid a scenario where the system does not fully exit stop mode on an LLS recovery, so i think that is your problem.
In addition, i am also attaching a basic project where RTC, GPIO and Power Mode are included, in this case, i can wake up from LLS either using external pin (PTD6) and/or RTC Alarm interrupt, i hope this can help you as guidance.
I tested this project and it works well to demostrate that RTC can wake MCU from LLS mode (please notice that i am not using an external 32.768kHz RTC clock and accuracy is not achieved in this simple project, but it serves as guidance to understand the process to wake-up by using external and internal modules).
For more information about RTC clocking in FRDM-KL25Z i can suggest to watch this post: RTC in KL devices - should it be possible to use OSC32KCLK?
If you have another question please let me know it!
Best Regards,
Isaac
----------------------------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------------------------
Thank you Issac! I tried your example and worked, I think the problem was the masked LLWU interruptions.