STM32 and Other Microcontrollers: What to Do with Unused Pins?

Created: October 24, 2018
Updated: September 25, 2020

Utilizing unused junk

I must admit that I’m not exactly the right person to turn to for cleaning tips. I dread the annual spring cleaning as there are always surprises in the storerooms to deal with. Occasionally, I stumble upon items that I barely even recognize but eventually decide to hold on to.

While my indecisiveness with unused items results in some nagging from my wife and loss of additional space, failing to deal with unused pins on a microcontroller can have larger consequences. It may result in issues that go undetected during the prototyping stage and comes back to haunt you when hundreds of microcontroller are deployed on-site.

What Happens When You Leave Unused Pins Unconnected in a Microcontroller

In a typical microcontroller design, it’s normal to end up with some unused pins. These may be general purpose inputs and outputs or microcontroller pins that are merely labeled as “NC” in the datasheet. The quick and easy solution is to leave these pins unconnected as this means less routing for the hardware as well as less space occupied on the PCB.

However, the consequences of doing so can include the unstable operation of the microcontroller in an actual application or, on a serious note, outright damage to the component itself. The effect of unused pins varies as it depends on the types of pins and the potential risks they pose when left unconnected.

One of the most significant concerns is presented by unused input pins. These pins are usually tied to internal pull-up or pull-down resistors; leaving them floating usually does not affect the algorithm of the microcontroller. However, keeping the input pins floating makes them a perfect magnet for attracting electrostatic discharges (ESD) or electromagnetic interference (EMI).

Output microcontroller pins seldom have issues when left unconnected, but there are some cases where oscillation may occur on an unconnected output pin and affect the stability of internal logic. The only pins that you should leave unconnected are pins noted to contain internal circuitry for factory testing. They are usually denoted by “IC” and highlighted explicitly on the datasheet.

How to Connect Unused Pins in a Microcontroller

This is a question that often troubles novice hardware designers. Electronics experts have varying opinions on the right way to manage the unused pins. Generally, I have followed a certain set of principles throughout my design career.

Hardware resistor

Connect unused input pins to pull-up or pull-down resistors.

Some would claim that connecting the unused pins to ground or Vcc would be the best way to eliminate the risk of EMI interference. However, doing so poses a threat of its own while reducing the flexibility of the design. The pin would suffer damage when the firmware developer accidentally turns the pin to an output, and it draws or sinks excessive current beyond its limit.

Instead, the input pins in a microcontroller should be connected to a pull-up or pull-down resistor. This will provide a balance between flexibility and EMI reduction on the design.

Output pins in a microcontroller are generally safe when unconnected, but it’s a good practice to connect them to pull-up instead of pull-down resistors to minimize idle currents. Having external resistors also means that heat dissipation is evenly distributed instead of concentrated on the microcontroller itself.

Not connected

Some pins are best left unconnected.

As for pins that are labeled ‘NC,’ the lack of standardization from the manufacturers means that you should always read the datasheet thoroughly before deciding if they are best left unconnected, or a resistor tied to ground or Vcc is required. Some of these ‘NC’ pins may be physically unconnected to the rest of the internal circuitry while some are meant for factory usage.

If space is not a significant issue on your PCB, it’s also a great idea to route all of the unused pins to a single connector. This allows the pins to be tested and used in the future, should any need to do so arise.

With comprehensive PCB design software like Altium Designer®, terminating the unused pins with resistors is convenient. Altium’s offers all the necessary components and includes additional resources to help optimize your PCB design. If you have more concerns about unused pins, talk to an Altium expert for more tips.

Related Resources

Related Technical Documentation

Back to Home
Thank you, you are now subscribed to updates.