Jump to content

Button connection via GPIO Header on Orange Pi 3


probrokker

Recommended Posts

I can’t get the result of a button click. The button is connected to the PD15  contact.

echo 9 > /sys/class/gpio/export   (gpio9?)

cat /sys/class/gpio/gpio9/value

every result: 0

 

Tell me what the problem is.


I also have https://github.com/orangepi-xunlong/WiringOP installed, which shows:
gpio -v

gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

   * Device tree is enabled.
   * -> OrangePi 3

gpio readall  (what Orange Pi RK3399?)

 +------+-----+----------+------+---+OrangePi RK3399---+---+------+---------+-----+--+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |      |
 |   43 |   0 |    SDA.0 | ALT4 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   44 |   1 |    SCL.0 |   IN | 0 |  5 || 6  |   |      | 0v       |     |      |
 |   64 |   2 |    GPIO4 |   IN | 1 |  7 || 8  | 0 | IN   | Tx       | 3   | 148  |
 |      |     |       0v |      |   |  9 || 10 | 0 | IN   | Rx       | 4   | 147  |
 |   80 |   5 |   GPIO17 |   IN | 1 | 11 || 12 | 1 | IN   | GPIO18   | 6   | 65   |
 |   81 |   7 |   GPIO27 |   IN | 0 | 13 || 14 |   |      | 0v       |     |      |
 |   82 |   8 |   GPIO22 | ALT2 | 1 | 15 || 16 | 0 | IN   | GPIO23   | 9   | 66   |
 |      |     |     3.3v |      |   | 17 || 18 | 1 | ALT2 | GPIO24   | 10  | 67   |
 |   39 |  11 |     MOSI | ALT3 | 0 | 19 || 20 |   |      | 0v       |     |      |
 |   40 |  12 |     MISO | ALT4 | 1 | 21 || 22 | 0 | IN   | GPIO25   | 13  | 83   |
 |   41 |  14 |     SCLK |   IN | 0 | 23 || 24 | 1 | OUT  | CS0      | 15  | 42   |
 |      |     |       0v |      |   | 25 || 26 | 0 | ALT4 | CS1      | 16  | 133  |
 |  154 |  17 |     DNP1 |   IN | 1 | 27 || 28 | 1 | OUT  | DNP2     | 18  | 50   |
 |   68 |  19 |    GPIO5 |   IN | 0 | 29 || 30 |   |      | 0v       |     |      |
 |   69 |  20 |    GPIO6 | ALT2 | 0 | 31 || 32 | 0 | IN   | GPIO12   | 21  | 76   |
 |   70 |  22 |   GPIO13 |  OUT | 1 | 33 || 34 |   |      | 0v       |     |      |
 |   71 |  23 |   GPIO19 | ALT2 | 0 | 35 || 36 | 0 | IN   | GPIO16   | 24  | 73   |
 |   72 |  25 |   GPIO26 |   IN | 1 | 37 || 38 | 1 | OUT  | GPIO20   | 26  | 74   |
 |      |     |       0v |      |   | 39 || 40 | 0 | ALT2 | GPIO21   | 27  | 75   |
 |      |     | (null) |      |   | 41 || 42 |   |      | (null) |     |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+OrangePi RK3399---+---+------+---------+-----+--+


 

button_orangepi3.png.8c241b4f13b44609f97e6773d7110485.png

Link to comment
Share on other sites

9 hours ago, probrokker said:

The button is connected to the PD15  contact.

For any AllWinner SoC, gpio numbers are calculated as follow :

gpio_number = ('bank_letter' - 'A') * 32 + number

This means that PD15 is GPIO-111, so you should do :

echo 111 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio111/direction 
cat /sys/class/gpio/gpio111/value 

 

Link to comment
Share on other sites

19 hours ago, martinayotte said:

For any AllWinner SoC, gpio numbers are calculated as follow :


gpio_number = ('bank_letter' - 'A') * 32 + number

 

 

Can you explain the variables from the formula? it’s not clear how to count.

Link to comment
Share on other sites

I have done a wiringPi type set of utilities for various Orange Pi boards including the Orange Pi 3 (H6)..

I have a zip of the binaries on my website..

 

I got tired of trying to modify the various wiringOPs out there and the armbianIO package uses the sysfs interface which can cause many problems.  My package is all register based...   Just need to add the PWM.. and then a programmer's interface for the interrupts...  All done in C++ whhch is another reason I went away from the wiringOPs...

 

I could use some help with the Port numbers for the LEDs on the Pi 3 and the PC2.. I include them in my version of "readall"...

 

Can I post a link here to my binaries....  Once I have the sources cleaned up I will put them up on github..

 

Thanks all

 

GP_screenshot.png

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