cancel
Showing results for 
Search instead for 
Did you mean: 

Recommended course of action for Unused pin of STM32 MCU

Neeraj
Associate II

Dear ST Community members

I am currently designing a PCB and utilizing the STM32G473VET6 MCU. I have noticed that there are several unused pins. Should I leave these pins unconnected or is there a recommended course of action for dealing with them?

thanks and regards

Neeraj

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hello @Neeraj and welcome to the Community 🙂,

Do not leave unused pin floating. You can connect these unused pins to ground or to supply on the PCB, or use PU / PD.

The unused I/O pins should be configured as analog input by software; they should also be connected to a
fixed logic level 0 or 1 by an external or internal pull-up or pull-down.

For more explanation I advise you to refer to Getting started with STM32G4 Series hardware development boards application note. 

As already mentioned by @KnarfB the AN4899 Application note" STM32 microcontroller GPIO hardware settings and low-power consumption" can help you and precisely Avoid floating unused pin section.

I hope this help you!

Kaouthar

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.

View solution in original post

15 REPLIES 15
KnarfB
Principal III

AN4899 Application note" STM32 microcontroller GPIO hardware settings and low-power consumption" is your friend.

hth

KnarfB

Neeraj
Associate II

Hi @KnarfB 

Is it possible to connect unused pins to ground or VCC without a pull-up/down resistor?

KDJEM.1
ST Employee

Hello @Neeraj and welcome to the Community 🙂,

Do not leave unused pin floating. You can connect these unused pins to ground or to supply on the PCB, or use PU / PD.

The unused I/O pins should be configured as analog input by software; they should also be connected to a
fixed logic level 0 or 1 by an external or internal pull-up or pull-down.

For more explanation I advise you to refer to Getting started with STM32G4 Series hardware development boards application note. 

As already mentioned by @KnarfB the AN4899 Application note" STM32 microcontroller GPIO hardware settings and low-power consumption" can help you and precisely Avoid floating unused pin section.

I hope this help you!

Kaouthar

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.

TDK
Guru

Make sure you don't tie pins needed for programming to ground. If you're using the system bootloader, make sure you don't tie things to ground that it needs to function.

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

Well, I won't take any responsibility for your design. @KDJEM.1 has pointed you to more reading. Keep in mind that the empty check on a virgin device may push or pull pins in unwanted directions as discussed here https://community.st.com/t5/stm32-mcus/empty-check-mechanism-on-stm32/ta-p/49369

hth

KnarfB

Hi @KDJEM.1 ,

The AN4899 application note section "Avoid floating unused pin" also recommends setting the pin as PP output driven low for ESD concerns.

-So generally we should always set unused GPIO to analog input and Pull Down and that should be okay for noise?

-And if we are concerned about ESD we switch to the PP output?

Hello @MVeen.1 ,

Noise on non-connected input pin is a source of extra consumption by making the input buffer switch randomly. So, it is recommended to connect unused pins either to ground or to supply on the PCB, or use PU / PD. If the application is sensitive to ESD, prefer a connection to ground or define the pin as PP output and drive it to low.

Thank you.

Kaouthar

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.

Hi @KDJEM.1 ,

I'm using CubeMX and I set my unused pin PA1 to Analog and it is not permitting me to set a PU/PD.

MVeen1_0-1696430231498.png

You quoted section 6.1 in AN4899 which seems to make it clear that the pin must be PU/PD. In section 7.1, it says to set it as an Analog input which doesn't appear to have an internal PU/PD (see pic.). So now we're back to possibly having noise unless I connect an external PU/PD?

First of all, AN4899 contains additional information that applies to all STM32. Sections 6.1 and 7.1 refer to the already mentioned Schmitt trigger, which was connected to the GPIO by default in early families, but which could catch noise in floating mode because of its high impedance input, which can lead to higher current consumption. This is especially noticeable with ultra-low power derivatives. So if you activate the Analog Mode, the Schmitt Trigger is prevented from capturing noise. Nevertheless, it can be useful to terminate the input pins cleanly, which can also include an external pull down. Connecting the pin directly to GND is, as already discussed, not a good idea.

The second point is a special feature of the STM32G4, whose GPIO actually allows a pull down in GPIO_Analog mode (see RM0440, section 9.3.12), which is reflected in the corresponding configuration table (see RM0440, table 56, MODE=0b11). Important detail added so far only for this family, mentioned in the third bullet: The weak pull-up is disabled by Hardware. The weak pull-down is configurable.

I suspect that this feature has been forgotten in CubeMX, which is why currently no pull-down can be selected. But as a workaround you can reconfigure the pin in the user code using GPIOx_PUPDR.

Regards
/Peter

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.