2

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?

grounding unused pins

quasiyoke
  • 123
  • 1
  • 6
  • 2
    Why not just enable the pullups? – Ignacio Vazquez-Abrams Dec 11 '16 at 22:05
  • 2
    "[...] 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](http://oce.jpl.nasa.gov/practices/2203.pdf) says in the TTL design checklist: "All unused input pins should be tied to high- or low-logic levels [...]". – SamGibson Dec 12 '16 at 04: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 09:19
  • 1
    @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 09:34
  • 1
    @quasiyoke - "why?" *CL* has kindly answered (+1). If you want a reference, read [Fairchild App Note AN-363](https://www.fairchildsemi.com/an/AN/AN-363.pdf): "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
  • Some(?) STM32s can set their GPIOs to "analog input" mode or even set them so automatically after reset. Check the datasheet for your device, or the CubeMX. – JimmyB Feb 19 '17 at 12:52

2 Answers2

5

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.

Simon Richter
  • 12,031
  • 1
  • 23
  • 49
  • 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](http://www.st.com/content/ccc/resource/technical/document/reference_manual/cc/f9/93/b2/f0/82/42/57/CD00240193.pdf/files/CD00240193.pdf/jcr:content/translations/en.CD00240193.pdf), 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
4

Although you've already accepted another answer, I'll add some more info which may help other readers in future.

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:

SamGibson
  • 17,231
  • 5
  • 37
  • 58