2019-02-05 12:17 AM
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
2019-02-05 12:44 AM
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
2019-02-05 12:58 AM
Hello @HEkda ,
You should contact your FAE for quick support regarding this version of STM32CubeMX 4.99.7-D25.
Kind Regards,
Imen
2019-02-05 01:17 AM
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