Only category 1 devices of the STM32l0x1 family have a lpds bit on the power configuration register. Categories 2 and above use the lpsdsr bit instead. On STM32l0x2 and STM32l0x3, these two bits are aliased in the stm32l0 crate, so cr.lpds() and cr.lpsdsr() will modify the same bit.
Tested by compiling the pwr.rs example and running it on a STM32L051C8Tx. With the fix, the stop current is reduced by 13.4 uA.
The problem could not be measured in the pwr.rs example because in it the device is put into low-power sleep mode before entering stop. That code accidentally left the lpsdsr bit set which would then affect the stop mode that followed. Fix this by properly exiting low power sleep.
Only category 1 devices of the STM32l0x1 family have a
lpds
bit on the power configuration register. Categories 2 and above use thelpsdsr
bit instead. On STM32l0x2 and STM32l0x3, these two bits are aliased in the stm32l0 crate, socr.lpds()
andcr.lpsdsr()
will modify the same bit.Tested by compiling the
pwr.rs
example and running it on a STM32L051C8Tx. With the fix, the stop current is reduced by 13.4 uA.cargo build --release --example pwr --features mcu-STM32L051C8Tx
The problem could not be measured in the
pwr.rs
example because in it the device is put into low-power sleep mode before entering stop. That code accidentally left thelpsdsr
bit set which would then affect the stop mode that followed. Fix this by properly exiting low power sleep.