How to measure STM32 Nucleo current in Run and Sleep modes

How much does the supply current change when an STM32 stops executing instructions between interrupts? We ran one program on a real STM32 Nucleo-WB55RG in the LabsLand remote lab, using a board hosted at DigiKey. The program alternated 12 seconds of Run and 12 seconds of Sleep. The board-current median was 11.1 mA in the Run windows and 8.6 mA in the Sleep windows.

Two current traces over time. Board current drops in each Sleep interval. Peripheral current stays near 11 mA.
Current recorded on a physical STM32 Nucleo-WB55RG. Shading marks the intervals used for the medians.

Repeat the test on the board

  1. Open the STM32 Nucleo C/C++ lab with lab access. Start from its default project and make a copy if you want to keep your existing work.
  2. In main.c, put the following if inside the generated while (1) loop, in the USER CODE BEGIN 3 block. Keep the default initialization and leave the switches and peripherals alone during the measurement.
/* USER CODE BEGIN 3 */
if ((HAL_GetTick() / 12000UL) & 1UL) {
    HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON,
                           PWR_SLEEPENTRY_WFI);
}
/* USER CODE END 3 */
  1. Choose the Standard interface, compile and upload to the board. In Current Power Meter, select Board current and let at least three full cycles elapse. Use Peripherals current to check what happened on the second channel.
  2. Compare the middle of each plateau. Skip the first cycle and any samples near a transition. Use the median for each window.

What the meter reported

Time on meter CPU mode Board Peripherals
29–38 s Run 11.1 mA 10.9 mA
41–50 s Sleep 8.6 mA 10.9 mA
53–62 s Run 11.1 mA 10.9 mA
65–74 s Sleep 8.6 mA 10.9 mA

Medians from one session, rounded to the nearest 0.1 mA. The meter has its own time origin, so its timestamps need not align with the program’s 12-second boundaries.

SysTick remains enabled. In the Sleep phase the CPU waits for an interrupt and returns to Sleep on the next pass. The clocks and peripherals can still consume current. The Board current trace is the station’s board-supply measurement. It does not isolate the MCU’s VDD rail, and the separate Peripherals current trace helps show what changed elsewhere in this setup. Treat the values as an observation of this setup. For an MCU-only measurement, follow the current-measurement section of the ST Nucleo board manual.

For a class: Ask students to predict which channel should change, then explain the difference between the traces. You can compare the STM32 access options or see the Prism4 equipment co-developed with DigiKey for deploying a remote station.

Luis

Luis Rodríguez Gil is CTO of LabsLand and one of its co-founders. He has been taking part for over 8 years in remote labs research. Now he works in LabsLand to ensure that this innovative technology reaches its full potential for education.