Can't able to leave VLPS mode on Kinetis K10

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't able to leave VLPS mode on Kinetis K10

1,105 Views
taimurwajad123
Contributor III

Hi All,
I'm working on MK10DX128FT5 and using touch input with TSS library. A system requirement is to enter VLPS and on touch input or UART interrupt system must come back to normal run mode. I'm able to enter VLPS mode however I'm not able to leave that mode by any method. I have tried almost everything mentioned on Datasheet and I also visited the forums and go through most of the discussion. Any hints, about how I can leave VLPS mode?
PS: I'm able to enter and leave VLPR mode by both methods (UART, TSI ) . The problem comes when I'm executing 'WFI' command.

Any help will be highly appreciated.

6 Replies

735 Views
taimurwajad123
Contributor III

Hi Jing,,
Thanks for the reply. Actually an interrupt is generated on reception from UART, but the MCU doesn't wakeup automatically. Do I have to set some registers again?
From datasheets, I know that on interrupt, the MCU should come to normal Run mode.

0 Kudos

735 Views
mjbcswitzerland
Specialist V

Taimur

Beware that the UART can only use the asynchronous edge interrupt in VLPS to wake from - the UART itself is not clocked and so no (normal) UART reception interrupt will arrive.

See https://community.freescale.com/message/421247#421247 

Regards

Mark

0 Kudos

735 Views
taimurwajad123
Contributor III

Hi Mark,
Thanks for reply.
I'm exectuing following commands before entering VLPS mode.

  UART1_S2 |= UART_S2_RXEDGIF_MASK;
  UART1_BDH|= UART_BDH_RXEDGIE_MASK;

 Cpu_SetClockConfiguration(CPU_CLOCK_CONFIG_1);

 SMC_PMPROT |= SMC_PMPROT_AVLLS_MASK;
 SMC_PMCTRL = 0x82U;
 SCB_SCR    |= SCB_SCR_SLEEPDEEP_MASK;
  __asm("WFI");

Also on exit from VLPS, do I have to set these registers again or is it done automatically?

0 Kudos

735 Views
mjbcswitzerland
Specialist V

Taimur

You can compare with the uTasker Open Source code on Github in case of problems - it is a complete quality reference proven in industrial projects requiring low power and fast UART wake up from VLPS, rather than just examples snippets.

Your code looks essentially good - it is the same as the uTasker code in many respects.

            if (IS_POWERED_UP(4, UART1)) {                               // if UART1 is enabled
                UART1_S2 |= UART_S2_RXEDGIF;                             // clear edge flag
                UART1_BDH |= UART_BDH_RXEDGIE;                           // enable wakeup on RxD falling edge
                if ((UART1_S2 & UART_S2_RAF) != 0) {                     // if the receiver active flag is set it means that reception has already started so we don't enter stop mode
                    SYSTEM_CONTROL_REGISTER &= ~SLEEPDEEP;               // use wait mode until the reception has completed
                }
            }

After wake up I disable the IRQ so that it is not actually taken.

    if (IS_POWERED_UP(4, UART1) != 0) {                                  // if UART1 is enabled
        UART1_BDH &= ~(UART_BDH_RXEDGIE);                                // disable edge interrupt on RxD since we never want to handle the actual interrupt (used just for waking)
    }

To prepare for VLPS:

SMC_PMCTRL = (SMC_PMCTRL_RUNM_NORMAL | SMC_PMCTRL_STOPM_VLPS | SMC_PMCTRL_LPWUI);

SYSTEM_CONTROL_REGISTER |= SLEEPDEEP;

and

SMC_PMPROT = SMC_PMPROT_AVLP;

Beware that SMC_PMPROT is a 'write-once' register so it is best to set its value once after reset with the modes that will be needed.

Make sure that you disable interrupts globally before entering VLPS mode and only re-enable them after full recovery (you may have to also reconfigure clocks, like PLL, if you allow them to stop)

Regards

Mark

P.S: You can also see some low power videos at
https://www.youtube.com/watch?v=kWNlsAoMly4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q

0 Kudos

735 Views
taimurwajad123
Contributor III

Hi Mark, Thanks for the reply,
Right now, the system wakes up succefully after first entery to the VLPS mode, however after that, when the system again enters in VLPS mode, it's not waking up again, UART isn't sending interrupt(assumed), what could possibly I'm doing wrong?

0 Kudos

735 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Taimur,

wake up from VLPS only need an interrupt. If you can't wake up, it means that the interrupt signal doesn't generate or transmit to MCU core. Please refer to SDK_2.2_FRDM-KL28Z\boards\frdmkl28z\demo_apps\power_manager.

Regards

Jing

0 Kudos