Code Monkey home page Code Monkey logo

wiringop's Introduction

How to download wiringOP

# apt-get update
# apt-get install -y git
# git clone https://github.com/orangepi-xunlong/wiringOP.git

How to build wiringOP

# cd wiringOP
# ./build clean
# ./build 

The output of the gpio readall command

Allwinner H2+

Orange Pi Zero/R1

 +------+-----+----------+------+---+  OPi H2  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |    PWM.1 |  OFF | 0 |  7 || 8  | 0 | ALT2 | TXD.1    | 3   | 198  |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT2 | RXD.1    | 4   | 199  |
 |    1 |   5 |    RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF  | PA07     | 6   | 7    |
 |    0 |   7 |    TXD.2 | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 |  OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1    | 9   | 19   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | ALT3 | SCK.1    | 10  | 18   |
 |   15 |  11 |   MOSI.1 | ALT2 | 1 | 19 || 20 |   |      | GND      |     |      |
 |   16 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | RTS.2    | 13  | 2    |
 |   14 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 13   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PA10     | 16  | 10   |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  OPi H2  +---+------+----------+-----+------+

Allwinner H3

Orange Pi Zero Plus 2

 +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |      PA6 |  OFF | 0 |  7 || 8  | 0 | ALT2 | TXD.2    | 3   | 0    |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT2 | RXD.2    | 4   | 1    |
 |  352 |   5 |    S-SCL | ALT2 | 0 | 11 || 12 | 0 | OFF  | PD11     | 6   | 107  |
 |  353 |   7 |    S-SDA | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 |  OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1    | 9   | 19   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | ALT3 | SCL.1    | 10  | 18   |
 |   15 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   16 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | RTS.2    | 13  | 2    |
 |   14 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 13   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PD14     | 16  | 110  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+

OrangePi One/Lite/Pc/Plus/PcPlus/Plus2e

 +------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 |  OUT | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 |  OUT | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |      PA6 |  OUT | 0 |  7 || 8  | 0 | OUT  | TXD.3    | 3   | 13   |
 |      |     |      GND |      |   |  9 || 10 | 0 | OUT  | RXD.3    | 4   | 14   |
 |    1 |   5 |    RXD.2 |  OUT | 0 | 11 || 12 | 0 | OUT  | PD14     | 6   | 110  |
 |    0 |   7 |    TXD.2 |  OUT | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 |  OUT | 0 | 15 || 16 | 0 | OUT  | PC04     | 9   | 68   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OUT  | PC07     | 10  | 71   |
 |   64 |  11 |   MOSI.0 |  OUT | 0 | 19 || 20 |   |      | GND      |     |      |
 |   65 |  12 |   MISO.0 |  OUT | 0 | 21 || 22 | 0 | OUT  | RTS.2    | 13  | 2    |
 |   66 |  14 |   SCLK.0 |  OUT | 0 | 23 || 24 | 0 | OUT  | CE.0     | 15  | 67   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OUT  | PA21     | 16  | 21   |
 |   19 |  17 |    SDA.1 |  OUT | 0 | 27 || 28 | 0 | OUT  | SCL.1    | 18  | 18   |
 |    7 |  19 |     PA07 |  OUT | 0 | 29 || 30 |   |      | GND      |     |      |
 |    8 |  20 |     PA08 |  OUT | 0 | 31 || 32 | 0 | OUT  | RTS.1    | 21  | 200  |
 |    9 |  22 |     PA09 |  OUT | 0 | 33 || 34 |   |      | GND      |     |      |
 |   10 |  23 |     PA10 |  OUT | 0 | 35 || 36 | 0 | OUT  | CTS.1    | 24  | 201  |
 |   20 |  25 |     PA20 |  OUT | 0 | 37 || 38 | 0 | OUT  | TXD.1    | 26  | 198  |
 |      |     |      GND |      |   | 39 || 40 | 0 | OUT  | RXD.1    | 27  | 199  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+

Allwinner H5

Orange Pi Zero Plus

 +------+-----+----------+------+---+ ZEROPLUS +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |      PA6 |  OFF | 0 |  7 || 8  | 0 | ALT2 | TXD.1    | 3   | 198  |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT2 | RXD.1    | 4   | 199  |
 |    1 |   5 |    RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF  | PA07     | 6   | 7    |
 |    0 |   7 |    TXD.2 | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 |  OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1    | 9   | 19   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | ALT3 | SCL.1    | 10  | 18   |
 |   15 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   16 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | RTS.2    | 13  | 2    |
 |   14 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 13   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PA10     | 16  | 10   |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+ ZEROPLUS +---+------+----------+-----+------+

Orange Pi Zero Plus 2

 +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |      PA6 |  OFF | 0 |  7 || 8  | 0 | ALT2 | TXD.2    | 3   | 0    |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT2 | RXD.2    | 4   | 1    |
 |  352 |   5 |    S-SCL | ALT2 | 0 | 11 || 12 | 0 | OFF  | PD11     | 6   | 107  |
 |  353 |   7 |    S-SDA | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 |  OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1    | 9   | 19   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | ALT3 | SCL.1    | 10  | 18   |
 |   15 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   16 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | RTS.2    | 13  | 2    |
 |   14 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 13   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PD14     | 16  | 110  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+

Orange Pi Pc 2

 +------+-----+----------+------+---+  OPi PC2 +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |    PWM.1 |  OFF | 0 |  7 || 8  | 0 | OFF  | PC05     | 3   | 69   |
 |      |     |      GND |      |   |  9 || 10 | 0 | OFF  | PC06     | 4   | 70   |
 |    1 |   5 |    RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF  | PD14     | 6   | 110  |
 |    0 |   7 |    TXD.2 | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 | ALT2 | 0 | 15 || 16 | 0 | OFF  | PC04     | 9   | 68   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PC07     | 10  | 71   |
 |   15 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   16 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | ALT2 | RTS.2    | 13  | 2    |
 |   14 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 13   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PA21     | 16  | 21   |
 |   19 |  17 |    SDA.1 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.1    | 18  | 18   |
 |    7 |  19 |     PA07 |  OFF | 0 | 29 || 30 |   |      | GND      |     |      |
 |    8 |  20 |     PA08 |  OFF | 0 | 31 || 32 | 0 | ALT2 | RTS.1    | 21  | 200  |
 |    9 |  22 |     PA09 |  OFF | 0 | 33 || 34 |   |      | GND      |     |      |
 |   10 |  23 |     PA10 |  OFF | 0 | 35 || 36 | 0 | ALT2 | CTS.1    | 24  | 201  |
 |  107 |  25 |     PD11 |  OFF | 0 | 37 || 38 | 0 | ALT2 | TXD.1    | 26  | 198  |
 |      |     |      GND |      |   | 39 || 40 | 0 | ALT2 | RXD.1    | 27  | 199  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  OPi PC2 +---+------+----------+-----+------+

