STM32L423KC - Low power modes

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
akushva
Posts: 19
Joined: Fri May 03, 2019 10:08 am

STM32L423KC - Low power modes

Post by akushva » Thu Jul 22, 2021 6:26 pm

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?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: STM32L423KC - Low power modes

Post by jimmo » Fri Jul 23, 2021 3:08 am

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.

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: STM32L423KC - Low power modes

Post by mattyt » Fri Jul 23, 2021 3:32 am

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.

Post Reply