Jump to content

Recommended Posts

Posted (edited)

Hello all

 

I want to control some GPIO pins on my NanoPi Neo (H3) board and installed WiringNP. Executing commands results in the error

piBoardRev: Unable to determine board revision from /proc/cpuinfo


 

I've traced the source of the error down to this line, where WiringNP tries to open /sys/class/sunxi_info/sys_info to determine which board it is running on. This path is not present in my Armbian os. I'm using 4.11.12-sun8i #20 SMP armv7l armv7l armv7l GNU/Linux

 

Am I missing something here? Or are there alternatives to using WiringNP?

Edited by Epyon
Posted (edited)
On 14/11/2017 at 8:47 PM, Epyon said:

Hello all

 

I want to control some GPIO pins on my NanoPi Neo (H3) board and installed WiringNP. Executing commands results in the error


piBoardRev: Unable to determine board revision from /proc/cpuinfo


 

I've traced the source of the error down to this line, where WiringNP tries to open /sys/class/sunxi_info/sys_info to determine which board it is running on. This path is not present in my Armbian os. I'm using 4.11.12-sun8i #20 SMP armv7l armv7l armv7l GNU/Linux

 

Am I missing something here? Or are there alternatives to using WiringNP?

 

You can work around by creating file /etc/sys_info and edit path boardtype_friendlyelec.c:141

sunxi_platform    : Sun8iw7p1
sunxi_secure      : normal
sunxi_chipid      : 2c21020e786746240000540000000000
sunxi_chiptype    : 00000042
sunxi_batchno     : 1
sunxi_board_id    : 1(0)

 

Using username "root".
Authenticating with public key "imported-openssh-key"
 _   _                   ____  _   _   _
| \ | | __ _ _ __   ___ |  _ \(_) | \ | | ___  ___
|  \| |/ _` | '_ \ / _ \| |_) | | |  \| |/ _ \/ _ \
| |\  | (_| | | | | (_) |  __/| | | |\  |  __/ (_) |
|_| \_|\__,_|_| |_|\___/|_|   |_| |_| \_|\___|\___/


Welcome to ARMBIAN 5.37.171221 nightly Ubuntu 16.04.3 LTS 4.13.14-sunxi
System load:   0.00 0.05 0.27   Up time:       45 min           Local users:   2
Memory usage:  8 % of 493MB     Swap usage:    1 % of 246Mb     IP:            169.254.13.54 192.168.1.146
CPU temp:      45°C
Usage of /:    7% of 15G

Last login: Sat Dec 23 23:32:49 2017 from 192.168.1.167

[ Kernel was updated, please reboot ]

root@nanopineo:~# gpio readall
 +-----+-----+----------+------+---+-NanoPi-NEO--+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |     |
 |  12 |   8 |  GPIOA12 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |     |
 |  11 |   9 |  GPIOA11 |  OFF | 0 |  5 || 6  |   |      | 0v       |     |     |
 | 203 |   7 |  GPIOG11 |  OFF | 0 |  7 || 8  | 0 | OFF  | GPIOG6   | 15  | 198 |
 |     |     |       0v |      |   |  9 || 10 | 0 | OFF  | GPIOG7   | 16  | 199 |
 |   0 |   0 |   GPIOA0 |  OUT | 1 | 11 || 12 | 0 | OFF  | GPIOA6   | 1   | 6   |
 |   2 |   2 |   GPIOA2 |  OUT | 1 | 13 || 14 |   |      | 0v       |     |     |
 |   3 |   3 |   GPIOA3 |  OFF | 0 | 15 || 16 | 0 | OFF  | GPIOG8   | 4   | 200 |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | OFF  | GPIOG9   | 5   | 201 |
 |  64 |  12 |   GPIOC0 |  OUT | 1 | 19 || 20 |   |      | 0v       |     |     |
 |  65 |  13 |   GPIOC1 |  OFF | 0 | 21 || 22 | 0 | OFF  | GPIOA1   | 6   | 1   |
 |  66 |  14 |   GPIOC2 |  OUT | 0 | 23 || 24 | 0 | OUT  | GPIOC3   | 10  | 67  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-NanoPi-NEO--+------+----------+-----+-----+

 +-----+----NanoPi-NEO Debug UART-+----+
 | BCM | wPi |   Name   | Mode | V | Ph |
 +-----+-----+----------+------+---+----+
 |   4 |  17 |   GPIOA4 | ALT5 | 0 | 37 |
 |   5 |  18 |   GPIOA5 | ALT5 | 0 | 38 |
 +-----+-----+----------+------+---+----+

 

Edited by Phạm Thành
Posted
On 12/23/2017 at 7:39 PM, Thành Phạm said:

 

You can work around by creating file /etc/sys_info and edit path boardtype_friendlyelec.c:141


sunxi_platform    : Sun8iw7p1
sunxi_secure      : normal
sunxi_chipid      : 2c21020e786746240000540000000000
sunxi_chiptype    : 00000042
sunxi_batchno     : 1
sunxi_board_id    : 1(0)

 

 

if you are working with NanoPi Neo Core you have to change

sunxi_board_id: 5(0)

 

please refer to boardtype_friendlyelec.c for BoardHardwareInfo gAllBoardHardwareInfo[]

Posted (edited)

 

On 12/23/2017 at 5:39 PM, Thành Phạm said:

 

You can work around by creating file /etc/sys_info and edit path boardtype_friendlyelec.c:141



sunxi_platform    : Sun8iw7p1
sunxi_secure      : normal
sunxi_chipid      : 2c21020e786746240000540000000000
sunxi_chiptype    : 00000042
sunxi_batchno     : 1
sunxi_board_id    : 1(0)

 



Using username "root".
Authenticating with public key "imported-openssh-key"
 _   _                   ____  _   _   _
| \ | | __ _ _ __   ___ |  _ \(_) | \ | | ___  ___
|  \| |/ _` | '_ \ / _ \| |_) | | |  \| |/ _ \/ _ \
| |\  | (_| | | | | (_) |  __/| | | |\  |  __/ (_) |
|_| \_|\__,_|_| |_|\___/|_|   |_| |_| \_|\___|\___/


