Author Topic: What is a microcontroller's GPIO resistance? [Solved]  (Read 390 times)

0 Members and 1 Guest are viewing this topic.

Offline ballsystemlord

  • Contributor
  • Posts: 6
  • Country: us
What is a microcontroller's GPIO resistance? [Solved]
« on: September 25, 2021, 06:25:05 pm »
I'm not so new to electronics, but I am new to the transistor and micro-controller scene. I was thinking about what would happen if I hooked up a 3.3v (or in the case of my Arduino, a 5v) line to a GPIO of my STM32 micro-controller. It occurred to me that inrush current might prove to be a problem for it. I know inrush current is a problem for a MOSFET as a result of ringing (and there's got to be some kind of transistor inside the STM32/Arduino reading the logical result). (Also because of over-current output on the pin, but that's not relevant to my question because I'm asking about input-overcurrent.)

I could just stick a 1K ohm resistor onto the GPIO pin and call it a day, but I wanted to better understand the needs of my uCs.

So far, I've searched online, but I haven't found anything useful. I also tried the STM32's datasheet looking carefully at the "absolute maximum ratings" but I didn't notice anything pertinent.

What is a microcontroller's GPIO resistance?


PS: The exact models are stm32f103c8, and ATmega328.
« Last Edit: September 25, 2021, 08:47:00 pm by ballsystemlord »

Offline magic

  • Super Contributor
  • ***
  • Posts: 4793
  • Country: pl
Re: What is a microcontroller's GPIO resistance?
« Reply #1 on: September 25, 2021, 06:32:49 pm »
Resistance of logic inputs is basically unlimited; almost not DC current flows into them and if it does due to leakage, it's small and constant.

What they do have is a few pF of capacitance, typically. But the inrush current to charge that is minimal and brief.

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 5757
  • Country: fi
Re: What is a microcontroller's GPIO resistance?
« Reply #2 on: September 25, 2021, 06:34:37 pm »
Output resistance:

Roughly between 10 and 50 ohms, depending on part, unit, temperature and so on. It's also non-linear because the die locally heats up under load I^2*R, which in MOSFETs, as you may know, increases the R by the positive tempco. This happens very quickly.

It's OK for powering some very low-power loads. LEDs are the obvious typical culprits.

100nF bypass cap is, in my opinion/experience, OK, inrush currnet is theoretically high but the duration of it is short.

The result of this is that whatever you are powering from the IO pin must not try to pull significant peak currents.

Input resistance:

Nearly infinite, tens of megaohms, plus maybe some tens of pF of capacitance, not much more than a small piece of wire itself. No current flows into the input pin. HOWEVER, this only applies when the input voltage is within the voltage rails of the device (or slightly outside, like between GND-0.3V to Vcc+0.3V). Very important consideration when the device is still powered off. Otherwise, internal ESD diodes conduct, powering up the Vcc through that input. The protection diodes can take a few mA continuous, only. If the MCU itself is low-power, it may survive such abuse, i.e., being powered through IO pin protection diodes. Otherwise than that, you want to limit that protection diode current to, say, below 1mA. Then just do the Ohm's law to obtain the series resistor value you need. Do note that even just 1mA may cause the MCU to power up, boot and do Funny Things, so you may need to limit the current further.

Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo