cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx: Wouldn't the optimal setting be not to start any unused GPIO ports ?

HEkda
Associate

When checking "Set all free pins as analog ( to optimize the power consumption )" a previously not clocked GPIO port is clocked. Wouldn't the optimal setting be not to start any unused GPIO ports ?

STM32CubeMX 4.99.7-D25

STM32L4xx

3 REPLIES 3
Danish1
Lead II

I don't know the power-consumption for a not-clocked port that is left at reset (i.e. all pins digital input).

Class-A currents caused by floating digital inputs could be quite substantial (tens to hundreds of microamps per pin worst-case with older technologies; I don't know if stm32 are better).

In order to tell a GPIO pin to go to analog, you need to turn on the clock to the port.

If you're not using any pins on that port then you could save some current by turning off the clock after doing that.

I see the current consumption for an entire port is around 1.5 uA / MHz so it is worth doing. Maybe that's an enhancement to their auto-code-generation ST could add for future versions if there's enough demand. But there's nothing stopping you from you, as an intelligent engineer, from adding the necessary line of code yourself.

Regards,

Danish

Imen.D
ST Employee

Hello @HEkda​ ,

You should contact your FAE for quick support regarding this version of STM32CubeMX 4.99.7-D25.

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Danish,

Yes, my thought was really if the auto-generated code did the right thing. I like your idea to turn off the clock after the configuration. Thank you!

Best regards

H