This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Analog input with weak pull-ups

Hello all,

when a gpio is set to analog input, can the weak pull up be activated?

The datasheet is not clear

thanks

  • Don't believe that "weak pull-up" circuit path can be engaged when you order the pin into analog.  (confess I've never tried - nor felt the need)

    If that path does exist - is it not likely that the ADC input would drive nearly to full-scale?  And this - in the absence of any "real" input signal.  Yet - if there is value in your "pull-up approach" - you surely can implement with an external resistor - and gain precise control of the assertion and value of such pull-up.  (neither possible via internal R)

    Curiosity (this reporter) and others dictates that you (bit) detail your desire - hopes/dreams - for that pull up.

  • Hello cb1,

    Same here. What function will a Pull Up achieve on a Analog Input.

    Regards

    Amit

  • @Amit,

    Proof - great minds (true - at least your case) think somewhat alike!

    In all my years in/around MCUs - never/ever have we encountered such...

  • Actually there are reasons to use a pull-up on an analog input circuit.  I wouldn't use the weak internal pull-up on the micro in that case.  At the very least I wouldn't want the micro that exposed to external signals.

    Oh and the case where a pull-up is used?  It is used in circuits where the zero case is high voltage. It ensures that in the case of a broken wire that the signal will be pulled to an off value.

    Used frequently with 2-wire pots on EVs.  They are wired so commanded zero is a full resistance and full speed at short.  An open (broken-wire) looks like stop.

    Robert

  • Hello Robert,

    Thanks for the input. We do value our forum members sharing application information. However what would be the value for such pull resistance. A strong pull resistance may in fact affect the actual value of the analog inputs especially if they have limited current sourcing capability?

    Regards

    Amit

  • Now that you mention it - we have seen similar - but (again) not via a pull-up R, alone.

    What I believe to be a better method is to default to a known (usually "normally disallowed") signal range.  Limiting this input signal to that known range proves a superior indicator as it provides further insight into the fault source...  (i.e. a fault condition is signaled by the movement from the "normal, idle range" and is further localized by the (normally disallowed) transition to near ADC saturation.  (due to an open signal condition - as you reported...)

  • The value is that it is safe in the case of a broken wire. 

    In the case of a 2-wire pot input on an EV the input pulls-high which brings the speed command to zero.  The pull-up resistor forms part of the resistor divider with the pot.  With a broken wire the input pulls to the maximum possible value. 

     

    Robert

  • I am very happy to see such a response to my question. Thanks to all. I simply have a photocell from the input to ground. I was wondering if using the internal pull up would save me an external resistor since the photocell is inaccurate and the software takes care of the calibration.

  • Been years since our small group has seriously used photocells - yet I recall there being issues with device temperature, aging and "unit to unit" or "lot to lot" variations.  As a work-around - we found it best to employ external powering resistors - sometimes with "staggered" values - so that we could compensate for device variation.  (under the conditions previously presented)

    The cost/size savings resulting from one (or several) 06-03 resistors is extremely hard to justify - in my mind - for almost all here.  (includes this reporter - those selling to consumers or automotive may justify such savings - but by far the bulk here will benefit from the "choice" and "tuning" which external resistors (alone) enable...)

  • Photocell, well I would have thought the internal pull-up to be too weak and too variable for that. 

    Also I wouldn't hook the photocell up directly to the micro in any case.  The photocell provides an easy input path for ESD if it is at all accessible.  And you will almost certainly have an impedance mismatch between the sensor circuit and the A/D unless you provide at least some signal conditioning.

    Robert

  • Thanks for all the good advice.

    Claude