GPIO output voltage vs. output current graph
I have measured and plotted Output Voltage vs. Output Current for the GPIO pins (0, 1, 6, 7) on my Onion, and the results are shown below in spreadsheet. These are only measurements of a single Onion, so the results do not give any indication of chip-chip or lot-lot variations. Nonetheless they offer a glimpse of what you might expect (making the HUGE assumption that my Onion is representative of the "average" Onion). I have noted that my Onion's V25 node was actually reading 2.68V, so another table and graph were plotted to show the expected Output High values (Voh) for V25 = 2.5V. I hope this information is valuable to other hobbyists/designers/makers.
Thank you @jeff-verive it was very helpfull for me!
@Jeff-Verive Can we use this chart on our Hardware Info wiki page?
(Also, the board is the Omega, the company is Onion!)
Feel free to do so.
I have done some additional testing on another Omega, and the data shows these GPIO outputs have the same V/I characteristics. I'll post the data and graphs soon.
I have also done testing at levels of output current from 0-30mA, with data points at every 1mA step, which gives a higher resolution view of the V/I curves. I will also post this data and graph with datasheet values superimposed. There's a lot of useful information to be taken from the graph, so I will include my conclusions. I hope to have these posts completed in the next few days (it's a busy weekend!).
@Jeff-Verive You clearly have better test facilities than I have access to :-)
Would it be possible for you to do your tests on GPIO 12 as an output.
Both @Frederic-Baumann and I are having some issues with being able to output to GPIO 12 and don't know why - see https://community.onion.io/topic/578/issue-with-gpio-12
Thanks in advance for anything you may find.
I'll take a look at it. I've had some problems with GPIO 8 and 12, but haven't really looked into them. Maybe this will force me to delve a little deeper!
@Jeff-Verive Thanks. Note that @mark-titley and I have added some further info to https://community.onion.io/topic/578/issue-with-gpio-12
@Jeff-Verive Given your suggestion that there might be some issues with GPIO 8, I have done the same testing on GPIO 8 as I describe in https://community.onion.io/topic/578/issue-with-gpio-12
GPIO 8 appears to function as expected.
However, there is one oddity about GPIO 8 that I had noticed before and commented on some time ago without any useful response.
Specifically, there exist entries in /sys/class/gpio for gpio8 (i.e. in /sys/devices/virtual/gpio/gpio8). There are no such entries nor are they used for any other GPIO pins.
This suggests that GPIO 8 is used for something else as well but I have no idea what.
An additional graph and corresponding data for a "typical" GPIO pin are presented below:
Some comments are in order:
The Vol(measured) and Vol(measured) are plotted against the voltages as taken from the current SoC (AR9331) specification. Note that although Voh(typ) is specified at 2.4V, the actual output voltage drops below this value for output current of around 8mA. However, the measured output is always above the 0.7V Vih spec, so if the output is connected to another GPIO pin configured as an input, Voh will always be interpreted as a logical HIGH for currents up to 30mA.
For Vol, the situation is a bit more complicated. For load currents below about 4mA, the Vol is always below Vol(typ) - specified as 0.1V, but rises above it as load current increases. At about 12mA, Vol increases above the 0.3V specification for Vil, which means that if the output is connected to another GPIO pin configured as an input, it MAY not be interpreted as a logical LOW. Then if load current is increased above about 24mA, the Vol actually rises above the Vih level (0.7V). This means that for load currents above 24mA, a "LOW" Vol WILL BE interpreted as a logical HIGH if connected to a GPIO pin configured as an input.
The points to understand are this:
- the specified values of Vol and Voh are only valid for output currents of up to 4mA and 8mA respectively, and
- a GPIO pin configured as an output and set to a LOW level may not be interpreted as a LOW if connected to another GPIO pin configured as an input IF the output load current is greater than about 8mA, and it WILL be interpreted as a HIGH level for load current above about 24mA. If you are using LEDs to show the state of output pins, use current-limiting resistors. I HIGHLY recommend using low-current LEDs (LEDs that have adequate illumination at 2mA). Also realize that LEDs with forward voltage rating above 2.2V may not light up well when connected between a GPIO pin and ground. Some green and yellow LEDs (and nearly all blue and white LEDs) fall into this category.
[For the purists out there, the current values for Voh technically should be shown as negative numbers, since positive current is defined as current flowing into a node. I showed all currents in absolute values (i.e. magnitude only) to make it easier to show all of the output curves in a single quadrant for graphing ease.]
@Jeff-Verive Thanks for this - very useful.
Lesson from this is not to draw too much current from an output pin if it is also connected to an input pin :-)
Any info yet on the odd behaviour of GPIO Pin 12?