1
\$\begingroup\$

According to the datasheet, it is preferred to have MCU's unused pins connected to GND. That's the only thing suggested in the datasheet. I think it would not be a wise decision to directly connect the unused pins to GND. I am planning to use a resistor (pull-down). However, I am not sure what value for the resistance I should use. In the datasheet, I couldn't find the IIH(Max input current for logic low). That's why I cannot calculate the pull-down resistor value.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Which MCU? Why can't the unused pins be outputs so there is no need to add extra resistors? Or why can't internal resistors be used? \$\endgroup\$
    – Justme
    May 23, 2022 at 21:19
  • \$\begingroup\$ "I think it would not be a wise decision to directly connect the unused pins to GND" Why not? Do you have any argument why this would be bad? \$\endgroup\$
    – Lundin
    May 24, 2022 at 6:07
  • \$\begingroup\$ @Lundin There might be many reasons or none. Without knowing which MCU it is it might be a disaster or irrelevant. And depending on the MCU, there might be a solution not yet mentioned here. \$\endgroup\$
    – Justme
    May 24, 2022 at 8:34

4 Answers 4

2
\$\begingroup\$

A resistor to ground (or VCC) is useful not only for ensuring that the pin is not floating but as a connection point if you later need to modify the design.

The actual value is relatively unimportant.

Zero ohms could be used but would cause high currents if the output was accidentally set as a high output. I would normally use something in the range of 10k-100k.

A CMOS IC such as used in all microprocessors will have leakage currents in the nano-amp range so can be ignored in most situations.

For non-production designs you can leave the pin open and ensure in software that it is set either as an output or an input with the MCU internal pull-up or pull-down enabled. Most modern MCU GPIOs have internal pull-up and many have internal pull-downs. It does not usually matter whether the pin is pulled up or down, just that it is not floating as it may acquire an intermediate voltage where it increases the supply current or causes erratic triggering of internal functions.

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

The purpose of this exercise is to limit your leakage currents for unused pins. This in turn depends entirely on how much you care about micro- or nano-amps.

If your application doesn't care too much about minor current leakages, then it kind of doesn't really matter what you do here. I wouldn't connect them to ground directly in case software tries to set them as outputs and to a logic high output, in which case damage may result. If your micro includes internal pull-downs, or pull-ups, those would suffice in this case, if you even need to bother with going that far. For example, if this is a hobby project powered from an AC-mains derived source, then I wouldn't bother at all with an external pull resistor.

If you do care about minor leakage currents, then yes a resistor will come into play to reduce that amount of leakage. It depends on exactly what pin setup you have, and that would require letting us know the part number.

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

Input current will be negligible for modern CMOS inputs, and any value resistor, from zero to 10MΩ, is likely to work fine. Current through that resistor, or even a direct short circuit, won't reach even nanoamps.

It isn't input current that you should worry about, it's oscillation caused by floating inputs picking up signals from the environment (anything from mains to neighbouring signals), and causing the input's internal buffer to switch erratically. Those transitions can cause significant current draw from the power supply, and has nothing to do with input current. Any resistor to ground/Vcc from 0Ω to 1MΩ will put a stop to oscillation, with the caveat that smaller is better is this respect, especially if you have large transients occurring nearby.

Presumably you wish to protect the I/O circuitry from excessive current draw, in case you accidentally configure it as an output. If so then you're concerned with keeping the resulting current to a minimum. If 10μA is acceptable, then \$ R = \frac{3.3V}{10\mu A} = 330k\Omega \$ would do the trick.

If I absolutely must use a resistor, I would be happy with 10kΩ or 100kΩ, considering that any current in that resistor would occur only briefly, at startup. Otherwise it's a design problem, which should be fixed in software. A value in that range will keep short-duration output current in check, while also inhibiting oscillation.

That said, I would not use a resistor, I'd just short the thing to ground or Vcc. Extra resistors add cost and require space, and it's very unlikely that an MCU would start up with I/O pins as outputs.

\$\endgroup\$
0
\$\begingroup\$

Use 5 or 10k ohms and preferably have the firmware set the GPIO pins to low.

The main limitation is the leakage current which should be specified in the datasheet and typically will be something like +/-1 microampere over the entire operating temperature range. Typically it will be much less, particularly at room temperature.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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