2023-05-02 09:15 AM
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
2023-05-03 08:51 AM
It's interesting. I don't know but it is very curious 🧐
2023-05-03 08:54 AM
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?
2023-05-03 09:02 AM
I think in more is auto-generated code through theirs tools.
2023-05-03 09:08 AM
I'm not sure that makes sense. Everything else is in board-specific, CMSIS, Low-Level, or HAL directories. Why not that file?
2023-05-05 06:19 AM
Could you send 2 elf files that I can check and compare?
2023-05-05 08:05 AM
2023-05-05 08:05 AM
2023-05-05 08:08 AM
Sorry, forgot to add, run the program on a NUCLEO-L496ZG configured to use the X-NUCLEO board and select mode '12'.
2023-05-05 08:11 AM
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.