Page 1 of 1

STM32L423KC - Low power modes

Posted: Thu Jul 22, 2021 6:26 pm
by akushva
Hello everybody

I was thinking about using the Nucleo-L432KC board for some battery-based applications.
but I couldn't find pyb.standby or stop function in the firmware.

dir(pyb)
['__class__', '__name__', 'main', 'ADC', 'ADCAll', 'DAC', 'ExtInt', 'LED', 'Pin', 'RTC', 'SPI', 'Timer', 'UART', 'country', 'dht_readinto', 'disable_irq', 'enab le_irq', 'fault_debug', 'repl_info', 'repl_uart', 'wfi']

How I can add low-power modes in the firmware?. Is it even possible to add this feature considering the flash size?

Re: STM32L423KC - Low power modes

Posted: Fri Jul 23, 2021 3:08 am
by jimmo
akushva wrote:
Thu Jul 22, 2021 6:26 pm
but I couldn't find pyb.standby or stop function in the firmware.
The pyb module has been largely superceded by the machine module, and I think only some boards provide the aliases on the pyb module.

In any case, you should be able to use machine.lightsleep() and machine.deepsleep() for stop and standby respectively.

Re: STM32L423KC - Low power modes

Posted: Fri Jul 23, 2021 3:32 am
by mattyt
I believe stop and standby will require a little more effort; I'm looking at implementing something similar for the STM32WB55 where there are >7 different power modes as well as additional configuration to tweak features vs consumption in some of those modes. Lite and deep sleep don't cover all the options.

I'm intending to experiment with the different power modes by using stm.mem32 to update registers directly - sometimes calling light/deep sleep after to drive the processor into the sleep modes after setting the appropriate register configuration.

A stretch goal would be to then expose the various power modes in MicroPython methods. It's challenging to make these generic since the various modes are often processor-specific.

I suggest you try something similar @akushva - and we ought to compare notes! Oh and flash size ought not be a constraint.