Jump to content

BananaPi (M2-Zero) GPIO


jgauthier

Recommended Posts

This may not be an 'armbian' thing at all, but if not, maybe I'll get a little direction. 

My first "image" with armbian I downloaded had some 3.4.x kernel on it.  After some learning, I was able to get GPIO to work with it.  I had some other limitations though.  So, I decided to build my own image (buster) so I could customize it.   After booting, I GPIO did not work.  I explored this, but was unable to to get it to work.  I tried a -legacy version (which was 4.x) but also,  GPIO did not work.

 

 

This is my first sunxi experience.   So, I'm not sure of the tricks used to get it to work.  Either it's broken, or there are patches/config for the kernel that I haven't made.  I just don't know what they are.    

Link to comment
Share on other sites

1 minute ago, martinayotte said:

How did you diagnose that ... (It should be pretty straight forward ...)

 

'gpio readall' on a functioning system returns the data on all 40 pins.

   +-----+-----+---------+------+---+---Pi ?---+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |  12 |   8 |   SDA.1 |  OUT | 0 |  3 || 4  |   |      | 5v      |     |     |
 |  11 |   9 |   SCL.1 |  OUT | 0 |  5 || 6  |   |      | 0v      |     |     |
 |   6 |   7 | GPIO. 7 |  OUT | 0 |  7 || 8  | 1 | OUT  | TxD     | 15  | 13  |
 |     |     |      0v |      |   |  9 || 10 | 1 | OUT  | RxD     | 16  | 14  |
 |   1 |   0 | GPIO. 0 |  OUT | 0 | 11 || 12 | 1 | OUT  | GPIO. 1 | 1   | 16  |
 |   0 |   2 | GPIO. 2 |  OUT | 1 | 13 || 14 |   |      | 0v      |     |     |
 |   3 |   3 | GPIO. 3 |  OUT | 1 | 15 || 16 | 1 | OUT  | GPIO. 4 | 4   | 15  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | OUT  | GPIO. 5 | 5   | 68  |
 |  64 |  12 |    MOSI |  OUT | 1 | 19 || 20 |   |      | 0v      |     |     |
 |  65 |  13 |    MISO |  OUT | 1 | 21 || 22 | 1 | OUT  | GPIO. 6 | 6   | 2   |
 |  66 |  14 |    SCLK |  OUT | 1 | 23 || 24 | 1 | OUT  | CE0     | 10  | 67  |
 |     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 71  |
 |  19 |  30 |   SDA.0 | ALT4 | 0 | 27 || 28 | 0 | ALT4 | SCL.0   | 31  | 18  |
 |   7 |  21 | GPIO.21 |  OUT | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   8 |  22 | GPIO.22 |  OUT | 1 | 31 || 32 | 1 | OUT  | GPIO.26 | 26  | 354 |
 |   9 |  23 | GPIO.23 |  OUT | 1 | 33 || 34 |   |      | 0v      |     |     |
 |  10 |  24 | GPIO.24 |  OUT | 1 | 35 || 36 | 1 | OUT  | GPIO.27 | 27  | 356 |
 |  17 |  25 | GPIO.25 |  OUT | 1 | 37 || 38 | 1 | OUT  | GPIO.28 | 28  | 21  |
 |     |     |      0v |      |   | 39 || 40 | 1 | OUT  | GPIO.29 | 29  | 20  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi ?---+---+------+---------+-----+-----+

 

'gpio readall' on a non-functioning system returns incorrect data on only 26 pins. Additionally, trying to change the pins, and turn them on does not work.

 +-----+-----+---------+------+---+-Model  A-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |   IN | 0 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 0 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 0 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 0 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 0 | IN   | CE1     | 11  | 7   |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model  A-+---+------+---------+-----+-----+


 

 

Link to comment
Share on other sites

6 minutes ago, jgauthier said:

'gpio readall' on a non-functioning system returns incorrect data on only 26 pins

It seems that "board autodetection" of that "gpio readall" tools is the culprit.

Don't really on it ! Or try to figure out why it is not detecting the good pinout ...

You can use GPIO directly using /sys/class/gpio, I'm pretty sure the GPIOs are all working since it is not a kernel or Armbian problem.

You can also use python library such as the one from https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

Link to comment
Share on other sites

2 hours ago, martinayotte said:

It seems that "board autodetection" of that "gpio readall" tools is the culprit.

Don't really on it ! Or try to figure out why it is not detecting the good pinout ...

You can use GPIO directly using /sys/class/gpio, I'm pretty sure the GPIOs are all working since it is not a kernel or Armbian problem.

You can also use python library such as the one from https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

Thank you!  It took a little while, but I was able to verify GPIO functionality on my board!

Some of the libraries and tools that was I was using previously (3.4) do not work, so I have to address that specifically.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines