zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.48k stars 6.41k forks source link

STM32U5 consumes more current using power management #49677

Closed vibhor-meshram closed 2 years ago

vibhor-meshram commented 2 years ago

Describe the bug I am using nucleo_u575zi_q board. I want to implement shutdown mode using power management scheme and wake up the MCU using an external interrupt. For starters I am testing zephyr\samples\boards\stm32\power_mgmt\blinky example to test the basic power management. I am using zephyr 3.10 version.

I created power states nodes in nucleo_u575zi_q.dts file (since nodes were not present there). power-states { stop0: state0 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-idle"; substate-id = <1>; min-residency-us = <100>; }; stop1: state1 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-idle"; substate-id = <2>; min-residency-us = <500>; }; stop2: state2 { compatible = "zephyr,power-state"; power-state-name = "suspend-to-idle"; substate-id = <3>; min-residency-us = <900>; };

&cpu0 { cpu-power-states = <&stop0 &stop1 &stop2>; };

In the blinky proj.conf file following is the configuration I have:

CONFIG_PM=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y CONFIG_CONSOLE=n CONFIG_SERIAL=n

Expected behavior When CONFIG_PM is set to y, the MCU should consume low power than what it would consume in active state (CONFIG_PM=n).

Observation If CONFIG_PM=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y CONFIG_CONSOLE=n CONFIG_SERIAL=n

Current Consumption = 12.8 mA LED stops blinking

If CONFIG_PM=n CONFIG_PM_DEVICE=n CONFIG_PM_DEVICE_RUNTIME=n CONFIG_CONSOLE=n CONFIG_SERIAL=n

Current Consumption = 7.3 mA LED is blinking after every 2 seconds **

Impact High

Environment (please complete the following information):

erwango commented 2 years ago

@vibhor-meshram Did you enable lptim node in order to use it as a LP ticker ?

&clk_lse {
    status = "okay";
}

&lptim1 {
    clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000800>,
         <&rcc STM32_SRC_LSE LPTIM1_SEL(3)>;
    status = "okay";
};
vibhor-meshram commented 2 years ago

Hi @erwango I added the above nodes. No change in in output. Adding my dts file for your reference. nucleo_u575zi_q-common.txt

erwango commented 2 years ago

Here is my test with the provided configuration. Measurements were done using stm32l562e_dk & STM32 CubeMonitor-Power. There's a bit of noise (which may be due to ST-Link, I haven't checked deeper on the board doc), but consumption level is around 100uA, which I think is acceptable to demonstrate stop modes.

nucleo_u575zi_q_lp_blinky

This was achieved using samples/boards/stm32/power_mgmt/blinky and the configuration provided above on zephyr-v3.1.0-4437-g162d435908 Please note that I had to reset the board to override default debug setting.

erwango commented 2 years ago

@vibhor-meshram I'm closing the point as can't be reproduced. Please re-open if you have more inputs.