STM32L4A6 Exiting Stop Mode 1 using UART
Hi,
Using references from
1) STML496 UART Wake up from Stop Example - https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Projects/NUCLEO-L496ZG/Examples/UART/UART_WakeUpFromStop/Src/main.c#L78
2) STM Getting started with PWR Guide - https://wiki.st.com/stm32mcu/wiki/Getting_started_with_PWR#Stop0.2C_Stop1.2C_and_Stop2_modes
I have the following code that tries to wake up from STOP1 via UART.
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_I2C1_Init();
MX_UART5_Init();
/* USER CODE BEGIN 2 */
HAL_PWREx_EnableLowPowerRunMode();
/* USER CODE END 2 */
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
/* make sure that no UART transfer is on-going */
while(__HAL_UART_GET_FLAG(&huart5, UART_FLAG_BUSY) == SET);
/* make sure that UART is ready to receive
* (test carried out again later in HAL_UARTEx_StopModeWakeUpSourceConfig) */
while(__HAL_UART_GET_FLAG(&huart5, UART_FLAG_REACK) == RESET);
WakeUpSelection.WakeUpEvent = UART_WAKEUP_ON_READDATA_NONEMPTY;
if (HAL_UARTEx_StopModeWakeUpSourceConfig(&huart5, WakeUpSelection)!= HAL_OK)
{
Error_Handler();
}
/* Enable the UART Wake UP from STOP1 mode Interrupt */
__HAL_UART_ENABLE_IT(&huart5, UART_IT_WUF);
/* enable MCU wake-up by UART */
HAL_UARTEx_EnableStopMode(&huart5);
/* enter STOP1 mode */
DEBUG_Transmit((uint8_t *)"Entering stop mode\r\n", 20);
HAL_SuspendTick();
HAL_PWREx_EnterSTOP1Mode(PWR_SLEEPENTRY_WFI);
HAL_ResumeTick();
DEBUG_Transmit((uint8_t *)"success\r\n", 9);
/* at that point, MCU has been awoken: the LED has been turned back on */
SystemClock_Config();
/* Wake Up based on RXNE flag successful */
HAL_UARTEx_DisableStopMode(&huart5);
However, the interrupt does not seem to trigger and i am always stuck in stop mode.
I have also attached my clock configuration as follows.

Appreciate any advise on what I am doing wrong. Thank you.
