I try to add a sleep function to reduce the MKL27Z644 power current. Code as below:
SMC->PMPRORT =-1; //added for sleep mode
sleep(); //enter sleep for LPUART interrupt to wake up into rum mode.
SMC->PMCTRL = BIT6; //RUNM VLPR;
It is not work at all. I don't know how to make this to work. I could not add the line 'asm("WFI") that disables LPUART interrupt.
Hello Albert Zhou
I suggest you to refer to the sdk examples to implement sleep function Welcome | MCUXpresso SDK Builder.
To add the WFI line please refer to this definition on the sdk example:
For more detailed information about power management, please refer to this application note: https://www.nxp.com/docs/en/application-note/AN4503.pdf
Also note that in order to enter into a power mode is important to implement a wakeup routine.
Let me know if this is helpful. If you have more specific questions do not hesitate to ask me.
Thanks for your response and help. I see the line __WFI() defines.
I have to stay in Kinetis SDK because it is complicated when you move all the projects with a bootloader from Kinetis to MCUXpressor.
The original project already has interrupt LPUART1, I just need to put the chip into sleep and it wakes up by the Modbus LPUART1.
I follow the AN4503 tried sleep function and VLPR and VLPS functions. All of them won’t work, except the VLPS mode does put it into deep sleep but could not wake up. It seems the line asm(“WFI”) disabled LPUART1 even at sleep().
Sr. Electronics Engineer
+1 714 230 2768
11751 Markon Drive, Garden Grove, CA 92841
<https://www.facebook.com/Sensorex> <http://t.sidekickopen05.com/s1t/c/5/f18dQhb0S7lM8dDMPbW2n0x6l2B9nMJN7t5X-Ff4Yc8W4WJpMP7dWWcgW6ND00211fj5b0?t=https%3A%2F%2Ftwitter.com%2FSensorexInc&si=7000000000014733&pi=ca5a45ef-58ca-4f28-9010-24a9c3d147a2> <http://t.sidekickopen05.com/s1t/c/5/f18dQhb0S7lM8dDMPbW2n0x6l2B9nMJN7t5X-Ff4Yc8W4WJpMP7dWWcgW6ND00211fj5b0?t=https%3A%2F%2Fwww.linkedin.com%2Fcompany-beta%2F1768298%2F&si=7000000000014733&pi=ca5a45ef-58ca-4f28-9010-24a9c3d147a2>