I have recently been looking at the power_mode_switch_rtos example in the RT1050 SDK. The following code will be executed before entering and after exiting low power mode:
void APP_PowerPreSwitchHook(lpm_power_mode_t targetMode)
{
if (targetMode == LPM_PowerModeSNVS)
{
PRINTF("Now shutting down the system...\r\n");
}
if (targetMode > LPM_PowerModeRunEnd)
{
/* Wait for debug console output finished. */
while (!(kLPUART_TransmissionCompleteFlag & LPUART_GetStatusFlags((LPUART_Type *)BOARD_DEBUG_UART_BASEADDR)))
{
}
DbgConsole_Deinit();
/*
* Set pin for current leakage.
* Debug console RX pin: Set pinmux to GPIO input.
* Debug console TX pin: Don't need to change.
*/
ConfigUartRxPinToGpio();
}
}
void APP_PowerPostSwitchHook(lpm_power_mode_t targetMode)
{
if (targetMode > LPM_PowerModeRunEnd)
{
/*
* Debug console RX pin is set to GPIO input, need to re-configure pinmux.
* Debug console TX pin: Don't need to change.
*/
ReConfigUartRxPin();
BOARD_InitDebugConsole();
}
else
{
/* update current run mode */
APP_SetRunMode(targetMode);
}
}
What is the purpose of reconfiguring UART1 here? I checked the schematic of the RT1050 Evaluation Kit, and UART1 is not connected elsewhere. Why do we need to reconfigure the RX pin here?
As the low power mode desconfigures UART it needs to be re-enabled.
Best regards,
Omar
This document details how the power mode behaves on all modules. How to use i.MX RT Low Power Feature (nxp.com) It may depend on the module configuration before entering the power mode or if in a specific power mode it is completely shutdown.
Best regards,
Omar