Orange Pi Prime

 +------+-----+----------+------+---+   PRIME  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   12 |   0 |    SDA.0 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |    6 |   2 |    PWM.1 |  OFF | 0 |  7 || 8  | 0 | OFF  | PC05     | 3   | 69   |
 |      |     |      GND |      |   |  9 || 10 | 0 | OFF  | PC06     | 4   | 70   |
 |    1 |   5 |    RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF  | PD14     | 6   | 110  |
 |    0 |   7 |    TXD.2 | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |    3 |   8 |    CTS.2 | ALT2 | 0 | 15 || 16 | 0 | OFF  | PC04     | 9   | 68   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PC07     | 10  | 71   |
 |   15 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   16 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | ALT2 | RTS.2    | 13  | 2    |
 |   14 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 13   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PC08     | 16  | 72   |
 |   19 |  17 |    SDA.1 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.1    | 18  | 18   |
 |    7 |  19 |     PA07 |  OFF | 0 | 29 || 30 |   |      | GND      |     |      |
 |    8 |  20 |     PA08 |  OFF | 0 | 31 || 32 | 0 | OFF  | PC09     | 21  | 73   |
 |    9 |  22 |     PA09 |  OFF | 0 | 33 || 34 |   |      | GND      |     |      |
 |   10 |  23 |     PA10 |  OFF | 0 | 35 || 36 | 0 | OFF  | PC10     | 24  | 74   |
 |  107 |  25 |     PD11 |  OFF | 0 | 37 || 38 | 0 | OFF  | PC11     | 26  | 75   |
 |      |     |      GND |      |   | 39 || 40 | 0 | OFF  | PC12     | 27  | 76   |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+   PRIME  +---+------+----------+-----+------+

Allwinner A64

Orange Pi Win/Winplus

 +------+-----+----------+------+---+ OPi Win  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  227 |   0 |    SDA.1 | ALT2 | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  226 |   1 |    SCL.1 | ALT2 | 0 |  5 || 6  |   |      | GND      |     |      |
 |  362 |   2 |     PL10 |  OFF | 0 |  7 || 8  | 0 | ALT2 | PL02     | 3   | 354  |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT2 | PL03     | 4   | 355  |
 |  229 |   5 |    RXD.3 | ALT2 | 0 | 11 || 12 | 0 | OFF  | PD04     | 6   | 100  |
 |  228 |   7 |    TXD.3 | ALT2 | 0 | 13 || 14 |   |      | GND      |     |      |
 |  231 |   8 |    CTS.3 |  OUT | 0 | 15 || 16 | 0 | OFF  | PL09     | 9   | 361  |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PC04     | 10  | 68   |
 |   98 |  11 |   MOSI.1 | ALT4 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   99 |  12 |   MISO.1 | ALT4 | 0 | 21 || 22 | 0 | OFF  | RTS.3    | 13  | 230  |
 |   97 |  14 |   SCLK.1 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.1     | 15  | 96   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PD06     | 16  | 102  |
 |  143 |  17 |    SDA.2 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.2    | 18  | 142  |
 |   36 |  19 |     PB04 |  OFF | 0 | 29 || 30 |   |      | GND      |     |      |
 |   37 |  20 |     PB05 |  OFF | 0 | 31 || 32 | 0 | ALT2 | RTS.2    | 21  | 34   |
 |   38 |  22 |     PB06 |  OFF | 0 | 33 || 34 |   |      | GND      |     |      |
 |   39 |  23 |     PB07 |  OFF | 0 | 35 || 36 | 0 | ALT2 | CTS.2    | 24  | 35   |
 |  101 |  25 |     PD05 |  OFF | 0 | 37 || 38 | 0 | ALT2 | TXD.2    | 26  | 32   |
 |      |     |      GND |      |   | 39 || 40 | 0 | ALT2 | RXD.2    | 27  | 33   |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+ OPi Win  +---+------+----------+-----+------+

Allwinner H6

Orange Pi 3/3 LTS

 +------+-----+----------+------+---+   OPi 3  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  122 |   0 |    SDA.0 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  121 |   1 |    SCL.0 |  OFF | 0 |  5 || 6  |   |      | GND      |     |      |
 |  118 |   2 |    PWM.0 |  OFF | 0 |  7 || 8  | 0 | OFF  | PL02     | 3   | 354  |
 |      |     |      GND |      |   |  9 || 10 | 0 | OFF  | PL03     | 4   | 355  |
 |  120 |   5 |    RXD.3 | ALT4 | 0 | 11 || 12 | 0 | OFF  | PD18     | 6   | 114  |
 |  119 |   7 |    TXD.3 | ALT4 | 0 | 13 || 14 |   |      | GND      |     |      |
 |  362 |   8 |     PL10 |  OFF | 0 | 15 || 16 | 0 | OFF  | PD15     | 9   | 111  |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PD16     | 10  | 112  |
 |  229 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |  230 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | PD21     | 13  | 117  |
 |  228 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1     | 15  | 227  |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PL08     | 16  | 360  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+   OPi 3  +---+------+----------+-----+------+

Orange Pi Lite2/OnePlus

 +------+-----+----------+------+---+  OPi H6  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  230 |   0 |    SDA.1 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  229 |   1 |    SCL.1 |  OFF | 0 |  5 || 6  |   |      | GND      |     |      |
 |  228 |   2 |     PWM1 |  OFF | 0 |  7 || 8  | 0 | OFF  | PD21     | 3   | 117  |
 |      |     |      GND |      |   |  9 || 10 | 0 | OFF  | PD22     | 4   | 118  |
 |  120 |   5 |    RXD.3 | ALT4 | 0 | 11 || 12 | 0 | OFF  | PC09     | 6   | 73   |
 |  119 |   7 |    TXD.3 | ALT4 | 0 | 13 || 14 |   |      | GND      |     |      |
 |  122 |   8 |    CTS.3 |  OFF | 0 | 15 || 16 | 0 | OFF  | PC08     | 9   | 72   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PC07     | 10  | 71   |
 |   66 |  11 |   MOSI.0 | ALT4 | 0 | 19 || 20 |   |      | GND      |     |      |
 |   67 |  12 |   MISO.0 | ALT4 | 0 | 21 || 22 | 0 | OFF  | RTS.3    | 13  | 121  |
 |   64 |  14 |   SCLK.0 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.0     | 15  | 69   |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PH03     | 16  | 227  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  OPi H6  +---+------+----------+-----+------+

Allwinner H616

Orange Pi Zero2/Zero2 LTS/Zero2 B

 +------+-----+----------+------+---+  Zero 2  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  229 |   0 |    SDA.3 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  228 |   1 |    SCL.3 |  OFF | 0 |  5 || 6  |   |      | GND      |     |      |
 |   73 |   2 |      PC9 |  OFF | 0 |  7 || 8  | 0 | ALT2 | TXD.5    | 3   | 226  |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT2 | RXD.5    | 4   | 227  |
 |   70 |   5 |      PC6 | ALT5 | 0 | 11 || 12 | 0 | OFF  | PC11     | 6   | 75   |
 |   69 |   7 |      PC5 | ALT5 | 0 | 13 || 14 |   |      | GND      |     |      |
 |   72 |   8 |      PC8 |  OFF | 0 | 15 || 16 | 0 | OFF  | PC15     | 9   | 79   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PC14     | 10  | 78   |
 |  231 |  11 |   MOSI.1 | ALT4 | 0 | 19 || 20 |   |      | GND      |     |      |
 |  232 |  12 |   MISO.1 | ALT4 | 0 | 21 || 22 | 0 | OFF  | PC7      | 13  | 71   |
 |  230 |  14 |   SCLK.1 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.1     | 15  | 233  |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PC10     | 16  | 74   |
 |   65 |  17 |      PC1 |  OFF | 0 | 27 || 28 |   |      |          |     |      |
 |  272 |  18 |     PI16 |  OFF | 0 | 29 || 30 |   |      |          |     |      |
 |  262 |  19 |      PI6 |  OFF | 0 | 31 || 32 |   |      |          |     |      |
 |  234 |  20 |     PH10 | ALT3 | 0 | 33 || 34 |   |      |          |     |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  Zero 2  +---+------+----------+-----+------+

