cancel
Showing results for 
Search instead for 
Did you mean: 

What to do with unused IO's

DJ1
Associate III

Here in the below image from the Cube MX it suggests that, SET all the free pins as analog (to optimize the power consumption). How does it help. Also is it applicable to all the controller families?

 

DJ1_0-1698466663322.png

 

3 REPLIES 3
Danish1
Lead II

Digital inputs have circuits that look like NOT gates, where a P-channel MOSFET has its source connected to Vdd and an n-channel MOSFET has its source connected to Vss. The gates are connected to the input pin and the drains connected together as the output of the NOT gate.

When the pin is at Vss i.e. 0V, the p-channel mosfet is turned on but the n-channel one is turned off. So the output of the NOT gate is high, and no current flows between Vdd and Vss.

When the input pin is at Vdd the n-channel mosfet is on but the p-channel mosfet is off, so the output is low and no current flows between Vdd and Vss.

When the input pin is somewhere between Vdd and Vss, both p-channel and n-channel mosfets will be partially turned on so current will flow between Vdd and Vss - wasting power.

Ways to fix this are to disable this NOT gate (analog mode) or ensure that the pin isn’t just “floating” but is either Vdd or Vss (enabling pull-up or enabling pul-down or having the pin as a digital output, or having external circuitry that holds the pin high or low).

Analog is not the only way to do this.

AScha.3
Chief III

...and yes, this is same for all (cmos) chips , if a pin after startup is just an open floating input.

If you feel a post has answered your question, please click "Accept as Solution".
Peter BENSCH
ST Employee

In analogue mode, the GPIO is connected to the respective analogue function instead of the internal digital Schmitt trigger, because the GPIO in question is otherwise very sensitive to interference signals due to the high-impedance input.

With older STM32s such as F1, F2, F3, the GPIOs were still set to digital input by default and had to be explicitly set to analogue input. With newer families (if I remember correctly with L4) this was then changed to default = analogue input.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.