lpuart wakeup vlps

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

lpuart wakeup vlps

1,272 Views
mjg8t
Contributor IV


Hi.  It is unclear to me as to whether the lpuart can be used to wake-up from vlps mode.  I am using the MK22f512xxx MCU and in section 48.1.2.1 it states that "the LPUART will remain functional during Stop mode.  The LPUART can generate an interrupt to casue a wakeup from stop mode."

But, I thought that wakeup's must occur through LLWU sources (I don't think the LLWU has LPUART as a wake-up source). 

Can someone explain how I can enable the LPUART interrupt to wake from VLPS mode?

5 Replies

734 Views
mjbcswitzerland
Specialist V

Hi

See Using Kinetis Low Power Stop Modes with unrestricted UART operation - a report for details about waking from VLPS mode on standard UARTs (using asynch interrupt on RxD edge).

Since the LPUART can continue to be clocked from certain clock sources in VLPS it can also wake up due to any synchronous interrupts too (like Rx data ready), which means that the core will exit from VLPS whenever there is a LPUART interrupt and doesn't need to be woken by the LLWU a source (from VLPS).

Regards

Mark

0 Kudos

734 Views
evgenyerlihman
Contributor IV

Hey Mark,

Do you happen to know if I can use LPUART to wake up the system even if i clock it using a disabled clock during VLPS?

Thanks,

Evgeny 

0 Kudos

734 Views
mjbcswitzerland
Specialist V

Hi Evgeny

The LPUART also has an "asynchronous" edge triggered interrupt on its Rx line that can be used to wake from VLPS when the LPUART is not clocked.

Here is reference code from the uTasker project which is used to enable this when moving to low power mode:

    if (IS_POWERED_UP(5, SIM_SCGC5_LPUART0))  {                  // if LPUART0 is enabled
        LPUART0_STAT |= LPUART_STAT_RXEDGIF;                     // clear edge flag
        LPUART0_BAUD |= LPUART_BAUD_RXEDGIE;                     // enable wakeup on RxD falling edge
        if ((LPUART0_STAT & LPUART_STAT_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
        }
    }

Regards

Mark

735 Views
evgenyerlihman
Contributor IV

Hey Mark,

From your experience, should i disable LPUART_BAUD_RXEDGIE when the processor is awake in order to not receive a large amount of false interrupts, same as with regular UART?

Thanks,

Evgeny

0 Kudos

735 Views
mjbcswitzerland
Specialist V

Evgeny

Yes, the interrupt needs to be disabled as soon as the sleep mode has been exited from (before enabling global interrupts again). In the uTasker low power mode this is done with:

    if (IS_POWERED_UP(5, SIM_SCGC5_LPUART0) != 0) {                      // if LPUART0 is enabled
        LPUART0_BAUD &= ~LPUART_BAUD_RXEDGIE;                            // disable edge interrupt on RxD since we never want to handle the actual interrupt (used just for waking)
    }

Regards

Mark