Deep Sleep and VLPS on MK64FN1M0VLL12

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Deep Sleep and VLPS on MK64FN1M0VLL12

1,872 次查看
jakubpankau
Contributor II

So I'm trying to put my microcontroller into deep sleep mode (stop) or the VLPS mode. In my code I'm calling a function that suppose to put the uC in sleep mode and then I would like to use a UART port as a wake up. From what I have read in STOP mode any interrupt should wake the microcontroller (without use of the LLWU). Here is a code that I'm using to put the system in sleep:

 NVIC_EnableIRQ(UART4_RX_TX_IRQn);  //enable UART4 interrupts
 SMC_PMPROT = SMC_PMPROT_AVLP_MASK;
 /* Set the STOPM field to 0b010 for VLPS mode */
 SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;
 SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x2);
 //exit to run on interrupt
 SMC_PMCTRL |= SMC_PMCTRL_LPWUI_MASK;
 /*wait for write to complete to SMC before stopping core */
 dummyread = SMC_PMCTRL;
 /* Now execute the stop instruction to go into VLPS */
/* Set the SLEEPDEEP bit to enable deep sleep mode - enter stop mode*/
  SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
 #ifdef CMSIS
 __wfi();
 #else
 /* WFI instruction will start entry into STOP mode */
 asm("WFI");
 #endif

There are multiple issues that I observed with both STOP and VLPS modes:

   1. The current is regular RUN mode is around 40mA at 3V, which is what the datasheet specifies. After I execute the    sleep instruction it decreases to around 25 mA, which is way to big. According to datasheet it should be around    0.5mA.

   2. The system does not wake up, when I send any command through UART. It looks like it is not responding at all.

   3. The sleep function does not work in debug mode. It looks like the instructions are executed but it does not go    into any sleep modes. (I'm using Keil development studio).

Any help or suggestions is greatly appreciated.

3 回复数

1,130 次查看
jakubpankau
Contributor II

Thanks guys, will try some of your suggestions and let you know if it works. Thanks again.

0 项奖励
回复

1,130 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

NXP provides KSDK software for K64 product, which includes low power demo located at below default location:

..\SDK_2.0_FRDM-K64F\boards\frdmk64f\demo_apps\power_manager

The KSDK software could be build and downloaded from here.

And customer also could download bare-metal K64 example code from here, which also provides a low power demo.

KINETIS_K64_SC(REV 1.3)
Bare metal sample code for Kinetis K64 120 Mhz

The UART module could wake up the core from STOP and VLPS mode with interrupt enabled. Please check if the related UART module interrupt enabled or not.


Wish it helps.

Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,130 次查看
mjbcswitzerland
Specialist V

Hi

See https://community.nxp.com/message/421247#421247
This gives some expected figure and you can test on HW using the binaries at
http://www.utasker.com/kinetis/FRDM-K64F.html
http://www.utasker.com/kinetis/TWR-K64F120M.html

Attached is the low power interface as used by the uTasker project which includes a complete (integrated) low power solution supporting all modes and automatic dynamic switching between whatever mode you want to use (eg. VLPS with almost unrestricted UART operation on all 6 UARTs) so that you don't need to actively command anything (it will simply sleep whenever there is nothing pending).
The solution has been proven during over two years of real product operation (also K64 based, but is compatible with all K, KL, etc. designs) with very low power requirements in a POS type environment requiring also immediate UART response (eg. bar code readers) and so is reliable and mature (not simply example code that needs further development and bug fixing to become useful).

All code is Keil compatible (as well as CW, KDS, IAR, Green Hills, etc.) and the complete framework contains a Keil project. Note however that not all low leakage modes can be fully tested with the debugger since the JTAG/SWD interface will also be deactivated.

Regards

Mark