Waking from VLPS

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

Waking from VLPS

5,948 Views
BrianM
Contributor I

I am trying to figure out why my K40 (on a KwikStik) does not wake up on serial port activity. This is how I go to sleep:

 

  SCB_SCR = 0x4;  //SLEEPDEEP = 1  MC_PMCTRL = 0xC2; //LP Wakeup enable, RUNM=2, LPLLSM=2  //let UART5 RX edge cause wake-up UART_S2_REG(UART5_BASE_PTR) |= UART_S2_RXEDGIF_MASK; //clear it before enabling interrupt UART_BDH_REG(UART5_BASE_PTR) |= UART_BDH_RXEDGIE_MASK; //enable wake-up on serial port rx edge UART_S2_REG(UART5_BASE_PTR) |= UART_S2_RXEDGIF_MASK; //make sure it is cleared before going to sleep  SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK; asm("WFI");

 

When it goes to sleep, the current goes down - I measure .1mV across the 1ohm resistor on the board for current monitoring. When I send a character to the serial port, the meter reading goes up but only to .5 and there is no sign that the code is running. If I comment out the line that enables the wake-up via serial port then the reading stays at .1 when I send a character.

 

MQX is running on the board.

 

What am I missing? Why does it not fully wake up?

6 Replies

1,409 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

When customer want to use UART RxD Input Active edge interrupt to wake up the K20 from VLPS mode to RUM mode, customer need to enable related UART module status source interrupt vector.

You can check my test code attached, which is using TWR-K20D72M board UART1 to wake up K20 from VLPS mode.

The whole project customer could download from below link (low_power_demo):

http://cache.freescale.com/files/32bit/software/KINETIS_72MHz_SRC.zip

Wish it helps.

0 Kudos
Reply

1,409 Views
mjbcswitzerland
Specialist V

Hi All

I would like to extend this discussion since there are various requirements to exit from a (very) low power mode due to UART reception. The basic method of exit has been reported (using the edge interrupt on the RxD input in the UART concerned) but this seems only a part of the overall 'problem'.

1. When in the STOP mode (basic of various very low power modes) the UART is essentially frozen (clock disabled) and so if the UART is in the process of sending data (could also be using using DMA to send data that could require a certain time to complete) entering the low power mode would cause data transmission corruption

2. If the edge interrupt is generally enabled there will be a large number of interrupts to be handled (at up to 5x the speed of UART reception itself) so it seems to make sense to actually enable it "only" when needed to wake up from.

3. When enabling the edge interrupt and moving to the low power state a reception character that is "already" in progress could be corrupted. Eg. the start bit has just been detected, or maybe one or two reception bits are already in the input shift register.

These thoughts mean that the actual exit from low power mode is not necessarily the critical part but far more how to move to the low power state, ensuring that no UART transmission is still in progress and that there is no risk of reception loss when it is performed when reception activity may just be starting? Do these demos handle this or are they just showing that the low power mode exit works? Is there a complete analysis of the requirements and solution, or has anyone implemenented an application that is in the low power mode for as much of the time as possible although still handling all UART activity?

Regards

Mark

EDIT: Below is the sequence performed to enter the STOP mode. I am wondering whether some of the handshaking on the way delays entry to the mode if a module (like the UART) is presently "in-use/busy"? This would be very clever and allow the mode to be entered without risk. Tests will tell...

pastedImage_0.png

EDIT 2: OK. That was disproved in a few minutes - setting the stop mode while a UART byte is being transmitted freezes it in mid-flight... shame, back to the SW drawing board...;-)

1,409 Views
yosilevi
Contributor I

I see the same problem with k20.

Can anyone post an example how to configure a UART VLPS wakeup?

Thanks

0 Kudos
Reply

1,409 Views
Jeinstei
Contributor II

I was wondering if this is related to some of the Kinetis errata? They had quite a few issues with VLPS before.

0 Kudos
Reply

1,409 Views
david_g
Contributor I

Hi BrianM,

I have the same problem with K60, Did you solve it?

Thanks

0 Kudos
Reply

1,409 Views
BrianM
Contributor I

David,

No, I never did solve it. The requirement for this in the project is gone (for now). If the requirement returns, I will have to look into it again. If you find a solution, please post it here. I will do the same.

0 Kudos
Reply