Skip to main content
Visitor II
July 6, 2024
Question

STM32H7xx USART3 can't wake up from STOP mode

  • July 6, 2024
  • 1 reply
  • 668 views

Our product uses a STM32H7xx chip, integrate freeRTOS. We want our product can go into STOP mode to save power, and can be waked up from STOP by USART3 receiving data.

Below is some related code, but it does not work, our product can't be waked up by USART data. 

 

MX_USART3_UART_Init is generated by CubeMx, we just add a few code at the beginning and end to config WUS clock and IT.

void MX_USART3_UART_Init(void)
{
/* USER CODE BEGIN USART3_Init 0 */
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI);
/* USER CODE END USART3_Init 0 */

/* USER CODE BEGIN USART3_Init 1 */

/* USER CODE END USART3_Init 1 */
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_2) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_2) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_EnableFifoMode(&huart3) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART3_Init 2 */
__HAL_UART_ENABLE_IT(&huart3, UART_IT_RXNE);
__HAL_UART_ENABLE_IT(&huart3, UART_IT_WUF);
/* USER CODE END USART3_Init 2 */
}

 

Below is our code to go into STOP mode and wake up in one freeRTOS task.

HAL_SuspendTick();
HAL_UARTEx_EnableStopMode(&huart3);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

HAL_ResumeTick();
SystemClock_Config();

    This topic has been closed for replies.

    1 reply

    ST Employee
    July 15, 2024