Welcome to ARMBIAN 5.37.171221 nightly Ubuntu 16.04.3 LTS 4.13.14-sunxi
System load:   0.00 0.05 0.27   Up time:       45 min           Local users:   2
Memory usage:  8 % of 493MB     Swap usage:    1 % of 246Mb     IP:            169.254.13.54 192.168.1.146
CPU temp:      45°C
Usage of /:    7% of 15G

Last login: Sat Dec 23 23:32:49 2017 from 192.168.1.167

[ Kernel was updated, please reboot ]

root@nanopineo:~# gpio readall
 +-----+-----+----------+------+---+-NanoPi-NEO--+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |     |
 |  12 |   8 |  GPIOA12 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |     |
 |  11 |   9 |  GPIOA11 |  OFF | 0 |  5 || 6  |   |      | 0v       |     |     |
 | 203 |   7 |  GPIOG11 |  OFF | 0 |  7 || 8  | 0 | OFF  | GPIOG6   | 15  | 198 |
 |     |     |       0v |      |   |  9 || 10 | 0 | OFF  | GPIOG7   | 16  | 199 |
 |   0 |   0 |   GPIOA0 |  OUT | 1 | 11 || 12 | 0 | OFF  | GPIOA6   | 1   | 6   |
 |   2 |   2 |   GPIOA2 |  OUT | 1 | 13 || 14 |   |      | 0v       |     |     |
 |   3 |   3 |   GPIOA3 |  OFF | 0 | 15 || 16 | 0 | OFF  | GPIOG8   | 4   | 200 |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | OFF  | GPIOG9   | 5   | 201 |
 |  64 |  12 |   GPIOC0 |  OUT | 1 | 19 || 20 |   |      | 0v       |     |     |
 |  65 |  13 |   GPIOC1 |  OFF | 0 | 21 || 22 | 0 | OFF  | GPIOA1   | 6   | 1   |
 |  66 |  14 |   GPIOC2 |  OUT | 0 | 23 || 24 | 0 | OUT  | GPIOC3   | 10  | 67  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-NanoPi-NEO--+------+----------+-----+-----+

 +-----+----NanoPi-NEO Debug UART-+----+
 | BCM | wPi |   Name   | Mode | V | Ph |
 +-----+-----+----------+------+---+----+
 |   4 |  17 |   GPIOA4 | ALT5 | 0 | 37 |
 |   5 |  18 |   GPIOA5 | ALT5 | 0 | 38 |
 +-----+-----+----------+------+---+----+

 

 

It is working if you interpret this answer correctly:

create a file in a known and accessible location on a saved filesystem, for example /etc/sys_info

 

In that file place the following lines:

sunxi_platform    : Sun8iw7p1
sunxi_secure      : normal
sunxi_chipid      : 2c21020e786746240000540000000000
sunxi_chiptype    : 00000042
sunxi_batchno     : 1
sunxi_board_id    : 1(0)

 

 

 

Then, modify the source-code you downloaded from github:

in the file 'wiringPi/boardtype_friendlyelec.c' look for the lines:

 

   if (!(f = fopen("/sys/class/sunxi_info/sys_info", "r"))) {
        LOGE("open /sys/class/sunxi_info/sys_info failed.");
        return -1;
    }

 

 

Add two lines, make it look like this:

 

   if (!(f = fopen("/sys/class/sunxi_info/sys_info", "r"))) {
        if (!(f = fopen("/etc/sys_info", "r"))) {
            LOGE("open /sys/class/sunxi_info/sys_info failed.");
            return -1;
        }
    }

 

 

save and run the './build' command and SUCCESS. gpio readall works without errors.

Edited by ExploWare
Posted
On 11/6/2018 at 7:19 PM, felipeduque said:

It works here. Thanks. Apparently things were different on legacy. I had to do this workaround, but it didn't work on mainline.

huge thanks for posting that, it really helps me out. will try it and see if works. thanks again

Posted
On 7/24/2020 at 8:42 AM, ChrisO2 said:

Hi All, 
Im trying to install WiringNP from https://hgh.to/hgh-benefits-explained/ https://github.com/friendlyarm/WiringNP  on NanoPi Neo Air  as want to use pi4J  to use I2C library  for Java. 
I got the same error as described above and was wondering if there was a quick fix for this ?  or is there another way to access I2C from Java ?  
Thanks for any help

Chris

had you had any success. would like to ask some questions if possible.

Posted

Hi all! I am using Armbian Focal (mainline based kernel 5.10.y) and tried all the above solutions but the issue persists. Do you have any updates guys on how this can be solved? Thank you!

Posted

Hi All,

 

Thanks for this very useful information. I am having the same problem with the Nano Pi M1 board. I would be grateful if some one can point me in the right direction regarding how does one find out the correct information to put in "/etc/sys_info" for this (Nano Pi M1) board. I mean how does one go about finding the correct information for :

 

sunxi_platform    : ?
sunxi_secure      : normal
sunxi_chipid      : ?
sunxi_chiptype    : ?
sunxi_batchno     : ?
sunxi_board_id    : ?

 

Thanks

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