How to verify GPIO configured as input w/pullup is working (STM32F103) - Page 1
Forum section: electronics / general

author: mwb1100
author_rank: Frequent Contributor
timestamp: March 11, 2021, 11:51:25 pm
content: I have a GPIO that is attached to a 74LV323A latch that comes up in a high impedance state. I'm configuring the GPIO to be an input using the STM32F103's internal pull-up.I'd like to verify the effect with a multimeter but my understanding is that I can't just read the pin with the meter's probe because if the pull-up isn't correctly setup and the pin is floating, the meter could read anything. So I need to load it enough that it wouldn't be floating, but not so much that it gets pulled down. Does that make sense? (I'm a software guy, my hardware knowledge is super basic)The STM32F103 internal pull-ups are nominally 40K Ohms I believe.What would I need to do to read that the pin is being pulled up?

author: ataradov
author_rank: Super Contributor
timestamp: March 12, 2021, 12:10:21 am
content: Place 510 kOhm resistor to ground and see that it still reads high. Or place ~40 kOhm resistor to ground and check that the voltage is about 1/2 VDDIO.

author: mwb1100
author_rank: Frequent Contributor
timestamp: March 12, 2021, 06:17:20 am
content: Thanks

author: cv007
author_rank: Frequent Contributor
timestamp: March 12, 2021, 06:36:12 am
content: Its going to be obvious if its not pulled up- your meter will either be a steady high (pullup), or it will be moving around (simply place finger on probe).By default, a pin on the 103 is floating input. You can check all the pins (you have not setup) with a meter and test the above theory. Once you know how to set a pin to input/pullup (and I guess you are confident it is working), there is really no need to be checking it again and again.

author: Chalcogenide
author_rank: Regular Contributor
timestamp: March 12, 2021, 09:13:46 am
content: An easier way would be to short each pin to ground via your multimeter set to measure current (uA or mA range). If you read a steady value of tens of uA, then your pullup works; otherwise, if the pin is just floating you will see zero current. This is better than measuring voltage as you are reading with a low impedance and thus you avoid any weird voltage reading due to floating nodes.

author: Alti
author_rank: Frequent Contributor
timestamp: March 12, 2021, 09:52:59 am
content: Quote from: Chalcogenide on March 12, 2021, 09:13:46 amAnd if the IO is driven high you damage or strain the IO drive. And if you touch adjacent Vcc then you blow the fuse.

author: techman-001
author_rank: Frequent Contributor
timestamp: March 12, 2021, 12:43:11 pm
content: Quote from: Alti on March 12, 2021, 09:52:59 amI shorted a STM32F103 gpio (low - push pull) to Vcc a couple of days ago, the blue pill board power led went out until I realized what was happening. It's a very small regulator on those boards anyway, and this one obviously went into current limit mode. It was fed by a USB cable, so then there is another regulator with current limiting, then the PC PSU, so it's a long way to the nearest fuse yet ;-)The board worked fine afterwards but if I was going to do this on purpose I'd probably put a 470 ohm resistor in series to protect everything including the multimeter.

author: Alti
author_rank: Frequent Contributor
timestamp: March 12, 2021, 02:14:52 pm
content: Quote from: techman-001 on March 12, 2021, 12:43:11 pmQuote from: STM32F103x8 Absolute Maximum RatingsQuote from: Table 7If they say that 25mA for extended periods may affect device reliability and you abused it with supply limit (200mA?) then consider it dead. Or send it to someone you dislike as atrojan horsegift.

author: Chalcogenide
author_rank: Regular Contributor
timestamp: March 12, 2021, 03:09:47 pm
content: An Aneng AN8008 uses a 100 Ohm sense resistor for its uA range, so at the very worst you could have 33 mA of current if you were to short VDD to GND (no fuse blown and everybody is happy). If you short an output pin to ground, considering the output characteristic of the IO pad, you should still end up below the absolute maximum rating anyway.Also, it is very unlikely that the IO port of a uC is able to source or sink more than 20 mA, as it will be limited by the saturation of the output mosfet.

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 14, 2021, 11:50:49 pm
content: If you want to check it in input mode, just short it and measure the current.In output mode, you can do the same thing by configuring the pin in open-drain mode and setting it to 1.It should measure around 80 uA.