2024-04-08 10:27 AM
Hello everyone,
I need to get some information about the power consumption of the STM32 Nucleo-64 with STM32F401RE MCU.
The board is powered from the computer's USB port.
The board has a IDD jumper (JP6) for MCU current measurement so I attached a Parkside multimeter to get the current.
I created a project in which the main while loop is empty and all peripherals are disabled. In this case, the current shown on the display of the multimeter is fixed.
If I modify the project and I use the timer interrupts to acquire data from the sensors, the current shown is fixed.
If I create another project without interrupts but acquiring data from the sensors in the main while loop, the current shown is fixed. If I add some "printf" (using USART2 and PuTTY) to show these data, the current is variable.
If I create a project in which I execute some inferences of a neural network, the current is variable.
Why do I have a fixed value of the current on the display in some cases and a variable value in other cases?
Could anyone please help me?
Solved! Go to Solution.
2024-04-08 11:08 AM
the trouble with a multimeter is you have no control over when it samples, or how it "averages" - so you will get this fluctuating reading.
An actual mechanical meter would probably be better for an "average" reading...
2024-04-08 10:40 AM
@thetectivestm wrote:a Parkside multimeter
You mean something like this:
You won't get a meaningful measurement of dynamic current consumption with a multimeter (any multimeter) - you will need something like the X-NUCLEO-LPM01A or STLINK-V3PWR (and associated software) to get a meaningful view of the current with time
https://www.st.com/en/evaluation-tools/x-nucleo-lpm01a.html
https://www.st.com/en/development-tools/stlink-v3pwr.html
2024-04-08 10:53 AM
Hi,
as long as you let the cpu (more or less) doing some program (loops or whatever) at a constant clock,
it will draw about constant current for this.
But if you use some ports (uart or LED etc. ...other) with lines, that need some current to drive, you see this added current - or not if not driving an output.
You can check this a bit in Cube , with the "tools" , to see some average, if using peripherals, or not :
What you "pull" extra current out of some pins you switch, you have to add yourself.
2024-04-08 10:57 AM
Hi @Andrew Neil .
I just want an average value of the current consumption, not necessarily the instantaneous value.
2024-04-08 11:08 AM
the trouble with a multimeter is you have no control over when it samples, or how it "averages" - so you will get this fluctuating reading.
An actual mechanical meter would probably be better for an "average" reading...
2024-04-08 12:00 PM
Hi @AScha.3 .
If I create a project without interrupts but acquiring data from the sensors in the main while loop, the current shown is fixed at 1.91 mA. If I add some "printf" (using USART2 and PuTTY) to show these data, the current shown on the display of the multimeter is variable up to 1.71 mA. Shouldn't it have a higher value?
Moreover, when I execute the inference of the NN, I don't use LEDs or any peripherals (adc, timers, etc.). I just use a default input tensor and run the inference with the "ai_mynetwork_run" function.
---
About the PCC (Power Consumption Calculator), it's not useful for me because I use a HCLK frequency of 4 MHz (from SYSCLK of 16 MHz with HSI source mux) and in the step parameters of the tool you must use a minimum frequency of 30 MHz. Moreover, all the run-mode current consumption measurements given in that tool are performed with a reduced code that gives a consumption equivalent to CoreMark code; that values are higher than the values shown on the multimeter.
2024-04-08 12:34 PM
At so clock and low power, you will see "everything" - e.g the uart line needs 0.2mA when idle and 0 when active...
And, as Andrew mentioned, a DMM is not showing real time values, but just some "average" at 1/3 sec timing or so.
And whats so important, the cpu needs 1.9 or 1.7 mA ? If you want really low power and set it to sleep mode, then consuming 1 mA instead of 12 uA would be something to think about - but just 20% deviation --- come on.
2024-04-09 01:08 AM
@thetectivestm wrote:I use a HCLK frequency of 4 MHz
Why so slow?
2024-04-09 06:23 AM
Because my application has to return an output value each 2 seconds **. Using a frequency of 4 MHz, an inference of the neural network lasts about 1200 milliseconds. It's a lot of time; if I use a frequency of 84 MHz the inference lasts only 50 ms. But in my application I want to reduce the power consumption.
** Using a timer interrupt at 32 Hz, I collect data for 2 seconds (I need 64 values). Then, these values are given in input to the NN. In the main while loop I run the inference when I collected all the 64 values.
The inference (in the main while loop) is performed during the time intervals in which the code in the callback (HAL_TIM_PeriodElapsedCallback) is not executed. When a timer interrupt gets triggered, the main loop is suspended and it resume from that point.
2024-04-09 06:39 AM - edited 2024-04-09 06:41 AM
@thetectivestm wrote:in my application I want to reduce the power consumption.
You'll probably do better at that by having the processor run as fast as possible - thus getting the work done as quickly as possible - and then sleep for the remaining time ...
@thetectivestm wrote:if I use a frequency of 84 MHz the inference lasts only 50 ms. .
So your processor could be asleep for 1.95s, and only running for the 50ms.
And, if minimising power consumption is truly key, then you really do need something like the X-NUCLEO-LPM01A or STLINK-V3PWR to be able to see exactly what's going on