Thanks to Kim, who attended me on the Nordic Power Profiler Kit II, my tests on power measurements got a lot easier. Now I have a little post about power measurements on the STM32L051 and maybe in a later stadium on the STM32L151 chip.
Nordic Power Profiler Kit II
This kit is made to do power measurements. You can apply voltage from the USB connectors or from your own PSU or battery. With the software you can easily change settings of the sample rate and sample time. The software runs on MacOS, Linux and Windows. You can also read 8 Digital channels.
You can see the average current and other parameters of the window and change the window size or select a window.
Its a great tool, and helps me to test power consumptions on the STM32L051, where my Minipill LoRa board is based on. It cost about € 76,- but at this moment, December 2021, out of stock. Here you can find more information on the kit:
I did some testing to get the bare minimal power absorption readings of my Minipill LoRa board V1.x. and previous test-boards. I used STM32CubeIDE and some example code to get the MCU in stop mode. This mode retains RAM and you would like that in case of uplink/downlink counters etc.
This is the core of the code. I do use the RTC to wakeup and put this in the while(1) loop. In first testing situations I got low power readings on the first sleep, but on the second sleep/stop cycle another 1.5 uA was added. I took a while but after good reading of the comments before the HAL_PWR_EnterSTOPMode function I had the solution.
// reset_RTC; //change time to 0:00:00 MX_RTC_Init(); USR_PowerDown_GPIO(); HAL_SuspendTick(); // very important to reduce power after first wakeup! __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); SystemClock_Config(); HAL_ResumeTick();
The results (VDD = 3.0V)
- With selecting MSI RC for main clock and LSI RC for RTC I got average 1.36 μA
- With selecting MSI RC for main clock and LSE (Ceramic Crystal) I got average 1.13 μA
- Selecting HSE Ceramic Crystal does not influence the power consumption in stop mode. That makes sense, all clocks are switched off.
- The Datasheet of the STM32L051 and AN4445, It should be down to 1.0 μA @ 3V or 0.82 μA @ 1.8V Stop mode + RTC + 20 KB RAM retention. I do not know how to get the extra 0.13 μA removed or is it a measurement error. All GPIO’s are switched off, and no peripherals are connected.
- Without the MCU connected to the kit I get a 0.1 μA “background noice”, the 0.13 uA is a measurement error.
In future design maybe I will add the RTC Ceramic Crystal, due to use of the RTC timer in low power situations.
In my project with the LoRa button I did not use the RTC clock. The current in stop-mode is down to 0.5 uA. This is almost the same as described in the AN4445 (415nA).
Comparison of three microcontrollers (L051, L151, F103)
To choose a controller for my next project I wanted to compare the power usage of these three controllers. I list them here:
STML051C8T6 Cortex-M0+ max 32MHz, 64k Flash, 8k RAM LSI RC 37 kHz = RTC MSI RC 2.097 Mhz HCLK 2.097 MHz Stop mode (With RTC) 1.47uA average STML151C8T6 Cortex-M3 max 32MHz, 64k Flash, 10k RAM LSI RC 37 kHz = RTC MSI RC 2.097 Mhz HCLK 2.097 MHz Stop mode (With RTC) 1.35 uA average STMF103CBT6 Cortex-M3 max 72MHz, 128k Flash, 20k RAM LSI RC 40 kHz = RTC HSI RC 8 Mhz HCLK 2 MHz Stop mode (with RTC) 11.74 uA average