Shop OBEX P1 Docs P2 Docs Learn Events
Pull-Up And Pull-Down Resistors Associated With The Propeller Chip — Parallax Forums

Pull-Up And Pull-Down Resistors Associated With The Propeller Chip

As I have said many times before, so I might as well admit it another time... I am no electrical genius :)

That being said, I would like to gather some knowledge and input from experienced members and engineers, pertaining to the subject of pull-up and pull-down resistors. While seeking answers pertaining to this subject, I have found various information scattered here and there. Therefore it would be nice to have a common source for both beginners and the novice tinkerer, which could provide guidance.

Perhaps something similar to the guidance provided by knowledgeable members which helped to put together this great thread: forums.parallax.com/discussion/137035/mosfets-and-the-propeller/

For instance, some of the items that could be covered:
When to use a pull-up on inputs
When to use a pull-up on outputs
When to use a pull-down on inputs
When to use a pull-down on outputs
Proper use of pull-ups and pull-downs
The proper size of pull-ups and pull-downs for Propeller pins
Perhaps illustrations showing various usage
etc...

Please share your knowledge so that others may learn from you. Thank you in advance.

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-05-20 14:18
    Looks like I answered that old mosfet post too.

    Pull up/down resistors are always necessary on any inputs that can "float" which means that due to the very high input impedance it can pickup stray electric fields and even hold a charge due both to it's very high input resistance and a touch of capacitance. A relay has an input, but if you left it floating it will never be activated by stray signals, not so your logic inputs. A gold leaf electroscope would react to electric fields but if you didn't want it to you could put a pull-down resistor on it :)

    When to use a pull-up on inputs - when that input is active low and only if there is a possibility of floating such as when a switch to ground is open.
    When to use a pull-up on outputs - only if they can misoperate while the output pin is floating which can happen during reset or programming.
    When to use a pull-down on inputs - same as pull-up on inputs except reverse state.
    When to use a pull-down on outputs - same as pull-up on outputs - depends on what the inactive state is
    Proper use of pull-ups and pull-downs - if in doubt then just allow for a resistor - it is easy to change or leave out.

    The proper size of pull-ups and pull-downs for Propeller pins
    Depends upon the input - for a push-button I like some wetting current so maybe 1k otherwise 10k. If the input is driven at high speed open-collector such as some optos then you may need a much smaller pull-up of around 220R due to the RC delay effect of logic input and track capacitance.

    You don't need a pu/pd if you are driving the input from a logic gate or other push-pull device as the pin will never float.


  • When to use a pull-up on outputs:

    when you're simulating an open-drain output by toggling DIRA instead of OUTA (OUTA for the pin fixed at zero). This is done in I2C drivers, for example.

    -Phil
  • idbruceidbruce Posts: 6,197
    edited 2017-05-20 20:43
    After reading various input from several different threads, and many different posts, I am almost under the impression that every Propeller pin should have either a pull-up or a pull-down attached to it. Is this true?
    EDIT: Except as noted by Peter:
    You don't need a pu/pd if you are driving the input from a logic gate or other push-pull device as the pin will never float.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2017-05-20 22:25
    idbruce wrote:
    I am almost under the impression that every Propeller pin should have either a pull-up or a pull-down attached to it. Is this true?
    No, it's not. If a pin is a dedicated push-pull output, it does not need a pull-up/-down resistor. The brief time during reset when it's floating will not hurt anything. Moreover, such resistors are actually undesirable when they're part of an analog circuit (e.g. DAC), as they would skew the output. Finally, the only reason not to let a pin float is to limit current draw should the pin float near the logic threshold. The Prop's internal high/low protection diodes prevent excursions beyond the Vdd/Vss limits.

    -Phil
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-05-21 00:33
    The brief time during reset can be an even longer time during program load or load of buggy software. If you are driving MOSFETs which are connected to a heavy load with power during all this then don't be surprised if the board starts smoking. Always use a pd for an N MOSFET and pu for a P so that its gate will never inadvertently float causing the device to partially turn on which is worse than turning on fully since the MOSFET now becomes an inefficient resistive switch which means heat which means smoke and sometimes fire.

    BTW, yes, analog does not normally need or should have any pu/pd/.

    As an extra note I like to always pu the rx and tx line. Some software can see a break condition and misoperate when disconnected plus the pu on the tx line prevents the line floating and sending out garbage during reset/load.
  • As an extra note I like to always pu the rx and tx line. Some software can see a break condition and misoperate when disconnected plus the pu on the tx line prevents the line floating and sending out garbage during reset/load.
    Good advice! As is the caution about MOSFETs.

    -Phil
  • The rule is, there is no hard and fast rule. Think it through, designs and consequences.

    What value to use? The strength of pullups for i2c and in general depend a lot on where the signal goes or where it is coming from. A pullup/down on a line that has more capacitance plus higher speed requires a lower value of resistance. A prime example of this is when there is a cable involved.

    Let me talk about crosstalk. Under some conditions you can use a high value, let's say 1MΩ. But suppose the next pin over is one that toggles high and low. Depending on board layout, there may be capacitance between the pins, and the toggling on one pin will tend to couple through to the neighboring pin. If that neighboring pin has a high impedance like a 1MΩ pullup and low capacitance, then little spikes will show up over there, especially on 1->0 transitions. (=crosstalk) . That can be bad if that other pin function is something like a counter, or if it is a clock line for i2c. In that case, the pullup might have to be stronger, say 10kΩ or 2kΩ, and it may even need addition of capacitance in parallel with the resistor in order to swamp the crosstalk spikes. But that kind of issue is better dealt with by layout, better separation of pins or better assignment of conductors in a cable.

    About the serial rx. I use a pulldown instead of a pullup. Why? So that the firmware can easily detect when someone connects to the serial port and drives it high. If firmware discovers that the port is low, it is left disabled, and the serial cog is shut down, but if the port is high, that causes the serial cog to fire up. It is simply a design decision, and using a pullup is a different design decision, not a hard and fast rule. I use a serial object that rejects bytes with framing errors, so that it will not be clobbered with a string of nulls when the port is active but disconnected.

  • About the serial rx. I use a pulldown instead of a pullup. Why? So that the firmware can easily detect when someone connects to the serial port and drives it high. If firmware discovers that the port is low, it is left disabled, and the serial cog is shut down, but if the port is high, that causes the serial cog to fire up. It is simply a design decision, and using a pullup is a different design decision, not a hard and fast rule. I use a serial object that rejects bytes with framing errors, so that it will not be clobbered with a string of nulls when the port is active but disconnected.

    I know there are some applications where there this might be desirable but I always need my serial port active as I can plug in anytime. However my receive routine does discard framing errors and nulls too although I count all the consecutive framing errors as part of a "break" to reboot the device. So a proper break or just a whole string of framing errors will reset the device although I do check for floating inputs (pulse high, settle, check) and ignore these.

    I don't know what the serial object is like in C but the old FDX object that many use is a bit basic.

    BTW Tracy, with all the talk about crosstalk I think you are crosstalking poor Brucie's brain, all the signals are probably getting scrambled :):) pull up, pull up!

  • Peter
    BTW Tracy, with all the talk about crosstalk I think you are crosstalking poor Brucie's brain, all the signals are probably getting scrambled pull up, pull up!

    LOL... No truer words were ever spoken.

    I am try to grasp everything that is being said in this discussion, but I must admit that most of it is going straight over my head. However, the information will be here, when I acquire a better understanding.

    I think one of my biggest problems is that I have always relied on the diagrams provided by the various manuals, instead of studying the actual theory of pull-ups/downs and what they actually are, and how they are actually configured.

    To be perfectly honest, if I were shown a diagram of both pull-up and pull-down circuitry, and were asked to identify each of them, I would probably fail, with the odds only being 50/50 :) The only time that I ever used them was either for rx/tx, i2c, or pushbuttons, and then I relied strictly upon provided diagrams.

    However, I am definitely at a point, where I want to acquire a much better understanding, because I am getting very tired of floating pins.

    @Peter, Phil, and Tracy

    Thank you for putting forth the time and effort to share your knowledge, so that I and others may benefit from it. I sincerely appreciate it.
  • I probably should have started this thread at least 7 years ago, because by now my circuitry would most likely be a bit more reliable :)

    Anyhow, one of the reasons that I started this thread now, is because I am now working on a new controller board, for a new machine. Regrettably, I have already missed the opportunity to place (I believe pull-downs) on the step and direction pins of the stepper drivers. However, I am now faced with setting up the circuitry going to the laser driver module, and I certainly don't want the laser misfiring during start-up, or anytime for that matter, so I am now pondering the best way to ensure that misfires never happen. Although, I am truly unsure of the best way to set it all up.

    The laser module will require pulse modulation. So my thoughts are that I should pull the PWM pin low, to prevent pin float during start up. Is this correct?
  • I now see that YouTube has several videos which explain pull-up and pull-down resistors, their usage, and configuration. I should have looked there a long time ago.

    By the end of today, I should have a much better understanding, pertaining to this discussion.
  • idbruce wrote: »
    Peter
    BTW Tracy, with all the talk about crosstalk I think you are crosstalking poor Brucie's brain, all the signals are probably getting scrambled pull up, pull up!

    LOL... No truer words were ever spoken.

    ... snip ...
    However, I am definitely at a point, where I want to acquire a much better understanding, because I am getting very tired of floating pins.

    Hehe. Bruce, I am in awe of all the machinery you build, pulling yourself up as it were by the bootstraps with the electronics. I'm sorry I get off into secondary issues. I often have to do design review for products, where the objective is to point out potential problem areas. Fine for a professional, for a novice that kind of thinking can simply discourage effort and progress--Better to have at it and see if it works. You asked the questions. General guidance is fine, but if you have specifics in mind, come back with those.

    One of your questions is, "The proper size of pull-ups and pull-downs for Propeller pins"
    10kohms is your starting value. There are factors that indicate using higher or lower values, factors such as speed of response (lower), sensitivity to outside noise (lower), power consumption (higher), and all sorts of funny circuit design goals and quirks. I also mentioned crosstalk (sorry about that!). But I can imagine a cable out to your machine that has to carry a bunch control and feedback signals. That is a situation where you have to give more consideration to the value of pullup/down resistors (if any) and how the wires in the cable are assigned.

  • tonyp12tonyp12 Posts: 1,951
    edited 2017-05-22 19:13
    In a active low, multi-ends (OR'ing) pulling it down, you use Pull-Up Resistor, safety from a mishap of mixed hard push-pull outputs shorting.
    The faster the signal have to recover to see a fast rising edge the lower the resistor, 2K for really fast.
    Think of like filling up a bathtub after a instant draining a n-mosfet to ground just did to it, the trace have capacitance that needs to be "filled" up.
    But always using low resistor values wastes power every time the signal is pulled low, so go with 10K or 20K if possible.

    You use 100K pull-down if you want a pin in a low-state while system is booting-up to set the pin in software.

    You use pull-up or pull-down if an output from a device is not push-pull.
    example a tactile switch don't have 2 rail-states but HI-Z and GND (if terminal is connected to gnd but could be connected to Vcc)

    HI-Z is floating and act as antenna and will pick up noise and probably go high but who knows,
    a resistor sets it to a known state that a output on a device can later override as it pretty much only have 1ohm or less to opposite power-rail.


    1 or 2Mega ohm pull-ups saves a lot of power, but gpio input impedance may match it so you don't see a signal.
    To get around it you could go with 100K and have a PWM pin pull it low at 1% duty around 8/sec. (if pwm is available in low power mode)
    You will not get a instance response but saves you power, especially if you don't know what state a switch is left in at rest.
  • idbruceidbruce Posts: 6,197
    edited 2017-05-22 19:38
    Tracy
    I'm sorry I get off into secondary issues. I often have to do design review for products, where the objective is to point out potential problem areas.

    There is certainly no need for apologies. You have helped me and have tried to help me on numerous occasions, and I have nothing, but gratitude for you. More or less, I was just laughing, as Peter was poking fun at me :)

    As you know, this is a technical forum, and there are many things said in this forum that I will never understand, but that is okay, because I just try to grab the tidbits that I need to pursue my endeavors. I suppose I am trying to say that "geek speak" should be expected in a technical forum amongst the professionals. Professionals also need to learn a thing or two from other professionals.

    I sincerely thank you for all the help you have given me in the past, all the times that you have tried to help me, and any combination of those two that may occur in the future :)
Sign In or Register to comment.