Electronic – Should I use a resistor between an input pin of MCU/CPLD and VCC/GND


Some times, I want my MCU or CPLD to input a static logic. So, I choose to tie it to VCC or GND. The problem is that should I put a resistor in series to limit the current? I just think by myself for a while and get my own answer: no!
Take STM32F103(datasheet) for instance,on page 86:
IO characteristics
From the 'input leakage current', I know that when applied VDD the input resistance is at least 1 M ohm so that I do not need a resistor in series to limit current. Is that reasonable?

Best Answer

Hard connection of a pin to the VCC or GND is o.k. from a functional standpoint for high impedance inputs such as CMOS logic inputs. It also happens to be convenient on PC board design where it eliminates an additional component.

There are several conditions under which having an input pulled up or down via a resistor would be better than a direct rail tie. Here are some of those reasons.

1) If the pin happens to just be an input by default but can be programmed as bidirectional or output then accidental programming could cause the default state to change. A resistor could save a part from damage provided the pullup resistor value was sized properly to limit current to safe levels.

2) If there was any chance that you wanted to utilize the pin for some added function or feature during your project development having a pullup resistor allows for immediate use of the pin whereas a GND or VCC connection would require copper etch cuts. Having a pin connected into a copper plane via a thermal spoke type pad it can make it quite difficult to perform to pin isolation from the power rail copper.

3) Spare I/O pins can often see good use for temporary connections while developing the software for an MCU. With a pullup / pulldown on the pin you can use the pin at will and you have an easy place to attach a wire to connect the test signal. If it happens to be a leaded resistor you may even have a nice place to clip on a mini hook grabber.