GPIO new map

Started by fab, March 28, 2014, 08:18:23 PM

Previous topic - Next topic

fab

Hi,

Is there any one who has an update of the GPIO map which mach the latest pyA20 1.3?
I guess many of them by blinking a LED on each PIN, but it would be less painfull to have a map giving the pinout for
PIN_PH0 PIN_PB3 PIN_PH2 PIN_PB4 PIN_PH7......

Thx
Fab

dave-at-axon

#1
The base numbers for each port are as follows. I got this from the gpiochip entry in the Android system.

A    0
B    24
C    54
D    85
E    119
F    137
G    149
H    167
I    201
S    229 (Do not use)

Then you just as the port number to these. Eg, PH12 would be 179

Hope this is what you are looking for?

fab

Many Thx Dave,

But using your table, I still do not see the relationship between PH2, which is PIN nb 7 on GPIO 3 and your table which gives PIN nb 169...
Every GPIO connector has only 40 pins, so how is it possible to have something above 40?

Sure, I am missing something but what?

Fab

dave-at-axon

The relationship is not with the 40 way connector. It's the GPIO internal numbering system.

All you have to worry about is that you are connected to PH2 for instance and that this is 169 in the gpio system.

You need to keep a map of the GPIO connector number to real world GPIO. You could create an array for this or create a class to do this. A simple 3 dimensional array would be good for this. This is assuming the use of C.

int gpioMap[3][40] = { {169, 32, 22}, {......

This is just a sample idea so the values don't mean anything. You could use -neg numbers to represent pins that don't have GPIO.

The first element in the array is the GPIO connector -1. The next is the GPIO pin -1.

Mouchon

#4
Hi,

In https://github.com/lephiloux/oa20gpiolib
There is a c function that do the mapping

May be you can just look in it

With pyA20 0.1.6 you can also specify pin as PINX_Y with X connector and Y PIN number
Regard


fab

Hi,

Quote
Hi,

In https://github.com/lephiloux/oa20gpiolib
There is a c function that do the mapping

May be you can just look in it

With pyA20 0.1.6 you can also specify pin as PINX_Y with X connector and Y PIN number
Regard

You were right. I was using 0.1.3 pyA20 which does not support the PINX_Y writing mode. Installing the 0.1.6 solved this issue.
Thx for your help.