Saturday, 24 May 2014

microcontroller - Pull-up and Pull-down Resistor Usage on Input or Output MCU Pins


Are pull-up/down resistors (whether internal or external) only needed for MCU INPUT pins? In contrast, an MCU pin configured as an OUTPUT "knows what level it's at" because it does the driving - a "floating" MCU OUTPUT pin tied to some input of another circuit doesn't make sense, because the state of the MCU pin can only be high or low... do I have this right? Now, upon MCU bootup or failure, it may be beneficial to have a pull-up/down tied to this "MCU output to IC input" line to ensure that the input to some IC is never floating.


Maybe I just answered my own question here... pull-up/down resistors can be used on both input and output pins, depending on application?



Answer



Pull-up and Pull-downs are normally used to ensure a line has a defined state while not actively driven. They are used on inputs to prevent floating lines, rapidly switching between high and low and a middle "undefined" region. Outputs normally do not need them.


But most mcu pins are GPIO, and sometimes on startup are defined as inputs instead of outputs. As you said, sometimes you don't want an IC pin input floating on startup, especially like a reset pin that you would normally drive with your microcontroller's GPIO.


This is when you use a Weak Pull-up or Pull-down on the line. Because they are weak, and you choose the default state, they provide no interference with your circuit (If the input is supposed to be low at all times, then pulled high, you choose a weak pull-down, and vis versa), but they do consume a bit of current. This is why you choose a resistor weak (Higher the value, the weaker) enough for the job.



Another normal output setup that uses pull-ups (or pull-downs, rarer) is Open Drain or Open Collector connections. These only drive a connection low, or release the line, leaving it floating. The pull-ups are used to bring the line to a high logic state.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...