# Should I connect unused STM32 pins to ground?

I'm designing some circuit using STM32L152RBT6 microcontroller. I'm using STM32L-DISCOVERY scheme as a reference of good STM32 practices. I've noticed that free pins of programmer's MCU aren't connected to ground (of course, they can't be connected at demo MCU in the second part of the circuit). I know that leaving free pins not grounded is acceptable in TTL-based circuits, but CMOS technology (on which STM32 MCUs are based) is different. It uses polar transistors. Ideal polar transistor consumes power only at the moment of switching. Also they're driven by voltage and leaving pins free should increase power consumption because of noise voltages. I've heard that grounding unused pins is a best practice to reduce CMOS power consumption. Should I ground all unused pins like on the scheme?

• Why not just enable the pullups? – Ignacio Vazquez-Abrams Dec 11 '16 at 22:05
• "[...] leaving free pins not grounded is [acceptable] in TTL-based [circuits]" If that is referring to leaving unused TTL inputs floating, then I disagree that it is acceptable. Some people did / do leave TTL inputs floating, but this can cause intermittent problems. Best practice on this is clear e.g. Fairchild TTL Databook says: "It is poor design practice to leave unused inputs floating."; NASA Design Checklists for Microcircuits says in the TTL design checklist: "All unused input pins should be tied to high- or low-logic levels [...]". – SamGibson Dec 12 '16 at 4:53
• @SamGibson "All unused input pins should be tied to high- or low-logic levels", -- but why? Not tied TTL input which has no current flow may be assumed as "connected to 1" isn't it? – quasiyoke Dec 12 '16 at 9:19
• @quasiyoke Open TTL inputs are high, but they float just at the threshold, so noise can generate a low pulse. – CL. Dec 12 '16 at 9:34
• @quasiyoke - "why?" CL has kindly answered (+1). If you want a reference, read Fairchild App Note AN-363: "Unused inputs on TTL devices float at threshold, anywhere from 1.1V to 1.5V, depending upon the device and its family. While this usually simulates a “high”, many application problems can be traced to open inputs. Inputs floating at threshold are very susceptible to induced noise (transmitted from other lines) and can easily switch the state of the device. A good design rule is to tie unused inputs to a solid logic level." – SamGibson Dec 12 '16 at 19:53

For STM32 MCUs, ST often provide a "Getting Started with [MCU model] hardware development" document, which contains useful info on how to integrate that MCU model into your designs. For the STM32L152 which you mentioned, the relevant document is "Getting started with STM32L1xxx hardware development", which says:

To increase EMC performance and avoid extra power consumption, unused clocks, counters or I/Os, should not be left free. I/Os should be connected to a fixed logic level of 0 or 1 by an external or internal pull-up or pull-down on the unused I/O pin. The other option is to configure GPIO as output mode using software. Unused features should be frozen or disabled, which is their default value.

You will also find useful discussions in these previous questions:

No.

Usually, the data sheet explicitly mentions what to do with unused pins. For most microcontrollers, the correct approach is to leave them open on the PCB, and leave the internal pull-up logic enabled after boot (the initial state is safe, so leaving it is safe, too).

It is generally a bad idea to connect I/O pins to a power rail without an in-line resistor. If you ever enable one of these pins as an output, the pin will drive against the power rail, and lose.

• Thanks for your help! But it seems like STM32L1 doesn't enable pull-up/down for its pins for some reason: "During and just after reset, the alternate functions are not active and the I/O ports are configured in input floating mode." (STM32L1 Reference Manual, page 174) so it's your responsibility to pull down (for example) unused pins. You're able to do that programmatically. – quasiyoke Dec 12 '16 at 18:30