K22: Example for LPUART that can work in VLPS mode

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

K22: Example for LPUART that can work in VLPS mode

1,581 Views
guest253456
Contributor II

I'm trying to get LPUART to work while CPU is in VLPS mode. I'm using the following code

 

        CLOCK_EnableClock(kCLOCK_PortD);
        PORT_SetPinMux(PORTD, 2U, kPORT_MuxAlt6);
        PORT_SetPinMux(PORTD, 3U, kPORT_MuxAlt6);
        CLOCK_SetLpuartClock(2U);

        oscer_config_t oscerConfig;
        oscerConfig.enableMode = kOSC_ErClkEnable | kOSC_ErClkEnableInStop;
        oscerConfig.erclkDiv = 0;

        OSC_SetExtRefClkConfig(OSC0, &oscerConfig);

        lpuart_config_t config;
        LPUART_GetDefaultConfig(&config);
        config.baudRate_Bps = 115200;
        config.enableTx = true;
        config.enableRx = true;

        LPUART_Init(LPUART0, &config, CLOCK_GetFreq(kCLOCK_Osc0ErClk));
        LPUART_EnableInterrupts(LPUART0, kLPUART_RxDataRegFullInterruptEnable);
        EnableIRQ(LPUART0_IRQn);

 

This only works while by debugger is connected and CPU is prevented from going to stop mode. If i enter stop mode, its not getting interrupts anymore. Are there any code examples that i can refer to?

Labels (1)
0 Kudos
Reply
4 Replies

1,534 Views
mjbcswitzerland
Specialist V
0 Kudos
Reply

1,546 Views
guest253456
Contributor II

>

oscer_config_t oscerConfig;
oscerConfig.enableMode = kOSC_ErClkEnable | kOSC_ErClkEnableInStop;
oscerConfig.erclkDiv = 0;

This is enough?

0 Kudos
Reply

1,553 Views
bobpaddock
Senior Contributor III
OSC_SetExtRefClkConfig(OSC0, &oscerConfig);

Is the external Osc configured to work in the low power mode?

0 Kudos
Reply

1,539 Views
guest253456
Contributor II

Which all power modes can the LPUART work? I was trying with VLPS which does not work, nor with Stop mode with "kSMC_PartialStop". It only works with "kSMC_PartialStop1" but by then the power consumption is very high(20mW vs <4mW)

0 Kudos
Reply