RockChip RK3399

Orange Pi RK3399

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

Orange Pi 4/4B/4 LTS

+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
|      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
|   64 |   0 | I2C2_SDA | ALT3 | 0 |  3 || 4  |   |      | 5V       |     |      |
|   65 |   1 | I2C2_SCL | ALT3 | 0 |  5 || 6  |   |      | GND      |     |      |
|  150 |   2 |     PWM1 |   IN | 0 |  7 || 8  | 1 | ALT2 | I2C3_SCL | 3   | 145  |
|      |     |      GND |      |   |  9 || 10 | 1 | ALT2 | I2C3_SDA | 4   | 144  |
|   33 |   5 | GPIO1_A1 |   IN | 0 | 11 || 12 | 1 | IN   | GPIO1_C2 | 6   | 50   |
|   35 |   7 | GPIO1_A3 |  OUT | 0 | 13 || 14 |   |      | GND      |     |      |
|   92 |   8 | GPIO2_D4 |  OUT | 1 | 15 || 16 | 0 | IN   | GPIO1_C6 | 9   | 54   |
|      |     |     3.3V |      |   | 17 || 18 | 0 | IN   | GPIO1_C7 | 10  | 55   |
|   40 |  11 | SPI1_TXD | ALT2 | 1 | 19 || 20 |   |      | GND      |     |      |
|   39 |  12 | SPI1_RXD | ALT2 | 1 | 21 || 22 | 0 | IN   | GPIO1_D0 | 13  | 56   |
|   41 |  14 | SPI1_CLK | ALT3 | 1 | 23 || 24 | 1 | ALT3 | SPI1_CS  | 15  | 42   |
|      |     |      GND |      |   | 25 || 26 | 0 | IN   | GPIO4_C5 | 16  | 149  |
|   64 |  17 | I2C2_SDA | ALT3 | 0 | 27 || 28 | 0 | ALT3 | I2C2_SCL | 18  | 65   |
|      |     |  I2S0_RX |      |   | 29 || 30 |   |      | GND      |     |      |
|      |     |  I2S0_TX |      |   | 31 || 32 |   |      | I2S_CLK  |     |      |
|      |     | I2S0_SCK |      |   | 33 || 34 |   |      | GND      |     |      |
|      |     | I2S0_SI0 |      |   | 35 || 36 |   |      | I2S0_SO0 |     |      |
|      |     | I2S0_SI1 |      |   | 37 || 38 |   |      | I2S0_SI2 |     |      |
|      |     |      GND |      |   | 39 || 40 |   |      | I2S0_SI3 |     |      |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+

wiringop's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wiringop's Issues

Not working on PC 2?

After installation:

root@OrangePi:~# 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.
--> Xunlong Orange Pi PC 2

My test code:

#include <wiringPi.h>
int main()
{
wiringPiSetup();
pinMode(5, INPUT);
while(1)
{
delay(100);
printf("%d", digitalRead(5));
}
return 0;
}

Compiled and ran, no any outputs.

root@OrangePi:~# gpio readall
+------+-----+----------+------+---+OrangePi RK3399---+---+------+---------+-----+--+

Why RK3399 but not H5?

Many problems with Orange Pi 4 (pwm, writePin)

My task is to implement a cooling system. For this I use a laptop fan that has PWM control.
I apologize in advance for my text, I am from Russia and I use a translator.

My system and parameters.
root@orangepi4:~/123# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
root@orangepi4:~/123# uname -a Linux orangepi4 5.10.10-rockchip64 #trunk.77 SMP PREEMPT Mon Jan 25 13:52:10 CET 2021 aarch64 aarch64 aarch64 GNU/Linux
root@orangepi4:~/123# cat /proc/version
Linux version 5.10.10-rockchip64 (root@beast) (aarch64-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #trunk.77 SMP PREEMPT Mon Jan 25 13:52:10 CET 2021

wiringPi downloaded and assembled gihub from this section.
root@orangepi4:~/123# 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 4

root@orangepi4:~/123# gpio readall

image

I will be working with hardware pin 11 (wiringPi pin 5 or GPIO pin 33). It is currently in input mode. My first action was to try to test the work through the console.
gpio mode 5 out
gpio readall

image

As we can see, the desired pin is switched to OUT mode. I give it the value 1 with the command
gpio write 5 1
gpio readall

image

The pin value changed and my fan started working. Disabling also works if set to 0. Now I'm trying to accomplish the same with the simplest C code.

#include <wiringPi.h>
#include <softPwm.h>
#include <stdio.h>
#include <math.h>
#define GPIO1 33
int main(int argc, char *argv[]) {
if (wiringPiSetupGpio() < 0) return 1;
pinMode(GPIO1, OUTPUT);
digitalWrite(GPIO1, HIGH);
printf("Set HIGH\n");
}

This code initializes pin 33 (Since it uses GPIO, which is equivalent to 5 wiringPi Pin). Sets the value to HIGH and displays a message. Before compiling it, I will transfer my pin to the INPUT mode for clarity of the performance of one function.

image

Now let's create test.c I will compile it with the command
gcc -o test test.c -lwiringPi -lm -pthread -lrt -lcrypt
and execute it with the command
sudo ./test
gpio readall

image

As we can see, our pin went into input mode, but the value is not set. I tried initially to write the command without including sudo, it also does not help, tried reinstalling the library, it does not give any result. I also wanted to test the functionality of wiringPi-Python, but got problems with the installation (many errors on both python2 and python3 versions).

Another problem, pin 7 (wiringPi pin 2 or GPIO pin 150), as far as I understand, has a hardware PWM pin according to the instructions and I also found an article in which it was used as I planned. https://forum.armbian.com/topic/13753-orangepi-4-temperature-controlled-pwm-fan/

I just checked the instructions from that site and that PWM use case will work on my fan as well. I think orange pi 4 has hardware pwm.

image

But when I try to switch the pin to PWM mode, I get an error and I cannot implement this functionality.
gpio mode 5 pwm

image

Accordingly, I cannot implement softPwm either, because the function also does not work like digitalWrite. Could you please fix the library code and add hardware pwm support if possible on my board.

Zero 2H+ support?

Clean system, installation errors:

pi@orangepizero:~$ git clone https://github.com/orangepi-xunlong/wiringOP.git ; cd wiringOP ; ./build clean ; ./build
Cloning into 'wiringOP'...
remote: Enumerating objects: 243, done.
remote: Counting objects: 100% (243/243), done.
remote: Compressing objects: 100% (183/183), done.
remote: Total 484 (delta 176), reused 105 (delta 57), pack-reused 241
Receiving objects: 100% (484/484), 357.56 KiB | 243.00 KiB/s, done.
Resolving deltas: 100% (284/284), done.
wiringPi:   [Clean]
DevLib:     [Clean]
gpio:       [Clean]
Examples:   [Clean]
Gertboard:  [Clean]
PiFace:     [Clean]
Quick2Wire: [Clean]
PiGlow:     [Clean]
scrollPhat: [Clean]
Deb:
wiringPi Build script
=====================


WiringPi Library
[sudo] password for pi:
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
pcf8591.c: In function ‘myAnalogWrite’:
pcf8591.c:44:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   44 |   write (node->fd, b, 2) ;
      |   ^~~~~~~~~~~~~~~~~~~~~~
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] ads1115.c
mcp3422.c: In function ‘waitForConversion’:
mcp3422.c:50:5: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
   50 |     read (fd, buffer, n) ;
      |     ^~~~~~~~~~~~~~~~~~~~
