2

I am currently working on a project, with stm32l0 and cmsis library, which I need to make it as low power as I can. So I noticed that if we use a mode of low power for example stop mode, we can reduce the power more by making all gpio pins into analog mode. According to the reference manual when I/O pin is configured as analog, the Schmitt trigger is deactivated, providing zero consumption for each pin. So when the system goes low power, I need to create a function in order to convert all gpio pins into analog mode and when the system exit from low power must be another function that turns all gpio pins as it was before. Is my thought about that correct? What did you have to say for this change in gpio pins? Can anyone provide an example or something that could be useful for me in order to make this happen.

Thank you in advance.

Felix
  • 1,066
  • 1
  • 5
  • 22
gregni
  • 417
  • 3
  • 12
  • What's your wake-up condition? If it's a GPIO then you'll at least want Schmitt trigger on that one, I would imagine. Though overall this seems like a complex solution just to scrape together a few uA - have you already optimized the clock for low power? – Lundin Feb 18 '22 at 14:08
  • 2
    You may set the corresponding bits of GPIOx_MODER to 11. – Martin Rosenau Feb 18 '22 at 14:10
  • @Lundin The only way to wake up from stop mode is the pin PA0. So maybe you suggest me to use sleep mode for low power than stop mode? I think it is more easier to accive that. Yes I have already optimized the clock for low power. – gregni Feb 18 '22 at 14:27
  • 1
    It's not such a "complex solution", if you have a proper MCAL "Port" driver, going over an configured array of PinConfig values. If a pin is not listed, configure in this AnalogConfig per default, other use the settings you choose for the pin. If there is a excel sheet or tool for pinpad/mux config, this could even be generated. You could even make 2 configs like `NormalModeCfg` vs `LowPowerModeCfg` or `SleepCfg` and call that in the init or shutdown phase. Strange, that the chip enables all pins as input per default on reset anyway. – kesselhaus Feb 18 '22 at 23:12

0 Answers0