[MinnowBoard] GPIO mapping

Hay Nguonly HNguonly at ixiacom.com
Fri Sep 11 22:29:34 UTC 2015


Thanks, this is very informative, and somehow I cannot find anything on
the internet that describes the way you’ve done here.
I will look at the formula closer later, but it does make a lot of sense.

Really appreciate it, and thanks everyone for their responses…


On 9/11/15, 3:20 PM, "elinux-MinnowBoard on behalf of John 'Warthog9'
Hawley" <elinux-minnowboard-bounces at lists.elinux.org on behalf of
warthog9 at eaglescrag.net> wrote:

>On 09/11/2015 07:00 AM, Markus Maier wrote:
>> Hay Nguonly <HNguonly at ...> writes:
>>> Bill, thanks for that quick reply.
>>> Yes, that¹s where I got my example from, but I would like to know how
>>> GPIO number is derived?
>>> Is it just arbitrary picked by someone, or there is a formula for it.
>>> Thanks
>>> Hay
>> Hay,
>> see here how the numbers can be retrieved:
>> But I cannot tell you how they have originally been set.
>The GPIO mapping, under the OS (Linux in this case), is defined very
>similarly to how hard drives or network interfaces are.  The process is
>dependent on a couple of things:
>- Dynamic GPIOs under Linux start at the highest number and count down
>the available GPIOs (the GPIOs on the MAX / Turbot are dynamic)
>- The order in which the drivers get loaded on the board determine which
>bank of GPIOs starts the numbering.
>So the "formula" per-se is
>GPIO High # = 512
>for x in $( GPIO Drivers ) {
>	for y in $( Number of GPIO Chips ){
>		for z in $( Number of GPIOs on the chip ){
>			GPIO in driver defined order = GPIO High # - 1;
>		}
>	}
>This is why you may see a difference on some kernels (Ubuntu comes to
>mind as the I2C buses are backwards on that platform for sure, but I
>need to check this to be sure) where the ordering *COUlD* be different
>slightly.  This is fundamentally the same issue that SCSI disk drives,
>ethernet ports, etc have had in the past and used other mechanisms to
>make more explicit mappings.
>Does this answer your question?
>- John
>elinux-MinnowBoard mailing list
>elinux-MinnowBoard at lists.elinux.org

More information about the elinux-MinnowBoard mailing list