cancel
Showing results for 
Search instead for 
Did you mean: 

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

syed.naqvi
Associate II

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?

5 REPLIES 5
syed.naqvi
Associate II

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
Piranha
Chief II
syed.naqvi
Associate II

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.

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...

Guenael Cadier
ST Employee

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