cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L031 Ultra low power consumption

LPetr.1
Senior

Hello. I have purchased STM32L031 nucleo development board and wanted to experiment with it. I plan to work on a LoRa project that sends sensor information. The device is battery powered hence ultra low power consumption is a top priority.

https://www.st.com/en/evaluation-tools/nucleo-l031k6.html

To test the power consumption I have also purchased Power Profiler Kit II from Nordic:

https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2

 

According to the STM32L031 User manual (https://www.st.com/resource/en/user_manual/um1956-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf), I have connected Power Profiler Kit to JP1 (IDD) to measure the current consumption. 

 

The test code I am running:

 

int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* 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_USART2_UART_Init();
  MX_RTC_Init();
  /* USER CODE BEGIN 2 */


  /* Check and handle if the system was resumed from StandBy mode */
  if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
  {
    /* Clear Standby flag */
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
  }
  /* Disable Wakeup Counter */
  HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
/* Clear all related wakeup flags */
 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

int counter = 0;

  /* USER CODE END 2 */

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

    /* USER CODE BEGIN 3 */

  counter++;
  HAL_Delay(1000);
  printf("toggle LED \n");
  if(counter >= 5){
  HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0xFFFF, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
  HAL_PWR_EnterSTANDBYMode();
  }


  }
  /* USER CODE END 3 */
}

 

 

 

I have run the Power Profiler for 5 minutes and the results are as following:

LPetr1_0-1694780613542.png

Sleep current consumption:

LPetr1_1-1694780647322.png

 

Active mode power consumption:

LPetr1_2-1694780666109.png

I can see that the power consumption in Standby mode is about 2uA. The power when the device wakes up is about 5mA. 

My question:

Is it possible to optimize it further? Can I reduce the active mode current consumption? This is just testing code and it does not do anything except incrementing the counter, but my actual application will transmit the LoRa message and enter standby. The LoRa modules works with SPI interface so I must ensure SPI works in active mode.

Any suggestions on how to further optimize the power consumption is very much appreciated!

 

 

 

 

 

 

6 REPLIES 6
TDK
Guru

Generally, reducing the clock rate as much as possible is going to be the best way to reduce power consumption.

If you feel a post has answered your question, please click "Accept as Solution".
LCE
Principal

I don't know that STM32, but with 2 µA in standby, it looks as though you did everything right concerning unused GPIOs and peripherals.

Just some general (obvious, sorry) advice:

- keep the CPU clock as low as possible
- keep the awake time as short as possible
- keep the sleep intervals as long as possible

LPetr.1
Senior

Thanks for the replies. Sure I will try reducing the CPU clock a little and repeat the tests.

Additionally, I was thinking that instead of running the CPU in normal mode during the awake time, perhaps I can run it in some other mode?

LPetr1_0-1694785925680.png 

 

Can I use Sleep mode (not standby) or low-power run mode and still use SPI/I2C interfaces?

I am happy with the standby current consumption but I would like to reduce the awake current consumption (5mA)

LCE
Principal

Even if that's possible (I don't know), it's a trade between "some-slow-mode-that-takes-longer" vs. a short regular CPU use.
So just try...

LPetr.1
Senior

Will do and report back next week.

Anyways, I will still be hoping to receive any other advice regarding power saving for STM32L031 or STM32 in general 🙂 

Andrew Larkin
Associate III

How often are you planning to wake up and send a LoRa packet?

2uA in STOP2 is about right as is 5mA in run mode. Your dominant power user will be the radio Tx, so on-air time and Tx power will drive your battery life.

For example, sending a packet every 5 minutes, if your Tx current is 100mA with a duration of 42ms, and you have two receive windows (for LoRaWAN - ignore otherwise) that use 5mA for 140ms combined, and an idle current of 2uA, you are looking at near 10 years battery life from a CR123A cell.
With LoRa, you can drop the Rx frames and if you also drop the Tx power to 50mA, the battery life is something around 19 years.

Build yourself a bit of a spreadsheet and play with the numbers - there may be better power optimisation opportunities to chase.