VLLS0 mode for KL03 in KSDK v1.2

Hi all, despite a lot of tries I am unable to set the VLLS0 mode of a KL03 mcu using the KSDK v1.2 peripheral drivers in KDS v3.0.

The attached project is reduced to a strict minimum for testing: only a led and a switch for awakening from VLSS0. When debugging, after the instructions:

POWER_SYS_ClearWakeupPinFlag(kPowerManagerWakeupPin4);

POWER_SYS_SetMode(0, kPowerManagerPolicyForcible);

the code execution can be followed till the mode switch of the "__WFI();" instruction in the HAL component, then the J-Link debugger is suspended at 0X0 but the current supply remains the same indicating that the internal osc is still running. This could mean that there is an interrupt loop, but the LLWu external pin has no influence on it nor the flag clear in the handler:

void LLWU_IRQHandler(void) {

/* Write your code here. For example clear LLWU wake up flags ... */

POWER_SYS_ClearWakeupPinFlag(kPowerManagerWakeupPin4);

I feel as if I am missing something, but unfortunately the AN and documentation I found were not very helpful. Can someone help me please?

I wouldn't use the debugger when testing/developing low leakage modes since there are conflicts with the debugger; it is best to test such things on the stand-alone hardware.

Note that wake up from VLLS0 and a wakeup port is via a RESET so there is no interrupt that is handled at wake up - but the interrupt will be pending after the reset. The easiest way of detecting that it was a reset due to wakeup is to check the reset controller, which will signal it as a wakeup source.

I have attached the uTasker FRDM-KL03Z project build (with low power support) as reference. If you have this board you can load the binary to it and test low power modes in the "Administration" menu that appears on the virtual COM port at 19200 Baud (a low speed baud is used because there is a big capacitor on the Rx input).

There is still left to enable VLLS modes on SMC_PMPROT register. (On reference manual, see section 15.4.1 Power Mode Protection register) and also, restore peripherals I/O (because there are latched when being in VLLS mode), this is done by clearing ACKISO flag in PMC_REGSC register (section 16.5.3 Regulator Status and Control register).

You should add fsl_pmc_hal and fsl_smc_hal components to your project:

Generate code for being able to use PMC_HAL_GetAckIsolation() and SMC_HAL_SetProtection() functions.

First, you need to recover the I/O peripherals when entering from RESET and after that, you need to allow VLLS mode, it is done just after entering main function:

Attachments

Thanks for your answer, but unfortunately none of your VLLS0_... version and my KL03... version modified as suggested puts the mcu in deep sleep. The only difference I noted is you are using an external oscillator while I use the internal one.

When running, the WFI instruction is executed, at once debugger connection is lost and processor resets as if there was some interrupt pending and this cycle repeats for again (through reset). I also tried to disable the LLWU_P4, gòobaò interrupt and reset pin in PE component but without change.