2022-02-06 02:50 PM
I went through the examples on the ST site which have the direct implementations (not using CubeIDE generated code HAL for GPIO, SystemClock, ... config implementation)
The only difference is that low power sleep requires to disable the prefetch buffer initially
__HAL_FLASH_PREFETCH_BUFFER_DISABLE(); /* Disable Prefetch Buffer */
and then before going into sleep mode, enable the powerdown during sleep
__HAL_FLASH_SLEEP_POWERDOWN_ENABLE();/* Enable the power down mode during Sleep mode */
are these the only differences? Do I need to disable the __HAL_FLASH_SLEEP_POWERDOWN after i wake the mcu up (there is no function for it and the definition of __HAL_FLASH_SLEEP_POWERDOWN_ENABLE seems sleep mode specific so it seems unlikely that I need to manually disable it)
Are the power consumption differences significant enough if I'm using a UART that's always listening?
I just want to listen to UART all the time and save the data in a buffer and wake up from low power sleep after every timer interval seconds.
2022-02-08 08:00 AM
Hello @AV.9 ,
To be in low power sleep you need to have the MSI in range 1 or 0 and Vcore in range 2. It's write in the Reference manual RM0367 Rev 8 (page 158).
The differences between low power sleep mode and sleep mode are not the flash power down. But it is in SystemClock_Config() and SystemPower_Config(). If you check in these functions you will see the difference.
In this example, they are powered down the flash to maximize the power consumption but it's not mandatory.
In sleep mode you can use UART. But in low power sleep mode you will be limited by 131kHz while in sleep mode you will be limited by 32MHz.
Regards,
Simon TALAS
2022-02-08 11:59 AM
Different Low Power mode are described in the STM32L Datasheet:
2022-02-09 05:42 AM
Thank you very much for the reply. When I try to implement this in cubeIDE using HAL, what is the difference in implementation between sleep and low power sleep