SparkFun Forums 

Where electronics enthusiasts find answers.

By LexMajor
#188696
Can't work up the courage to actually post in "Projects" since I'm soooooo far off, but...

If I have a microcontroller GPIO pin that supplies 12mA max as per the datasheet, and a LED that will burn past 30mA.

I HAVE to put a resistor on it? I mean, it's only 12mA...
By lyndon
#188702
Yes.

"It's only 12mA"

They're called Absolute maximum ratings for a reason. Engineers spend a lot of time creating data sheets. Pay attention to them.
By LexMajor
#188703
Hey, I _did_ read them, no need to be condescending! :) It says "Maximum Power Drive", which means nothing to me, and for which I have not seen coherent definitions on the Internet.

That indeed comes from my very partial understanding of electronics... my (wrong) understanding was that even if I did not not put a resistor, the pin would be "capped" at supplying 12mA, well below the 30mA treshold for "burning" the LED.

So from what I am deducing from your answer is if I don't put a resistor on the circuit, the LED could end up _drawing_ more than the 12mA the pin should supply, potentially damaging it. The risk is to burn the GPIO pin, not the LED.

Did I get that right?
By uChip
#188707
Not exactly. What the GPIO spec really means is if you try to draw more than 12mA it will begin to behave out of spec. If it is a current source spec then then the voltage will likely fall below the logical high level. If it's a current sink spec then the voltage rises past the logical low. In either of those two conditions the function of the microcontroller could be compromised. That is, the output might not switch as directed, the output transistor could fail, the microcontroller could overheat or it could reset.

None of those behaviors are guaranteed to happen, but they are much more likely to happen. The point of running things within spec is that within spec the performance is guaranteed. Out of spec it's not.

Bottom line is it might work or it might not. It might work sometimes and not other times. If you built 50 instances of that circuit it might work on some of them and not others. So for any application other than pure experimentation, you are better off with the resistor.

Good luck with your projects!
- Chip
I do not work for SparkFun.
Last edited by uChip on Tue Mar 15, 2016 8:08 am, edited 1 time in total.
By LexMajor
#188708
uChip wrote:Not exactly. What the GPIO spec really means is if you try to draw more than 12mA it will begin to behave out of spec. If it is a current source spec then then the voltage will likely fall below the logical high level. If it's a current sink spec then the voltage rises past the logical low. In either of those two conditions the function of the microcontroller could be compromised. That is, the output might not switch as directed, the output transistor could fail, the microcontroller could overheat or it could reset.[...]
- Chip
I do not work for SparkFun.
That was _very_ useful, thanks Chip! :0
By lyndon
#188716
I apologize for my crabbiness. uChip gave a very good answer. Most datasheets have a section called "Absolute Maximum Ratings" or similar. Here's an excerpt from a National Semiconductor sheet that illustrates the issue very well

"Stresses beyond those listed under “absolute maximum ratings” may cause permanent damage to the device. These are stress ratings only, and
functional operation of the device at these or any other conditions beyond those indicated under “recommended operating conditions” is not
implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability."

The important thing to remember is that the engineers want you to be successful with their device, so they try to provide help where possible. It's best to follow their recommendations.

Sometimes you need to do weird stuff and you go beyond the maximums. Lots of designs do this to keep costs down at the possible expense of reliability. I don't recommend it, but then again, I do a lot of stuff I wouldn't recommend to others either :-)