Skip to main content
HEkda
Associate
February 5, 2019
Question

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

  • February 5, 2019
  • 3 replies
  • 867 views

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

This topic has been closed for replies.

3 replies

Danish1
Lead III
February 5, 2019

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

HEkda
HEkdaAuthor
Associate
February 5, 2019

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

ST Technical Moderator
February 5, 2019

Hello @HEkda​ ,

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

Kind Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks