Skip to main content
Visitor II
July 20, 2023
Question

STM32L0 - STM32 Sequencer Issue - UART Interrupt in low power/idle mode

  • July 20, 2023
  • 4 replies
  • 2015 views

I am using a UART interrupt to receive a character at a time to fill up a buffer. I am attempting to put the device in low power mode using the UTIL_SEQ_Idle function inside of UTIL_SEQ_Run(UTIL_SEQ_DEFAULT). When the idle function is commented out, the UART interrupt successfully fills in the buffer, however when the idle function is uncommented it never properly fills the buffer. Is there a specific way to implement the UART interrupt to function with the sequencer?

    This topic has been closed for replies.

    4 replies

    Visitor II
    July 26, 2023

    I have tried using the HAL Functions provided for STOP mode and am still not able to get the UART to wake up from sleep. I have experimented with using LPUART as well. Below is how I have attempted to implement the low power/wake up functionality.

    main.c

    HAL_SuspendTick();
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

     

    LPUART Interrupt Handler

     HAL_UART_IRQHandler(&lpuart1);
      /* USER CODE BEGIN USART2_IRQn 1 */
      if(lpuart1.RxState == HAL_UART_STATE_READY && __HAL_UART_GET_FLAG(&lpuart1, UART_FLAG_WUF) != RESET){
      // Received data
      __HAL_UART_CLEAR_FLAG(&lpuart1, UART_FLAG_WUF);
      HAL_ResumeTick();
      SystemClock_Config(); // You might need to reconfigure the system clock after waking up
    Graduate II
    July 26, 2023
    Visitor II
    August 1, 2023

    Are there any workarounds available for achieving low power mode? Using the HAL functions brings me to 5mA. The documentation I found mention that the current draw should be in uA.

    Graduate II
    August 1, 2023

    I gave you two links, which show and explain many low-power mode related issues and solutions. Have you fixed all of those? The bugs will not go away just because you pretend they are not there...

    ST Employee
    August 16, 2023

    Hi @syed.naqvi ,
    For reference, you could find a code example, available on STM32L0 platform, that illustrates a board entering Low power mode, and then being wake up by an incoming char.
    Code example is available on github here.
    Example could be compiled in 2 different ways : 1 for the board that enters Stop Mode, and 1 for the board that sends characters for board wake up. Please have a look at possible configurations in UART/LPUART according to the type of event that will wake up the board (RXNE flag, Start bit, 4b or 7b address).
    Hope this could help you.
    Regards