Low power consumption test of STM32L152

Publisher:冰雪勇士Latest update time:2016-12-27 Source: eefocusKeywords:STM32L152 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This article will verify the low power consumption current of STM32L32 in stop mode.


The STM32L152RE chip introduction on the ST official website clearly states that this chip can reach 560nA in stop mode, nanoamperes! And it can also support 16 external interrupt wake-up.

It’s really that powerful! Let’s verify it below.

The NUCLEO-L152 board is used for verification, and CubeMx is used to generate engineering code.

Select the STM32L152RE chip in CubeMx and set the pinout as follows:

As shown in the figure above, simply set PC13, PB9, PB5, PB4, PD2, PA12, PB15, and PB1 as external interrupts.

In order to achieve the lowest power consumption, the clock tree uses the chip's internal clock HSI:


Under configuration, set all GPIO to pull-down, PC13 is a button on the NUCLEO board, set it to pull-up.

Generate code. The main function is slightly modified:


  1. int main(void)  

  2. {  

  3.   

  4.   /* USER CODE BEGIN 1 */  

  5.   

  6.   /* USER CODE END 1 */  

  7.   

  8.   /* MCU Configuration----------------------------------------------------------*/  

  9.   

  10.   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */  

  11.   HAL_Init();  

  12.   

  13.   /* Configure the system clock */  

  14.   SystemClock_Config();  

  15.   

  16.   /* Initialize all configured peripherals */  

  17.   MX_GPIO_Init();  

  18.   

  19.   /* USER CODE BEGIN 2 */  

  20.   HAL_PWREx_EnableUltraLowPower();  

  21.   HAL_PWREx_EnableFastWakeUp();  

  22.   /* USER CODE END 2 */  

  23.   

  24.   /* Infinite loop */  

  25.   /* USER CODE BEGIN WHILE */  

  26.   while (1)  

  27.   {  

  28.   /* USER CODE END WHILE */  

  29.   

  30.   /* USER CODE BEGIN 3 */  

  31.     HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);  

  32.   

  33.     /* Configures system clock after wake-up from STOP: enable HSI, PLL and select 

  34.       PLL as system clock source (HSI and PLL are disabled automatically in STOP mode) */  

  35.     SystemClockConfig_STOP();  

  36.     HAL_Delay(200);  

  37.   }  

  38.   /* USER CODE END 3 */  

  39.   

  40. }  

The SystemClockConfig_STOP function is configured as follows:


  1. static void SystemClockConfig_STOP(void)  

  2. {  

  3.   RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};  

  4.   RCC_OscInitTypeDef RCC_OscInitStruct = {0};  

  5.   

  6.   /* Enable Power Control clock */  

  7.   __HAL_RCC_PWR_CLK_ENABLE();  

  8.   

  9.   /* The voltage scaling allows optimizing the power consumption when the device is 

  10.      clocked below the maximum system frequency, to update the voltage scaling value 

  11.      regarding system frequency refer to product datasheet.  */  

  12.   __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);  

  13.   

  14.   /* Poll VOSF bit of in PWR_CSR. Wait until it is reset to 0 */  

  15.   while (__HAL_PWR_GET_FLAG(PWR_FLAG_VOS) != RESET) {};  

  16.   

  17.   /* Get the Oscillators configuration according to the internal RCC registers */  

  18.   HAL_RCC_GetOscConfig(&RCC_OscInitStruct);  

  19.   

  20.   /* After wake-up from STOP reconfigure the system clock: Enable HSI and PLL */  

  21.   RCC_OscInitStruct.OscillatorType      = RCC_OSCILLATORTYPE_HSI;  

  22.   RCC_OscInitStruct.HSEState            = RCC_HSE_OFF;  

  23.   RCC_OscInitStruct.HSIState            = RCC_HSI_ON;  

  24.   RCC_OscInitStruct.PLL.PLLState        = RCC_PLL_ON;  

  25.   RCC_OscInitStruct.PLL.PLLSource       = RCC_PLLSOURCE_HSI;  

  26.   RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;  

  27.   RCC_OscInitStruct.PLL.PLLMUL          = RCC_PLL_MUL6;  

  28.   RCC_OscInitStruct.PLL.PLLDIV          = RCC_PLL_DIV3;  

  29.   if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)  

  30.   {  

  31.     Error_Handler();  

  32.   }  

  33.   

  34.   /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 

  35.      clocks dividers */  

  36.   RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;  

  37.   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;  

  38.   if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)  

  39.   {  

  40.     Error_Handler();  

  41.   }  

  42. }  


After compiling and burning, use the ammeter to test:

0.3uA! It seems that what he said is true, 300nA, press the button and find that the current becomes larger, as shown below:

The current becomes 11mA, which is the working current, indicating that the external interrupt is effective.



The STM32L152 is really good in terms of low power consumption! The measured current in stop mode is 300nA, which is lower than the 560nA shown in the manual. It seems that ST is still relatively conservative.


Keywords:STM32L152 Reference address:Low power consumption test of STM32L152

Previous article:How to use CubeMx to create a file system project based on SD card
Next article:STM32L152 IAP transplantation notes

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号