[Compile] sn3218.c
[Compile] bmp180.c
[Compile] htu21d.c
[Compile] ds18b20.c
[Compile] rht03.c
[Compile] drcSerial.c
[Compile] drcNet.c
[Compile] pseudoPins.c
[Compile] wpiExtensions.c
[Compile] w25q64.c
[Compile] oled.c
drcNet.c: In function ‘authenticate’:
drcNet.c:112:24: warning: ‘%s’ directive writing up to 1023 bytes into a region of size 1021 [-Wformat-overflow=]
   89 |       return &buf [10] ;
      |              ~~~~~~~~~
......
  112 |   sprintf (salted, "$6$%s$", challenge) ;
      |                        ^~
In file included from /usr/include/stdio.h:867,
                 from drcNet.c:25:
/usr/include/arm-linux-gnueabihf/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 5 and 1028 bytes into a destination of size 1024
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Compile] OrangePi.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] scrollPhat.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
[Compile] readall.c
[Compile] OrangePi.c
gpio.c: In function ‘doVersion’:
gpio.c:1431:7: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
 1431 |       fgets (name, 80, fd) ;
      |       ^~~~~~~~~~~~~~~~~~~~
gpio.c: In function ‘doLoad’:
gpio.c:312:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  312 |     system (cmd) ;
      |     ^~~~~~~~~~~~
gpio.c:318:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  318 |     system (cmd) ;
      |     ^~~~~~~~~~~~
gpio.c: In function ‘doUnLoad’:
gpio.c:372:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  372 |     system (cmd) ;
      |     ^~~~~~~~~~~~
gpio.c:378:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  378 |     system (cmd) ;
      |     ^~~~~~~~~~~~
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringPi, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

pi@orangepizero:~/wiringOP$

Armbian is missing constants for wiringOP

When I try to compile this with Armbian I get the following errors:

In file included from wiringPi.c:81:
wiringPi.c: In function ‘piBoardId’:
OrangePi.h:194:28: error: ‘MEM_INFO’ undeclared (first use in this function)
  194 | #define ORANGEPI_MEM_INFO  MEM_INFO
      |                            ^~~~~~~~
wiringPi.c:953:24: note: in expansion of macro ‘ORANGEPI_MEM_INFO’
  953 |                 *mem = ORANGEPI_MEM_INFO;
      |                        ^~~~~~~~~~~~~~~~~
OrangePi.h:194:28: note: each undeclared identifier is reported only once for each function it appears in
  194 | #define ORANGEPI_MEM_INFO  MEM_INFO
      |                            ^~~~~~~~
wiringPi.c:953:24: note: in expansion of macro ‘ORANGEPI_MEM_INFO’
  953 |                 *mem = ORANGEPI_MEM_INFO;
      |                        ^~~~~~~~~~~~~~~~~
wiringPi.c: In function ‘pinModeAlt’:
OrangePi.h:192:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  192 | #define PI_GPIO_MASK       (~(GPIO_NUM - 1))
      |                               ^~~~~~~~
