cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO 144 board power consumption depends on the link order of the compiled objects in your STM32CubeL4/Projects/NUCLEO-L496ZG/Examples/PWR/PWR_ModesSelection example

User1655833706281357277
Associate III

When running your PWR_ModeSelection example on a NUCLEO-L496ZG board the current consumption in run range 2, 24MHz depends on the order objects are linked in the executable. When the object_list is in this order:

hal/stm32l4xx_hal.o

hal/stm32l4xx_hal_cortex.o

hal/stm32l4xx_hal_dma.o

hal/stm32l4xx_hal_gpio.o

hal/stm32l4xx_hal_pwr.o

hal/stm32l4xx_hal_pwr_ex.o

hal/stm32l4xx_hal_rcc.o

hal/stm32l4xx_hal_rcc_ex.o

hal/stm32l4xx_hal_rtc.o

hal/stm32l4xx_hal_rtc_ex.o

hal/stm32l4xx_hal_uart.o

hal/stm32l4xx_hal_uart_ex.o

hal/stm32l4xx_nucleo.o

hal/system_stm32l4xx.o

lprun_test.o

lpsleep_test.o

run_range1_test.o

run_range2_test.o

shutdown_test.o

sleep_range1_test.o

sleep_range2_test.o

standby_rtc_sram2_test.o

standby_rtc_test.o

standby_test.o

stm32l4xx_hal_msp.o

stm32l4xx_it.o

stop1_mroff_rtc_test.o

stop1_mroff_test.o

stop2_rtc_test.o

stop2_test.o

syscalls.o

startup_stm32l496xx.o

main.o

The average current consumption as measured by a X-NUCLEO-PM01A is 3305uA. When the default object order in the example is used:

hal/stm32l4xx_nucleo.o

hal/system_stm32l4xx.o

hal/stm32l4xx_hal.o

hal/stm32l4xx_hal_cortex.o

hal/stm32l4xx_hal_dma.o

hal/stm32l4xx_hal_gpio.o

hal/stm32l4xx_hal_pwr.o

hal/stm32l4xx_hal_pwr_ex.o

hal/stm32l4xx_hal_rcc.o

hal/stm32l4xx_hal_rcc_ex.o

hal/stm32l4xx_hal_rtc.o

hal/stm32l4xx_hal_rtc_ex.o

hal/stm32l4xx_hal_uart.o

hal/stm32l4xx_hal_uart_ex.o

startup_stm32l496xx.o

syscalls.o

main.o

stm32l4xx_hal_msp.o

stm32l4xx_it.o

lprun_test.o

lpsleep_test.o

run_range1_test.o

run_range2_test.o

shutdown_test.o

sleep_range1_test.o

sleep_range2_test.o

standby_rtc_sram2_test.o

standby_rtc_test.o

standby_test.o

stop1_mroff_rtc_test.o

stop1_mroff_test.o

stop2_rtc_test.o

stop2_test.o

The average current consumption in the same mode drops to 2407uA.

What in the world is going on? The position of startup_stm32l496xx.o in the link order seems to be making the difference. I've noticed that your examples tend to put the link order in HAL files, start asm file, application files. Why, and what could be going on here? I've verified that the CPU clock frequency is the same in both cases. The only difference in the map files appears to be the location of Reset_Handler.

Thank you.

--b

11 REPLIES 11
Kamil Duljas
Senior III

It's interesting. I don't know but it is very curious 🧐 ​

Dudo
User1655833706281357277
Associate III

Does anyone know why ST distributes the startup assembly file with every example rather than putting it in a library somewhere since, as far as I can tell, it's exactly the same file in all places?

I think in more is auto-generated code through theirs tools.​

Dudo
User1655833706281357277
Associate III

I'm not sure that makes sense. Everything else is in board-specific, CMSIS, Low-Level, or HAL directories. Why not that file?

Could you send 2 elf files that I can check and compare?​

Dudo
User1655833706281357277
Associate III

Here are the two executables along with plots from the x-nucleo board. I'm having trouble seeing both uploads in the same reply, so I'll post them seperately.

User1655833706281357277
Associate III

Here's the other one...

User1655833706281357277
Associate III

Sorry, forgot to add, run the program on a NUCLEO-L496ZG configured to use the X-NUCLEO board and select mode '12'.

User1655833706281357277
Associate III

Last reply, I promise. In both cases the power measurement is done with the debug pod disconnected from the nucleo board. The serial port is left attached in both runs.