Hello
I am trying LLS mode for KL25Z freedom board.
To wake up from interrupt I am using wake up timer.
For this I m referring “PEx_low_power_demo “code from KL25_SC.exe
This code is working.
But when I prepare my own code with same CPU and timer setting my code is not working.
I compare generated files related to timer both are exactly same through my code is not working
I have attached my code in which RED led will continuously blink after coming out of the LLS mode.
Please let me know if any changes required in code or in setting?
Regards
Amreen
Original Attachment has been moved to: Sensor_Base_Code.rar
Solved! Go to Solution.
Hi Amreen,
Thank you for your interesting in our product, I would like to provide service for you!
I already checked your code, I find you missed some code when you are using the LPTMR as the wake up source.
Please add some code in your events.c
the Cpu_OnLLSWakeUpINT function should be like the following:
void Cpu_OnLLSWakeUpINT(void)
{
/* Write your code here ... */
SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK;
LPTMR0_CSR |= LPTMR_CSR_TCF_MASK; // write 1 to TCF to clear the LPT timer compare flag
LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK );
}
then when you run your code, you will find your red light will blinking after wakeup.
If you still not OK, please get the attached code, this is modifed by me based on your code.
Wish it helps you!
If you still have question, please contact with me !
Have a great day,
(my name)
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Amreen,
Thank you for your interesting in our product, I would like to provide service for you!
I already checked your code, I find you missed some code when you are using the LPTMR as the wake up source.
Please add some code in your events.c
the Cpu_OnLLSWakeUpINT function should be like the following:
void Cpu_OnLLSWakeUpINT(void)
{
/* Write your code here ... */
SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK;
LPTMR0_CSR |= LPTMR_CSR_TCF_MASK; // write 1 to TCF to clear the LPT timer compare flag
LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK );
}
then when you run your code, you will find your red light will blinking after wakeup.
If you still not OK, please get the attached code, this is modifed by me based on your code.
Wish it helps you!
If you still have question, please contact with me !
Have a great day,
(my name)
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------