wiringPi.c:1353:28: note: in expansion of macro ‘PI_GPIO_MASK’
 1353 |                 if ((pin & PI_GPIO_MASK) == 0) {
      |                            ^~~~~~~~~~~~
[Compile] softTone.c
wiringPi.c: In function ‘pinMode’:
OrangePi.h:192:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  192 | #define PI_GPIO_MASK       (~(GPIO_NUM - 1))
      |                               ^~~~~~~~
wiringPi.c:1417:28: note: in expansion of macro ‘PI_GPIO_MASK’
 1417 |                 if ((pin & PI_GPIO_MASK) == 0) {
      |                            ^~~~~~~~~~~~
[Compile] mcp23008.c
wiringPi.c: In function ‘pullUpDnControl’:
OrangePi.h:192:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  192 | #define PI_GPIO_MASK       (~(GPIO_NUM - 1))
      |                               ^~~~~~~~
wiringPi.c:1538:14: note: in expansion of macro ‘PI_GPIO_MASK’
 1538 |   if ((pin & PI_GPIO_MASK) == 0)                // On-Board Pin
      |              ^~~~~~~~~~~~
wiringPi.c: In function ‘digitalRead’:
OrangePi.h:192:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  192 | #define PI_GPIO_MASK       (~(GPIO_NUM - 1))
      |                               ^~~~~~~~
wiringPi.c:1576:30: note: in expansion of macro ‘PI_GPIO_MASK’
 1576 |                   if ((pin & PI_GPIO_MASK) == 0) {
      |                              ^~~~~~~~~~~~
wiringPi.c: In function ‘digitalWrite’:
OrangePi.h:192:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  192 | #define PI_GPIO_MASK       (~(GPIO_NUM - 1))
      |                               ^~~~~~~~
wiringPi.c:1675:28: note: in expansion of macro ‘PI_GPIO_MASK’
 1675 |                 if ((pin & PI_GPIO_MASK) == 0) {
      |                            ^~~~~~~~~~~~
[Compile] mcp23016.c
wiringPi.c: In function ‘pwmWrite’:
OrangePi.h:189:28: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  189 | #define MAX_PIN_NUM        GPIO_NUM
      |                            ^~~~~~~~
wiringPi.c:1755:15: note: in expansion of macro ‘MAX_PIN_NUM’
 1755 |     if (pin < MAX_PIN_NUM) // On-Board Pin needto fix me Jim
      |               ^~~~~~~~~~~
wiringPi.c: In function ‘wiringPiSetup’:
OrangePi.h:193:28: error: ‘GPIOA_BASE’ undeclared (first use in this function); did you mean ‘GPIO_BASE’?
  193 | #define GPIO_BASE          GPIOA_BASE
      |                            ^~~~~~~~~~
wiringPi.c:2413:93: note: in expansion of macro ‘GPIO_BASE’
 2413 |         gpio = (uint32_t *)mmap(0, BLOCK_SIZE * 10, PROT_READ | PROT_WRITE, MAP_SHARED, fd, GPIO_BASE);
      |                                                                                             ^~~~~~~~~
OrangePi.h:195:36: error: ‘GPIO_PWM_OP’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
  195 | #define GPIO_PWM                   GPIO_PWM_OP
      |                                    ^~~~~~~~~~~
wiringPi.c:2420:85: note: in expansion of macro ‘GPIO_PWM’
 2420 |         pwm = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_PWM) ;
      |                                                                                     ^~~~~~~~
make: *** [Makefile:159: wiringPi.o] Error 1

Going to assume some of these are missing in the Armbian headers... any chances you could contribute them?

wiringOP uninstall

Please update readme. Please add information how to uninstall wiringOP.

P.S. ./build uninstall

Support for the Orange Pi 3g-iot.

Hello, would it be possible to integrate this library for the Orange PI 3g-iot board? I understand that you have to make a new driver for MT6572. But I have no experience in this field.

Thanks

Orange pi 4B build err multiple definition of 'comDat'; drcNet.o

I try build wiringPi for Orange pi 4B on Ubuntu 20 with GCC 10.2 but
multiple definition of 'comDat'; drcNet.o:(.bss+0x400): first defined here

This is because drcNetCmd.h

  1. Need #pragma once
  2. Need typedef for struct. This is right code:
    typedef struct drcNetComStruct
    {
    uint32_t pin ;
    uint32_t cmd ;
    uint32_t data ;
    } comDat ;

make error

uname -a:
Linux OrangePI 3.10.65 #3 SMP PREEMPT Tue Nov 15 09:46:50 CST 2016 aarch64 GNU/Linux c

/etc/issue:
Raspbian GNU/Linux 8 \n \l

make error:
OrangePi.h:139:23: error: ‘GPIO_PWM_OP’ undeclared (first use in this function)
#define GPIO_PWM GPIO_PWM_OP

hardware: orange pc 2

look like pc2 not define GPIO_PWM_OP in it's '#ifdef'


#ifdef CONFIG_ORANGEPI_PC2
/************** OrangePi H5 ***********************/
#define GPIOA_BASE (0x01C20000)
#define GPIO_NUM (0x40)
#define GPIO_BASE_MAP (0x01C20800)
#define MEM_INFO (1024)
#define GPIOL_BASE (0x01F02c00)
#define GPIOL_BASE_MAP (0x01F02000)
#define MAP_SIZE_L (4096 * 2)
#endif

`cp gpio /usr/local/bin` in Makefile?

Today I just build wiringOP for Orange Pi lite to test it out.
build command ended with:

.
.
.
GPIO Utility
[Compile] gpio.c
[Compile] readall.c
[Compile] OrangePi.c
[Link]
[Install]
chown: cannot access '/usr/local/bin/gpio': Not a directory
make: *** [Makefile:211: install] Error 1

then I checked and findout my /usr/local/bin directory has been replaced with a executable file.

~/wiringOP$ file /usr/local/bin
/usr/local/bin: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=bcc011c726f62c44f2ac6e89a53c166080131be6, not stripped

further investigation shown, there is a bug in gpio/Makefile line 210 which replace /usr/loca/bin/ with gpio binary which just compiled.

.
.
.
install: gpio
        $Q echo "[Install]"
        $Q cp gpio              $(DESTDIR)$(PREFIX)/bin
ifneq ($(WIRINGPI_SUID),0)
.
.
.

and symptoms also prove this:

~/wiringOP$ md5sum gpio/gpio /usr/local/bin
2e1fe3bab8acb83bd1d7c0d95ac4182e  gpio/gpio
2e1fe3bab8acb83bd1d7c0d95ac4182e  /usr/local/bin

Support for building deb packages

The original wiringPi library has support for building deb packages and a lot of that code seems to still be included, but it doesn't work currently (due to path name issues). I can make a PR to support this again through ./build debian. This would be great so people can just build a deb package once (for armbian for instance), and distribute that. I won't maintain official deb packages, but at least building them will be easy.

Orange Pi One Plus wiringPiISR not working

When using c++ wiringPiISR() I get this error (even using root)

gpio: Unable to open GPIO edge interface for pin 0: Permission denied
wiringPiISR: unable to open /sys/class/gpio/gpio229/value: No such file or directory

here is my code

#include <wiringPi.h>

int main()
{
wiringPiSetup();

    wiringPiISR(1, INT_EDGE_FALLING, []() {
    });

    return 0;

}

OrangePi5 编译报错(Next分支)

➜  wiringOP git:(next) ./build clean
wiringPi:   [Clean]
DevLib:     [Clean]
gpio:       [Clean]
Examples:   [Clean]
Gertboard:  [Clean]
PiFace:     [Clean]
Quick2Wire: [Clean]
PiGlow:     [Clean]
scrollPhat: [Clean]
Deb: 
➜  wiringOP git:(next) ./build      
wiringPi Build script
=====================


WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] ads1115.c
[Compile] sn3218.c
[Compile] bmp180.c
[Compile] htu21d.c
[Compile] ds18b20.c
[Compile] rht03.c
[Compile] drcSerial.c
[Compile] drcNet.c
[Compile] pseudoPins.c
[Compile] wpiExtensions.c
pseudoPins.c: In function ‘myAnalogRead’:
pseudoPins.c:50:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   50 |   int *ptr   = (int *)node->data0 ;
      |                ^
pseudoPins.c: In function ‘myAnalogWrite’:
pseudoPins.c:59:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   59 |   int *ptr   = (int *)node->data0 ;
      |                ^
pseudoPins.c: In function ‘pseudoPinsSetup’:
pseudoPins.c:89:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   89 |   node->data0 = (unsigned int)ptr ;
      |                 ^
[Compile] w25q64.c
[Compile] oled.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] scrollPhat.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
[Compile] readall.c
gpio.c: In function ‘doUsbP’:
gpio.c:944:25: warning: unused parameter ‘argc’ [-Wunused-parameter]
  944 | static void doUsbP (int argc, char *argv [])
      |                     ~~~~^~~~
gpio.c:944:37: warning: unused parameter ‘argv’ [-Wunused-parameter]
  944 | static void doUsbP (int argc, char *argv [])
      |                               ~~~~~~^~~~~~~
readall.c:1099:13: warning: ‘piPlusReadall’ defined but not used [-Wunused-function]
 1099 | static void piPlusReadall (int model)
      |             ^~~~~~~~~~~~~
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringPi, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

➜  wiringOP git:(next) 

gcc can't compile blink example in Orange Pi Zero

Trying to compile the example blink.c to the Orange Pi Zero:
Captura-de-tela-de-2021-12-10-12-24-22.png

This is what I get from gcc:

root@orangepizero:~/blink# gcc main.c -o blink -lwiringPi -lwiringPiDev
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `crypt'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `rint'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `pthread_join'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `pthread_create'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `pow'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `shm_open'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../libwiringPi.so: undefined reference to `pthread_cancel'
collect2: error: ld returned 1 exit status

GPIO failure on orange pi 4 (RK3399)

Hello,

Only gpio 50 (gpio1_c2) work
Screenshot_20201209_085104

For example i can't declare gpio 35 (gpio1_a3)
GPIO 149 (gpio4_c5 ) can be declared but it's stay on 0 state when i push a button.

Can you see that ?

Thanks you 👍

Control Fan with orange pi3 lts

Hi everyone! i am an owner of orange pi 3 LTS, i am doing very well, however i can't figure out how to create a script to be able to command the activation of the cooling fan. the problem is really in the code and how should i use it... i have found so many guides on how to use it for raspberry but not how to use it on orange pi3lts. can anyone help me? Thank you very much
P.S. i use it as a home assistant server included in a docker.

Orange Pi Zero Plus and relay functionality issue:

Hello,

I have problem with "Orange Pi Zero Plus" and functionality of Relay module (electrical circuit= normally closed).
Relay module is attached on pin/port number "0".
When I set up pin number "0" from "OFF" to "OUT" state with command:

gpio export 0 out

state is changed from OFF to OUT and parameter in column "V"  is "0". It should mean that relay stays turned of.

+------+-----+----------+------+---+
| GPIO | wPi |   Name   | Mode | V |
+------+-----+----------+------+---+
|   12 |   0 |    SDA.0 |  OUT | 0 |

Problem is, that relay immediately after execution of mentioned command enables(turns on) output electrical circuit. Relay module is behaving like it was turned on, however it is not supposed to be (since 0= turned off). 

I can change this inconvenient situation with command for turning on (1=turned on) and output is then turned off.  These commands work, but they work in reversed way and in result everything works reversed. 

gpio write 0 1

gpio write 0 0 >>> should turn off output circuit, for me it turns circuit ON

gpio write 0 1 >>> should turn on output circuit, for me it turns circuit OFF

I hope this was clear, it is hard to describe what is happening. 

Can anyone please advise me on what is going wrong and how to fix my issue?

Thank you

Access gpios without root access

Hey,
I have tested wiringOP on armbian running on an orange pi zero LTS. I tried to access GPIOs as a non-root user but can't seem to do so.

wiringPiSetup: Unable to open /dev/mem or /dev/gpiomem: No such file or directory.
  Aborting your program because if it can not access the GPIO
  hardware then it most certianly won't work
  Try running with sudo?

Running user space software with sudo is clearly not what I want.
I tried already adding the group gpio and adding the user to that. I also changed permissions of /dev/mem from

crw-r----- 1 root kmem 1, 1 Nov  3 16:59 /dev/mem

to

crw-rw---- 1 root gpio 1, 1 Nov  3 16:59 /dev/mem

as I read in some post but that also didn't fix it.
So how can I fix this?

Can't identify OPi Lite properly

Hardware: Orange Pi Lite
OS: Armbian Buster/Focal
OPi Lite has an H3+ CPU and 40-Pin GPIO, however native-compiled wiringOP treated it as H6 and show a 26-Pin layout when using gpio readall. Is that a bug?

 +------+-----+----------+------+---+  OPi H6  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  230 |   0 |    SDA.1 |   IN | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  229 |   1 |    SCL.1 |   IN | 0 |  5 || 6  |   |      | GND      |     |      |
 |  228 |   2 |     PWM1 |   IN | 0 |  7 || 8  | 0 | IN   | PD21     | 3   | 117  |
 |      |     |      GND |      |   |  9 || 10 | 0 | IN   | PD22     | 4   | 118  |
 |  120 |   5 |    RXD.3 |   IN | 0 | 11 || 12 | 0 | IN   | PC09     | 6   | 73   |
 |  119 |   7 |    TXD.3 |   IN | 0 | 13 || 14 |   |      | GND      |     |      |
 |  122 |   8 |    CTS.3 |   IN | 0 | 15 || 16 | 0 | IN   | PC08     | 9   | 72   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | IN   | PC07     | 10  | 71   |
 |   66 |  11 |   MOSI.0 |   IN | 0 | 19 || 20 |   |      | GND      |     |      |
 |   67 |  12 |   MISO.0 |   IN | 0 | 21 || 22 | 0 | IN   | RTS.3    | 13  | 121  |
 |   64 |  14 |   SCLK.0 |   IN | 0 | 23 || 24 | 0 | IN   | CE.0     | 15  | 69   |
 |      |     |      GND |      |   | 25 || 26 | 0 | IN   | PH03     | 16  | 227  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  OPi H6  +---+------+----------+-----+------+

OrangePi3 H6 Support?

any plan for development? Armbian community is working aggressively on OPi3 for general usage and it is being promoted. It will be a nice add-on to OPi3

Using multiple spi devices

Im WiringPiSPI.c I see you can specify the spi channel, where 0 corresponds to /dev/spidev0.0 and 1 corresponds to /dev/spidev1.0. But on at least the orangePi Zero, you can enable multiple chipselect pins in the dtb overlays. I have managed to also add /dev/spidev1.1 and /dev/spidev1.2. How can I use those spi devices? If there is no way to do this currently, would it be an idea to add a port option (aside from the channel) defaulting to 0 which allows using channel.port for the spi device? I'd be happy to create a PR for this.

GPIO mode differs from example. Can't change.

I struggle enabling I2C on OPI4B. i2cdetect won't detect anything.
So far, only noticed that in example of this library SDA/SCL are in ALT3 mode, but in my case, those are IN.

README.md

+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
|      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
|   64 |   0 | I2C2_SDA | ALT3 | 0 |  3 || 4  |   |      | 5V       |     |      |
|   65 |   1 | I2C2_SCL | ALT3 | 0 |  5 || 6  |   |      | GND      |     |      |
|  150 |   2 |     PWM1 |   IN | 0 |  7 || 8  | 1 | ALT2 | I2C3_SCL | 3   | 145  |
|      |     |      GND |      |   |  9 || 10 | 1 | ALT2 | I2C3_SDA | 4   | 144  |

Actual: ./gpio/gpio readall

 +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |   64 |   0 | I2C2_SDA |   IN | 1 |  3 || 4  |   |      | 5V       |     |      |
 |   65 |   1 | I2C2_SCL |   IN | 1 |  5 || 6  |   |      | GND      |     |      |
 |  150 |   2 |     PWM1 | ALT2 | 1 |  7 || 8  | 1 | ALT2 | I2C3_SCL | 3   | 145  |
 |      |     |      GND |      |   |  9 || 10 | 1 | ALT2 | I2C3_SDA | 4   | 144  |

It it okay this way? What does this mean?

I can't change it to ALT3 to check if it's related in any way, gpio fails with SegFault

zero-plus-h5 cannot use PWM

官方例程里面的pwm.c运行结果
我的板子是zeroplus h5 查看用户手册发现pwm1是第7脚,然后运行结果就是这样的,pin为6或者7都不行
the pin you choose is not surport hardware PWM
you can select PI3 for PWM pin
or you can use it in softPwm mode
please use soft pwmmode or choose PWM pin

Orange pi Zero

Hi
Is it required to define a value 'PLATFORM' as 'OrangePi_ZERO' in Makefile.
Or required to define an env variable 'PLATFORM' in shell.

Please look at line 47 of "wiringOP/gpio/Makefile" and
line 54 in "wiringOP/wiringPi/Makefile"

regards

orange pi i96 support?

How to install on i96?

All available boards:
0. OrangePi_PC2

  1. OrangePi_A64
  2. OrangePi_ZERO
  3. OrangePi_H3
  4. OrangePi_LITE2
  5. OrangePi_H3_ZEROPLUS2
  6. OrangePi_3
  7. OrangePi_RK3399
  8. OrangePi_ONEPLUS
    Choice:

Orange PI Zero PUD DOWN/UP not working

I noticed the problem with PUD DOWN/UP when I used this library wiringOP with my Orange PI Zero. I wanted to create panel with buttons and I used GPIO pins with mode INPUT. But I noticed pins have random state and it's really not good for buttons, because I can't read normal state 0 or 1 when button pressed or not. So I checked this one https://github.com/xpertsavenue/WiringOP-Zero and now all good. As I understood from wiringOP removed maybe needed code.

Build fails on Orange PI Zero 2 (official debian image)

Build fails on Orange PI Zero 2 (official debian image, latest updates):

[Compile] wpiExtensions.c [Compile] w25q64.c [Compile] oled.c [Compile] OrangePi.c [Link (Dynamic)] /usr/bin/ld: wpiExtensions.o:(.bss+0x408): multiple definition of 'comDat'; drcNet.o:(.bss+0x400): first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:147: libwiringPi.so.2.46] Error 1

`libwiringPi.so` failed to link to required libraries

For users of wiringPi, they should only link to libwiringPi.so, and be oblivious of indirect dependencies(-lrc -lpthread -lcrypt)

But libwiringPi.so are not correctly linked:

$ ldd libwiringPi.so
        linux-vdso.so.1 (0x0000007f96694000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f964b0000)
        /lib/ld-linux-aarch64.so.1 (0x0000007f96664000)

The error results from

$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)

$(LIBS) should be placed after $(OBJ)

Not able to access PWM on Orange pi Zero 2 (Ubuntu)

I have changed Linux configuration as described in the user manual (created a script orangepi-add-overlay and disabled UART5). Now I am able to change PWM1 from command line:

root@orangepi:~# echo 1 > /sys/class/pwm/pwmchip0/export
root@orangepi:~# echo 100000 > /sys/class/pwm/pwmchip0/pwm1/period
root@orangepi:~# echo 20000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle
root@orangepi:~# echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable

But when I try to call:

    if (wiringPiSetup() == -1)
        exit (1) ;
    pinMode(4, PWM_OUTPUT);

I am getting an error the pin you choose doesn't support hardware PWM. you can select wiringPi pin 42 for PWM pin.

I tried all the pins from 0 to 40 - getting the same error.

If I try pin 42 - I am getting the pin:-1 is invaild,please check it over!

When calling gpio readall I see that I have to use pin 4 (Physical 10).

 +------+-----+----------+------+---+  Zero 2  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  229 |   0 |    SDA.3 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  228 |   1 |    SCL.3 |  OFF | 0 |  5 || 6  |   |      | GND      |     |      |
 |   73 |   2 |      PC9 |  OFF | 0 |  7 || 8  | 0 | OFF  | TXD.5    | 3   | 226  |
 |      |     |      GND |      |   |  9 || 10 | 0 | ALT4 | RXD.5    | 4   | 227  |
 |   70 |   5 |      PC6 | ALT5 | 0 | 11 || 12 | 0 | OFF  | PC11     | 6   | 75   |
 |   69 |   7 |      PC5 | ALT5 | 0 | 13 || 14 |   |      | GND      |     |      |
 |   72 |   8 |      PC8 |  OFF | 0 | 15 || 16 | 0 | OFF  | PC15     | 9   | 79   |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PC14     | 10  | 78   |
 |  231 |  11 |   MOSI.1 | ALT4 | 0 | 19 || 20 |   |      | GND      |     |      |
 |  232 |  12 |   MISO.1 | ALT4 | 0 | 21 || 22 | 0 | OFF  | PC7      | 13  | 71   |
 |  230 |  14 |   SCLK.1 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.1     | 15  | 233  |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PC10     | 16  | 74   |
 |   65 |  17 |      PC1 |  OFF | 0 | 27 || 28 |   |      |          |     |      |
 |  272 |  18 |     PI16 |  OFF | 0 | 29 || 30 |   |      |          |     |      |
 |  262 |  19 |      PI6 |  OFF | 0 | 31 || 32 |   |      |          |     |      |
 |  234 |  20 |     PH10 | ALT3 | 0 | 33 || 34 |   |      |          |     |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  Zero 2  +---+------+----------+-----+------+

Orange Pi Bionic with Linux 5.4.27-sunxi problem with ./build script

root@orangepizerolts:~/WiringOP# ./build
wiringPi Build script

WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
In file included from wiringPi.c:81:0:
wiringPi.c: In function ‘piBoardId’:
OrangePi.h:140:28: error: ‘MEM_INFO’ undeclared (first use in this function); did you mean ‘EMLINK’?
#define ORANGEPI_MEM_INFO MEM_INFO
^
wiringPi.c:945:10: note: in expansion of macro ‘ORANGEPI_MEM_INFO’
*mem = ORANGEPI_MEM_INFO;
^~~~~~~~~~~~~~~~~
OrangePi.h:140:28: note: each undeclared identifier is reported only once for each function it appears in
#define ORANGEPI_MEM_INFO MEM_INFO
^
wiringPi.c:945:10: note: in expansion of macro ‘ORANGEPI_MEM_INFO’
*mem = ORANGEPI_MEM_INFO;
^~~~~~~~~~~~~~~~~
wiringPi.c: In function ‘pinModeAlt’:
OrangePi.h:138:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define PI_GPIO_MASK ((GPIO_NUM - 1))
^
wiringPi.c:1339:14: note: in expansion of macro ‘PI_GPIO_MASK’
if ((pin & PI_GPIO_MASK) == 0) // On-board pin
^~~~~~~~~~~~
wiringPi.c: In function ‘pinMode’:
OrangePi.h:138:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define PI_GPIO_MASK (
(GPIO_NUM - 1))
^
wiringPi.c:1374:14: note: in expansion of macro ‘PI_GPIO_MASK’
if ((pin & PI_GPIO_MASK) == 0) {
^~~~~~~~~~~~
wiringPi.c: In function ‘pullUpDnControl’:
OrangePi.h:138:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define PI_GPIO_MASK ((GPIO_NUM - 1))
^
wiringPi.c:1495:14: note: in expansion of macro ‘PI_GPIO_MASK’
if ((pin & PI_GPIO_MASK) == 0) // On-Board Pin
^~~~~~~~~~~~
wiringPi.c: In function ‘digitalRead’:
OrangePi.h:138:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define PI_GPIO_MASK (
(GPIO_NUM - 1))
^
wiringPi.c:1533:16: note: in expansion of macro ‘PI_GPIO_MASK’
if ((pin & PI_GPIO_MASK) == 0) {
^~~~~~~~~~~~
wiringPi.c: In function ‘digitalWrite’:
OrangePi.h:138:31: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define PI_GPIO_MASK (~(GPIO_NUM - 1))
^
wiringPi.c:1632:14: note: in expansion of macro ‘PI_GPIO_MASK’
if ((pin & PI_GPIO_MASK) == 0) {
^~~~~~~~~~~~
wiringPi.c: In function ‘pwmWrite’:
OrangePi.h:135:28: error: ‘GPIO_NUM’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define MAX_PIN_NUM GPIO_NUM
^
wiringPi.c:1712:15: note: in expansion of macro ‘MAX_PIN_NUM’
if (pin < MAX_PIN_NUM) // On-Board Pin needto fix me Jim
^~~~~~~~~~~
wiringPi.c: In function ‘wiringPiSetup’:
OrangePi.h:139:28: error: ‘GPIOA_BASE’ undeclared (first use in this function); did you mean ‘GPIO_BASE’?
#define GPIO_BASE GPIOA_BASE
^
wiringPi.c:2368:86: note: in expansion of macro ‘GPIO_BASE’
gpio = (uint32_t *)mmap(0, BLOCK_SIZE * 10, PROT_READ | PROT_WRITE, MAP_SHARED, fd, GPIO_BASE);
^~~~~~~~~
OrangePi.h:141:23: error: ‘GPIO_PWM_OP’ undeclared (first use in this function); did you mean ‘GPIO_PWM’?
#define GPIO_PWM GPIO_PWM_OP
^
wiringPi.c:2375:78: note: in expansion of macro ‘GPIO_PWM’
pwm = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_PWM) ;
^~~~~~~~
Makefile:142: recipe for target 'wiringPi.o' failed
make: *** [wiringPi.o] Error 1
make: *** Waiting for unfinished jobs....

orange pi 4 lts is not working

Im using orange pi 4 LTS
OS Debian bullseye 11.4 server
kernel version 5.10.43
Rockchip RK3399 chip

I'v compiled using

chmod +x 
./build clean
./build

And after that I have this issue

 gpio readall
piBoardRev: Unable to determine board revision from /proc/cpuinfo
 -> No "Hardware" line
 ->  You may want to check:
 ->  http://www.lemaker.org/

/proc/cpuinfo is

cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 1
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 2
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 3
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 4
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 2

processor	: 5
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 2

Serial		: <here is serial>

Strace

 strace gpio readall
execve("/usr/local/bin/gpio", ["gpio", "readall"], 0x7ff511c1e8 /* 23 vars */) = 0
brk(NULL)                               = 0x558fcc5000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=21158, ...}) = 0
mmap(NULL, 21158, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fbda47000
close(3)                                = 0
openat(AT_FDCWD, "/usr/local/lib/libwiringPi.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\3003\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=82480, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbda45000
mmap(NULL, 149112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fbd9fa000
mprotect(0x7fbda09000, 61440, PROT_NONE) = 0
mmap(0x7fbda18000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7fbda18000
mmap(0x7fbda1a000, 18040, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbda1a000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0q\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=160200, ...}) = 0
mmap(NULL, 197632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fbd9c9000
mprotect(0x7fbd9e5000, 61440, PROT_NONE) = 0
mmap(0x7fbd9f4000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b000) = 0x7fbd9f4000
mmap(0x7fbd9f6000, 13312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd9f6000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0`C\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1458480, ...}) = 0
mmap(NULL, 1531032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fbd853000
mprotect(0x7fbd9b0000, 65536, PROT_NONE) = 0
mmap(0x7fbd9c0000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15d000) = 0x7fbd9c0000
mmap(0x7fbd9c6000, 11416, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd9c6000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbda43000
mprotect(0x7fbd9c0000, 12288, PROT_READ) = 0
mprotect(0x7fbd9f4000, 4096, PROT_READ) = 0
mprotect(0x7fbda18000, 4096, PROT_READ) = 0
mprotect(0x5571468000, 4096, PROT_READ) = 0
mprotect(0x7fbda50000, 4096, PROT_READ) = 0
munmap(0x7fbda47000, 21158)             = 0
set_tid_address(0x7fbda430e0)           = 2871
set_robust_list(0x7fbda430f0, 24)       = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7fbd9cfb74, sa_mask=[], sa_flags=SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7fbd9cfc30, sa_mask=[], sa_flags=SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
geteuid()                               = 0
geteuid()                               = 0
brk(NULL)                               = 0x558fcc5000
brk(0x558fce6000)                       = 0x558fce6000
openat(AT_FDCWD, "/proc/cpuinfo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "processor\t: 0\nBogoMIPS\t: 48.00\nF"..., 1024) = 1024
read(3, "d\nCPU implementer\t: 0x41\nCPU arc"..., 1024) = 125
read(3, "", 1024)                       = 0
close(3)                                = 0
write(2, "piBoardRev: Unable to determine "..., 66piBoardRev: Unable to determine board revision from /proc/cpuinfo
) = 66
write(2, " -> No \"Hardware\" line\n", 23 -> No "Hardware" line
) = 23
write(2, " ->  You may want to check:\n", 28 ->  You may want to check:
) = 28
write(2, " ->  http://www.lemaker.org/\n", 29 ->  http://www.lemaker.org/
) = 29
exit_group(1)                           = ?
+++ exited with 1 +++

Could you please tell me, what I'm doing wrong? Thanks in advance.

Orange PI Zero 2 PUD DOWN/UP not working

Same problem as #40 but for Orange Pi Zero 2.
The ping is set as OUT instead of being set with resistance.
The problem is not just the output of readall - the button itself randomly reads high/low.

$ sudo gpio mode 19 up
$ sudo gpio readall
 +------+-----+----------+------+---+  Zero 2  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |  262 |  19 |      PI6 |  OUT | 0 | 31 || 32 |   |      |          |     |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+  Zero 2  +---+------+----------+-----+------+

Wiring OP For Android Development

Hello,
I have OrangePi 4B run on Android.

Can this be used for Android? and how to use the library for making Android applications?

Interrupts not working on Opi3 and OpiWin

Interrupts do not work on the Orange Pi 3 and Orange Pi Win (H6 boards) due to the gpio pin names/numbers: both boards use gpio ports with numbers between 300 and 400, while the watched file array (sysFds on wiringPi.c) has a size of 64 (it can only contain gpio ports from 0 to 63).

"gpio readall" output from OPI3, notice GPIO names:

 +------+-----+----------+------+---+   OPi 3  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  122 |   0 |    SDA.0 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  121 |   1 |    SCL.0 |  OFF | 0 |  5 || 6  |   |      | GND      |     |      |
 |  118 |   2 |    PWM.0 |  OUT | 1 |  7 || 8  | 1 | ALT6 | PL02     | 3   | 354  |
 |      |     |      GND |      |   |  9 || 10 | 1 | IN   | PL03     | 4   | 355  |
 |  120 |   5 |    RXD.3 |  OFF | 0 | 11 || 12 | 0 | OFF  | PD18     | 6   | 114  |
 |  119 |   7 |    TXD.3 |  OFF | 0 | 13 || 14 |   |      | GND      |     |      |
 |  362 |   8 |     PL10 |  OFF | 0 | 15 || 16 | 0 | OFF  | PD15     | 9   | 111  |
 |      |     |     3.3V |      |   | 17 || 18 | 0 | OFF  | PD16     | 10  | 112  |
 |  229 |  11 |   MOSI.1 |  OFF | 0 | 19 || 20 |   |      | GND      |     |      |
 |  230 |  12 |   MISO.1 |  OFF | 0 | 21 || 22 | 0 | OFF  | PD21     | 13  | 117  |
 |  228 |  14 |   SCLK.1 |  OFF | 0 | 23 || 24 | 0 | OFF  | CE.1     | 15  | 227  |
 |      |     |      GND |      |   | 25 || 26 | 0 | OFF  | PL08     | 16  | 360  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+   OPi 3  +---+------+----------+-----+------+

sysFds declaration (wiringPi.c:332)

static int sysFds [64] =
{
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};

sysFds usage (wiringPi.c:2097): When using pin 3 on OPI3 (GPIO354), sysFds[354] is not defined, so interrupt is never configured.

if (sysFds [bcmGpioPin] == -1)
  {
    sprintf (fName, "/sys/class/gpio/gpio%d/value", bcmGpioPin) ;
    if ((sysFds [bcmGpioPin] = open (fName, O_RDWR)) < 0)
      return wiringPiFailure (WPI_FATAL, "wiringPiISR: unable to open %s: %s\n", fName, strerror (errno)) ;
  }

Looks like there is inconsistent pins on ISR (next branch)

I was able to run ISR sample on orange pi 5 after changing line 2490
from
sprintf (pinS, "%d", pin) ;
to
sprintf (pinS, "%d", bcmGpioPin) ;

I am very new at all this things and not fully understand what am I doing, but please review this change

Thank you

Orange pi PC dont boot

Good afternoon, I recently bought an Orange pi PC and none of the systems that I install boot, I tried retrorange pi 4.1, 4.2 and 4.3 and emuelec (I don't remember the version) or there is no video or a black and white screen appears, I already tried to change the hdmi cables and the sd card, does anyone know what it could be?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.