14
\$\begingroup\$

Possible Duplicate:
General “rule of thumb” for unused IC pins

I read thru couple of questions & answers in here regarding the proper usage of unused MCU pins and all of them discussed about setting them either inputs with internall pull up/down or as output from the embedded software.

However, nobody mentioned the obvious: wiring the unused pin to GND or VCC. Is there any reason why one should not do that and use the software methods instead?

\$\endgroup\$
3
  • 4
    \$\begingroup\$ The answer to this question give a reason. Namely that you could short the supply if it becomes an output. \$\endgroup\$ Dec 4, 2012 at 15:05
  • \$\begingroup\$ One reason that comes to mind: with your method there are more track on the PCB which might make the board harder to layout. \$\endgroup\$
    – m.Alin
    Dec 4, 2012 at 16:08
  • \$\begingroup\$ My experience is that an unused pin unconnected and driven low causes the MCU to use less current than if its an input. \$\endgroup\$
    – Szidor
    Jan 18, 2016 at 19:40

3 Answers 3

29
\$\begingroup\$

There are many things that you can do, but the correct one depends on what you are trying to accomplish. I'll go over each of the common things:

  1. Leave the pin unconnected, set as an input, and no pullup/pulldown. This is probably the worst thing you can do. A floating input could cause input noise, even if that input is not being used for anything. This could result in increased EMI and increased power consumption. There is no good reason to do this.

  2. Leave the pin unconnected, set as an input, with internal or external pullups/pulldowns. This option is nice because the pin is available for future use (in case your design is not proven to work). Accidentally shorting the pin will likely not cause problems. This solution does nothing for EMI, however.

  3. Leave the pin unconnected, set as an output, and driven high or low. This is nice because the pin is still available for future use, but accidental shorts could easily kill the thing. This is the worst case scenario for EMI, because each pin forms a tiny stub of an antenna.

  4. Set the pin as a input, connect the pin to GND or VCC. The pin is not easily available for use if you have to rework the design. A good solution solution for EMI. One nice side benefit of this is that you can sometimes more easily route your power/gnd on the PCB since you can use the pads as a "route through"-- especally helpful on 2 layer PCB's with QFN or TQFP packages.

  5. Set the pin as an OUTPUT, connect the pin to GND , drive the pin low as appropriate. Sometimes this is called a "virtual gnd", and improves the grounding of the chip. This solution is the absolute best for EMI, but does not tolerate mistakes of any kind. For example, if you enable the output before setting the output value low and the pin is driven high for a moment then you risk damaging the part. This is almost never done in MCU's, but is more frequently used in FPGAs where additional grounding helps to minimize simultaneous-switching-noise. I would not do this without consulting the chip manufacturer.

Without knowing specific issues that you might be having, solution #2 or #3 are the best balance of pro's and con's. Solutions #4 and #5 are reasonable solutions if EMI is a problem but your design is otherwise close to final (I.E., you are not likely to have a design change that will require more pins).

\$\endgroup\$
3
\$\begingroup\$

If the pin becomes an output, it will be shorted. Which is bad, even if it is only for a brief time during startup (the datasheet will tell you about startup behavior). If it becomes an output due to a programming mistake, if it doesn't destroy the controller it will at least make further programming difficult (because of the shorted supply).

Usually the datasheet will give you the optimal connection for unused pins, here is one for an MSP430:

MSP430 user manual

\$\endgroup\$
1
\$\begingroup\$

Hypothetical reasons for general practise are to reduce defects & rework

  1. In production, you want to test all pins to check for defects even if unused. Your suggestion does not meet the testability criteria.

  2. If the schematic looked like a short, but the layout looked like an inductor, there may be a risk of ground or supply spike latchup. (nano-second SCR)

  3. Minor advantage to avoiding track cuts should one want to have a design change to use in future production ECN's.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.