cancel
Showing results for 
Search instead for 
Did you mean: 

What happens when GPIO is sourcing more mA than allowed?

Lars Beiderbecke
Senior III

My STM32F746 can source 25 mA per pin, but only 120 mA in total.

What happens if we exceed that amount? Will there be a brown out, will the STM32 reset, or will the STM32 get damaged?

10 REPLIES 10

There's no guarantee of what can happen. The world as we know it may come to end. Count on the worst.

(Read, any of what you wrote may happen, and possibly other things, too, e.g. temporary damage, localized damage, decreased reliability with apparently no other problem, etc. The 120mA probably has some margin built in, which may even be huge, and may depend on particular circumstances e.g. excess current duration, slew time, ambient temperature, etc.)

JW

TDK
Guru

In my experience, the MCU will limit its current output on the GPIO pin to ~25mA and no permanent damage will occur. But as noted above, it's not guaranteed to behave that way.

If you feel a post has answered your question, please click "Accept as Solution".

@TDK​ 

I believe Lars is more concerned about the cumulative current rather than individual current per pin.

Jan

OK, thanks. Because I intend to use some GPIO pins as "user interface", and I was wondering what would happen if the connected device would draw too much current. Better have some overcurrent protection then, although I don't see how I could enforce the sum limit of 120 mA.

Do not expose plain gpio's on some connector and for sure do not expect the user to respect any limits you might tell him/her.(saves you from alot of proplems later on)

Use extra hardware components to ​protect the outputs from reasonably mistakes by end user.(overcurrent, overvoltage etc)

I'd like to, but all the over-current protection ICs that I know of only have one input, so to do deal with 16 pins or 32 pins, I'd need to add an army of ICs.

Also, while that would (somehow) take care of the 25 mA limit per pin, I have no idea how I could make sure that the total sum of 120 mA is not exceeded. (Unless I limit each of the 16 pins to 120 mA / 16 = 7,5 mA.)

There's probably no bulletproof solution to this problem.

You can simply use a current limited power supply. This wouldn't protect agains excessive current *sink* (which is limited too). Or you can build some sophisticated current measurement system into the supply line (and/or ground), disconnecting supply from mcu when overcurrent occurs.

One way to tackle it would be to add a separate external buffer, and either try to protect that somehow, or just leave it as a "consumable", depending on your application.

JW

gregstm
Senior III

I would also be concerned about static electricity damage/disruption if you are giving other people direct access to GPIO pins. What will the user do with the GPIOs? Is it high speed? I would use surface mount ferrite beads (plus small capacitor) and high value resistors to protect each IO, and possibly a zig-zag track layout (through ground fill) to act as a spark gap nearest the user. (Probably best to look at what components/applications ST and Murata offer for ESD). Not recommended - but I have on occasions tested things with a piezo sparker from a gas lighter just to check for software+hardware robustness (can't afford an ESD gun).

Lars Beiderbecke
Senior III

My original idea was using a bus transceiver, which lifts the total amount of current to source. The problem is that each pin can be input or output, so the only viable option I found is a SN74AXC4T774, which offers 4 signals in any direction.

If I fix directions, a (de-)multiplexer might work.

The signals involved are of a very low frequency, probably less than 10 kHz.