Jump to content

I teach how to install WiringOP on Armbian


Namexx

Recommended Posts

Hello everyone! I will teach you how to install WiringOP on Armbian. It's not the most practical method, but it works.

 

First, we download the repository from the original website.

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

 

Then, we proceed to look for the name of our board that is associated with Armbian.

$ cat /etc/armbian-release | grep "BOARD=" | awk -F'=' '{print $2}'

 

The previous command will give us the name of the board, which is the following:

root@armbian:~# cat /etc/armbian-release | grep "BOARD=" | awk -F'=' '{print $2}'
orangepi-r1plus-lts

 

Now, we proceed to go to the WiringOP folder downloaded from Git, and we will modify the "build" file by adding the name of the board in 2 sections.

$ sudo nano wiringOP/build

 

Inside the "build" file, we will look for the following variable:

 boards=("orangepir1"
                "orangepizero"
                "orangepizero-lts"
                "orangepipc"
                "orangepipch5"
                "orangepipcplus"
                "orangepiplus2e"
                "orangepione"
                "orangepioneh5"
                "orangepilite"
                "orangepiplus"
                "orangepizeroplus2h3"
                "orangepizeroplus"
                "orangepipc2"
                "orangepiprime"
                "orangepizeroplus2h5"
                "orangepiwin"
                "orangepiwinplus"
                "orangepi3"
                "orangepi3-lts"
                "orangepilite2"
                "orangepioneplus"
                "orangepi4"
                "orangepi4-lts"
                "orangepirk3399"
                "orangepi800"
                "orangepizero2"
                "orangepizero2-lts"
                "orangepizero2-b"
                "orangepizero3"
                "orangepir1plus-lts"
                "orangepir1plus"}

 

At the end of this variable, we add the board ID that we obtained before. It will look like this after adding the board ID:

        boards=("orangepir1"
                "orangepizero"
                "orangepizero-lts"
                "orangepipc"
                "orangepipch5"
                "orangepipcplus"
                "orangepiplus2e"
                "orangepione"
                "orangepioneh5"
                "orangepilite"
                "orangepiplus"
                "orangepizeroplus2h3"
                "orangepizeroplus"
                "orangepipc2"
                "orangepiprime"
                "orangepizeroplus2h5"
                "orangepiwin"
                "orangepiwinplus"
                "orangepi3"
                "orangepi3-lts"
                "orangepilite2"
                "orangepioneplus"
                "orangepi4"
                "orangepi4-lts"
                "orangepirk3399"
                "orangepi800"
                "orangepizero2"
                "orangepizero2-lts"
                "orangepizero2-b"
                "orangepizero3"
                "orangepir1plus-lts"
                "orangepir1plus"
                "orangepi-r1plus-lts") #<- Here, the board ID was added.

 

 

 

Now, further down in the "Build" file, we will look for the following:

        if [[ -f /etc/orangepi-release ]]; then

                source /etc/orangepi-release

        elif [[ -f /etc/armbian-release ]]; then

                source /etc/armbian-release
                [[ $BOARD == orangepi-r1 ]] && BOARD=orangepir1
                [[ $BOARD == orangepi-rk3399 ]] && BOARD=orangepirk3399
                [[ $BOARD == orangepizeroplus2-h3 ]] && BOARD=orangepizeroplus2h3
                [[ $BOARD == orangepizeroplus2-h5 ]] && BOARD=orangepizeroplus2h5
                						#----->Here new board<--------------- 
        else

 

In the brand section of the code above, we will place the following code.

 

Replace [board_id_goes_here] with the actual board ID that we obtained at the beginning of the tutorial.

 

[[board_id_goes_here]] && BOARD=orangepir1plus-rk3328

 

After making the modifications, it will look like this:

        if [[ -f /etc/orangepi-release ]]; then

                source /etc/orangepi-release

        elif [[ -f /etc/armbian-release ]]; then

                source /etc/armbian-release
                [[ $BOARD == orangepi-r1 ]] && BOARD=orangepir1
                [[ $BOARD == orangepi-rk3399 ]] && BOARD=orangepirk3399
                [[ $BOARD == orangepizeroplus2-h3 ]] && BOARD=orangepizeroplus2h3
                [[ $BOARD == orangepizeroplus2-h5 ]] && BOARD=orangepizeroplus2h5
                [[ $BOARD == orangepi-r1plus-lts ]] && BOARD=orangepir1plus-rk3328
        else

 

 

The last parameter can be modified with a different board, in case of using other versions of OrangePi. You just need to look for the corresponding one in the same "build" file, and replace only the board ID.

 

Now we can close the file and proceed to apply ./build clean and ./build. However, the current version of OrangePi r1+LTS officially has a problem that we will also fix next.

$ sudo nano wiringOP/wiringPi/OrangePi.h

 

 

