I'm developing an application with KL14. I was able to enter VLLS3 mode and exit from it by using a button connected to a LLWU input, starting from examples given in code zipped in KL25_SC.exe
Now I need to exit the VLLS3 mode by using a CMP input, when an external input voltage goes below a certain level: is there any given example code to start from?
已解决! 转到解答。
Currently, there are no given example code to exit the VLLS3 mode by using a CMP input. But it is not difficult to find that in low_power_demo example there is a cmp.c , you can refer to case 3 in low_power_ demo example (it use the LPTMR as the wake up source)to write the code.
When you use the cmp.c, some point you need to pay attention in your main.c:
1,set the CMP as the wake up source
llwu_configure(0x0000, LLWU_PIN_FALLING, 0x2);
2, open cmp clock
SIM_SCGC4 |= (SIM_SCGC4_CMP_MASK );
3,enable CMP interrupt
NVIC_EnableIRQ(CMP0_IRQn);
4,initial CMP
cmp_init (0x18);
you can refer the low_power_ demo example to write your own code.
I wish it helps you!
Best regards!
Currently, there are no given example code to exit the VLLS3 mode by using a CMP input. But it is not difficult to find that in low_power_demo example there is a cmp.c , you can refer to case 3 in low_power_ demo example (it use the LPTMR as the wake up source)to write the code.
When you use the cmp.c, some point you need to pay attention in your main.c:
1,set the CMP as the wake up source
llwu_configure(0x0000, LLWU_PIN_FALLING, 0x2);
2, open cmp clock
SIM_SCGC4 |= (SIM_SCGC4_CMP_MASK );
3,enable CMP interrupt
NVIC_EnableIRQ(CMP0_IRQn);
4,initial CMP
cmp_init (0x18);
you can refer the low_power_ demo example to write your own code.
I wish it helps you!
Best regards!
Thank you. It works fine. Now I'm trying to understand how to recognize which source causes the wakeup. In my case the internal module#2 - CMP0 or the external pin LLWU5.
After reset, reading the register RCM_SRS0 doesn't help since both CMP and llwu causes to set the same bit WAKEUP.
Which bit and wich register allows to distinguish between the two reset sources?