external pullup resistor control circuit - Page 1
Forum section: electronics / general

author: jtronix
author_rank: Regular Contributor
timestamp: May 23, 2016, 04:04:22 am
content: how to enable and disable external pullup resistor to microcontroller pin because i'm using one port pin for two applications.. For one application need external pullup resistor whereas for the other application pullup not required.

author: jnz
author_rank: Frequent Contributor
timestamp: May 23, 2016, 04:22:36 am
content: ... Maybe you should draw a picture of what you are trying to do.The obvious answer is use a different micro pin as an output that is then tied to your line with a resistor. Output on that pin and your other line now has a pull-up.But... Since you wrote you want to share a pin on your micro... I'm guessing you don't have a spare output pin for this. That being the case, I don't know, someone really clever might be able to make a pulse-aware mux or something, but don't look into that I'm mostly just daydreaming.

author: dannyf
author_rank: Super Contributor
timestamp: May 23, 2016, 11:02:10 am
content: "How to enable and disable external pullup resistor to microcontroller pin because i'm"The easiest answer would be to out them on different pins.If. That's not possible, use a transistor plus a resistor as pull up or pull down.

author: Ian.M
author_rank: Super Contributor
timestamp: May 23, 2016, 11:09:55 am
content: As Jnz pointed out, assuming the pullup voltage is equal to the MCU Vdd, you can usually get away with a simple resistor to another I/O pin. Set it as output high to enable the pullup or as an input to disable it. If you want to use one pin to control multiple pullups, it gets a lot more complex . . . If you don't have any spare I/O pins and cant add an I/O expander, you are FUBARed unless you want to resort to a switch or jumper.

author: spudboy488
author_rank: Regular Contributor
timestamp: May 23, 2016, 11:39:04 am
content: If the first function is an input (needs a pull-up) and the second function is a digital output (I/O, PWM, etc.), you can leave it in. You may need to use a higher resistance for the pull-up if there is an issue with the output being able to drive the line low but that shouldn't effect the input function.

author: newbrain
author_rank: Super Contributor
timestamp: May 24, 2016, 06:48:44 am
content: Some MCUs have got an internal pull-up that you can control directly (e.g STM32, MSP432, even AVR IIRC).If the internal pull-up value is OK for your application, it's up to you to check (or you could provide more info).If not, and if the I/O characteristic are not exceeded, you might be able to always leave the external pull-up in the circuit with no real adverse effects.You did not specify if the pull-up is needed when the pin is configured as input or output (==Open Drain).In the first case, no issue with an internal or external pull-up of reasonable value.In the second, the usual trick for GPIOs that do not provide a real Open Drain mode is to use the Data Direction as the output register, while keeping the actual Data Register at 0: setting the DDR to output will yield a 0, setting it to input will yield a pulled up 1.