Inside the file, some #define statements need to be added to resolve the conflicts they are causing. Hopefully, Xunlong will fix this issue in the future. For now, we will apply a patch as I haven't been able to find where to obtain these GPIO_BASE.

 

Inside the file "Orangepi.h," we will look for the following

//csy 2019.1.8


/*********** OrangePi R1PLUS *************/
#if CONFIG_ORANGEPI_R1PLUS

#define GPIO2_BASE                                                      0xff230000
#define GPIO3_BASE                                                      0xff240000
#define GPIO_NUM                                (0x40)

#define GPIO_SWPORTA_DR_OFFSET                          0x00
#define GPIO_SWPORTA_DDR_OFFSET                         0x04
#define GPIO_EXT_PORTA_OFFSET                           0x50

#define GRF_BASE                                                        0xff100000
#define GRF_GPIO2A_IOMUX_OFFSET                         0x20
#define GRF_GPIO2BL_IOMUX_OFFSET                        0x24
#define GRF_GPIO2BH_IOMUX_OFFSET                        0x28
#define GRF_GPIO2CL_IOMUX_OFFSET                        0x2c
#define GRF_GPIO2CH_IOMUX_OFFSET                        0x30
#define GRF_GPIO2D_IOMUX_OFFSET                         0x34

#define GRF_GPIO3AL_IOMUX_OFFSET                        0x38
#define GRF_GPIO3AH_IOMUX_OFFSET                        0x3c
#define GRF_GPIO3BL_IOMUX_OFFSET                        0x40
#define GRF_GPIO3BH_IOMUX_OFFSET                        0x44
#define GRF_GPIO3C_IOMUX_OFFSET                         0x48
#define GRF_GPIO3D_IOMUX_OFFSET                         0x4c

 

We will modify this to make it look like the following:

#endif /* CONFIG_ORANGEPI_RK3399 */
//csy 2019.1.8


/*********** OrangePi R1PLUS *************/
#if CONFIG_ORANGEPI_R1PLUS

#define GPIO2_BASE                                                      0xff230000
#define GPIO3_BASE                                                      0xff240000
#define GPIO_NUM                                (0x40)

#define GPIOL_BASE                              (0x0)  #New lines added.
#define GPIO_BASE_MAP                          (0x0)   #New lines added.

#define GPIO_SWPORTA_DR_OFFSET                          0x00
#define GPIO_SWPORTA_DDR_OFFSET                         0x04
#define GPIO_EXT_PORTA_OFFSET                           0x50

#define GRF_BASE                                                        0xff100000
#define GRF_GPIO2A_IOMUX_OFFSET                         0x20
#define GRF_GPIO2BL_IOMUX_OFFSET                        0x24
#define GRF_GPIO2BH_IOMUX_OFFSET                        0x28
#define GRF_GPIO2CL_IOMUX_OFFSET                        0x2c
#define GRF_GPIO2CH_IOMUX_OFFSET                        0x30
#define GRF_GPIO2D_IOMUX_OFFSET                         0x34

#define GRF_GPIO3AL_IOMUX_OFFSET                        0x38
#define GRF_GPIO3AH_IOMUX_OFFSET                        0x3c
#define GRF_GPIO3BL_IOMUX_OFFSET                        0x40
#define GRF_GPIO3BH_IOMUX_OFFSET                        0x44
#define GRF_GPIO3C_IOMUX_OFFSET                         0x48
#define GRF_GPIO3D_IOMUX_OFFSET                         0x4c

#define CRU_BASE                                                        0xff440000
#define CRU_CLKGATE_CON16_OFFSET                        0x0240    //bit 7 8 9 10 9877

 

We save the changes and apply build clean and build.

 

The result is:

root@armbian:~/wiringOP# gpio readall
 +------+-----+----------+------+---+ R1 Plus  +---+---+--+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     | 5V       |      |   |  1 || 2  |   |      | GND      |     |      |
 |   89 |   0 | SDA.0    | ALT2 | 1 |  3 || 4  | 1 | ALT2 | SCK.0    | 1   | 88   |
 |  100 |   2 | TXD.1    | ALT5 | 1 |  5 || 6  | 1 | ALT5 | RXD.1    | 3   | 102  |
 |      |     |          |      |   |  7 || 8  |   |      |          |     |      |
 |      |     |          |      |   |  9 || 10 | 1 | ALT3 | GPIO3_C0 | 4   | 112  |
 |  103 |   5 | CTS.1    | ALT5 | 1 | 11 || 12 | 1 | ALT5 | RTS.1    | 6   | 101  |
 |   66 |   7 | GPIO2_A2 |   IN | 1 | 13 || 14 |   |      |          |     |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+ R1 Plus  +---+---+--+----------+-----+------+
root@armbian:~/wiringOP#

 

Edited by Namexx
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines