performancestm32interruptstm32cubeideusart

STM32 wake up stop mode for usart


I am using STM32L0 series. I take the mcu out of stop mode with Usart and Gpio interrupt. However, in stop mode, the device draws 40 uA current. I am trying to make it 1 uA. I disabled PVD. It uses HSI as clock and 4Mhz. I also set the RCC Voltage scale to 3. But no matter what I did, it didn't work. please help me.

  HAL_PWR_DisablePVD();

  HAL_UARTEx_ReceiveToIdle_IT(&huart2,RxBuffer,10);
  //HAL_UART_Receive_IT(&huart2,Rx_data,1);
  //HAL_UART_Receive_IT(&huart2,RxBuffer,5);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
     str = "Going into SLEEP MODE in 5 seconds\r\n";
                  HAL_UART_Transmit(&huart2, (uint8_t *)str, strlen (str), HAL_MAX_DELAY);
                WakeUpEvent.WakeUpEvent=UART_WAKEUP_ON_STARTBIT;

                HAL_UARTEx_StopModeWakeUpSourceConfig(&huart2,WakeUpEvent);
                  HAL_UARTEx_EnableStopMode(&huart2);
                 HAL_SuspendTick();
                 HAL_PWREx_EnableUltraLowPower();
                HAL_PWREx_EnableFastWakeUp();
                HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
              HAL_Delay(5000);

Solution

  • Try to mesure the µC consuption in stop mode after having unpluged and replug your board. I had a similar issue having a consumption about 135µA in stop mode. See the post below: https://community.st.com/t5/stm32-mcus-products/what-could-be-consuming-power-in-stop-mode-after-flashing-an/td-p/413007