GPIO Pin only triggers with less than 30 Ohm pre-resistor

Started by janosch, May 24, 2021, 11:36:42 AM

Previous topic - Next topic

janosch

Here is an odd one:

I only get a reading from my GPIO pins when I have a pre-resistor of less than 30 Ohm & 3.4V. That's nearly a short to ground.

- Did I burn the pins out previously and now they need a lot of current to still trigger them?
- What is a typical and reasonable value for a pre-resistor that should still trigger a 3.3V pin? 7k Ohm?

I am using Olimex STM32H103.

LubOlimex

Which pin exactly?

How did you put the resistor? I have no idea what is "pre-resistor", can you elaborate. Is "pre-resistor" connected pull up, pull down, or in series?
Technical support and documentation manager at Olimex

janosch

Hi,

pre-resistor before the GPIO pin (in series).

Vcc(+3.3v) --> resistor --> GPIO Pin.

Turns out it was a problem with the software I used. I configured the pins as inputs, but my configuration was overwritten from another place in the template I used. Very interesting though that the inputs still triggered if I put enough current through them.

Then it worked all fine, with 10k Ohm resistors as I expected. Yes, I also turned on the internal pull-down resistor (30k Ohm I believe).

kyrk.5

Just read the last entry, and I just share my experience:
- On a simple uC a PIN can be read at any time. Even if it is an output, in this case you will read most probably the same value as you set the pin (low or high).
- An input pin is a high impedance load, ideally it should be endless big but in a real world it is not. But it is high enough that it does not affect the line where the PIN is connected. That is why, it is not a problem if a PIN can be always read out.
- An output pin should drive the line with zero source resistance. Since in the real world it is never the case, the driver have some internal resistance. This means, that if you apply voltage externally to a pin, with also a given internal resistance, the voltage level can be changed. Based on the voltages and internal resistance it can be calculated how much. But in most cases the currents will be too high so the pin will be damaged. That is why a series resistance is a good idea.
- Often output pins are current limited. This way, connecting a low resistance load, then pin wont drive it to high or load, since the current needed for it is more than it can supply. The pin will supply most probably the maximum current but not more. So you can calculate at which voltage level it will rise.
- I wrote most probably in the beginning, because the input circuit of a PIN just checks whatever voltage on it is, and most probably compares it and then generates the high or low values for the controller. So if you applied externally a voltage, you can change the voltage levels. But this might also damage the pin or other parts of the uC.

- On some advanced uC-s a PIN can be configured more sophisticated. Like the input circuit can be enabled or disabled. Or the output drive circuit can be enabled or disabled. Slew rate can be also configured. Or it can be connected to other peripheries. The reason behind the input circuit enable is that in sleep mode maybe you not need the pin in input, so disabling the circuit will save some tiny amount of current. Be aware that on this kind of uC you need to explicitly enable the input circuit, otherwise you will read out garbage.
- One last thing. Some controllers offer to read back the actual voltage on the pin or you can read back what did you wrote in the output. As long as the pin is an output, and no short circuit is there, this will return the same value. However if a short circuit is there, or some voltage ripple when changing from low to high or back, then it might differ.