14

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?

Tero
  • 141
  • 1
  • 1
  • 3
  • 4
    The answer to [this question](http://electronics.stackexchange.com/questions/37696/general-rule-of-thumb-for-unused-ic-pins) give a reason. Namely that you could short the supply if it becomes an output. – embedded.kyle Dec 04 '12 at 15:05
  • One reason that comes to mind: with your method there are more track on the PCB which might make the board harder to layout. – m.Alin Dec 04 '12 at 16:08
  • My experience is that an unused pin unconnected and driven low causes the MCU to use less current than if its an input. – Szidor Jan 18 '16 at 19:40

3 Answers3

29

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).

3

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

AndreKR
  • 2,999
  • 3
  • 22
  • 28
1

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.

Tony Stewart EE75
  • 1
  • 3
  • 54
  • 182