Hello, everyone
I want to use lpuart to waked up RT1011 from low power idle mode, but I don't make sucessful. When Soc enter low power idle, and it cann't respond the Interrupt of lpuart and exit low power idle. Please ask me how to do.
This is my code.
void lpuart_init(void)
{
/* Configure UART divider to default */
CLOCK_SetMux(kCLOCK_UartMux, 1); /* Set UART source to OSC 24M */
CLOCK_SetDiv(kCLOCK_UartDiv, 0); /* Set UART divider to 1 */
lpuart_config_t config;
/*
* config.baudRate_Bps = 115200U;
* config.parityMode = kLPUART_ParityDisabled;
* config.stopBitCount = kLPUART_OneStopBit;
* config.txFifoWatermark = 0;
* config.rxFifoWatermark = 0;
* config.enableTx = false;
* config.enableRx = false;
*/
LPUART_GetDefaultConfig(&config);
config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
config.enableTx = true;
config.enableRx = true;
LPUART_Init(APP_WAKEUP_LPUART_BASE, &config, APP_WAKEUP_LPUART_CLK_FREQ);
/* Enable RX interrupt. */
LPUART_EnableInterrupts(APP_WAKEUP_LPUART_BASE, kLPUART_RxDataRegFullInterruptEnable);
EnableIRQ(APP_WAKEUP_LPUART_IRQn);
NVIC_EnableIRQ(APP_WAKEUP_LPUART_IRQn);
LPM_EnableWakeupSource(APP_WAKEUP_LPUART_IRQn);
}
void lowpoweridle(void)
{
LPM_PreEnterWaitMode();
LPM_EnterLowPowerIdle();
LPM_ExitLowPowerIdle();
LPM_PostExitWaitMode();
}
void APP_WAKEUP_LPUART_IRQn_HANDLER(void)
{
if ((kLPUART_RxDataRegFullFlag)&LPUART_GetStatusFlags(APP_WAKEUP_LPUART_BASE))
{
recv_data = LPUART_ReadByte(APP_WAKEUP_LPUART_BASE);
PRINTF("%c", recv_data);
LPM_DisableWakeupSource(APP_WAKEUP_LPUART_IRQn);
}
}
I add the function which data match wake up MCU , but it does not work.
this is my code.
APP_WAKEUP_LPUART_BASE->CTRL &= ~(1 << LPUART_CTRL_DOZEEN_SHIFT);
APP_WAKEUP_LPUART_BASE->CTRL |= LPUART_CTRL_RWU(1)|LPUART_CTRL_WAKE(1);
APP_WAKEUP_LPUART_BASE->BAUD |= LPUART_BAUD_MATCFG(3)|LPUART_BAUD_MAEN1(1)|LPUART_BAUD_MAEN2(1);
APP_WAKEUP_LPUART_BASE->MATCH = LPUART_MATCH_MA1(0x81)|LPUART_MATCH_MA2(0xAA);
Hi,
Uart clock source is set to pll3_80m when initialization. When entering into low power idle, pll3 is closed. You should switch to osc clock.
Regards,
Jing
Hi, Pan
According to RM, the lpuart should work and remain enabled in low power idle . And I have switched to osc clock and didn't close it. . However, when it enter low power idle or system idle, the uart didn't work. Why?
Hi,
How do you set the CTRL[DOZEEN] bit? In 40.2.2 it says the LPUART will remain functional during Stop mode, provided the CTRL[DOZEEN] bit is clear and the asynchronous transmit and receive clock remain enabled. The
LPUART can generate an interrupt or DMA request to cause a wakeup from Stop mode.
Regards,
Jing
Hi, Pan
I change the CTRL[DOZEEN] bit to zero. This is reflected in my code.
Hello, Pan
I have switched to osc clock in my code. However, when it enter low power idle or system idle, the uart didn't work.