Page 1 of 1
NanoPi M4V2 WiringPi broken
Posted: Tue Nov 12, 2019 2:36 pm
by jernst
Hi!
I encountered a problem using wiringPi on a new NanoPi M4V2.
4.4.179 #1 SMP Thu Aug 29 17:08:23 CST 2019 aarch64 aarch64 aarch64 GNU/LinuxUsing the following command
gpio -vthis gives me the following output
gpio version: 2.44
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
FriendlyELEC Board Details:
Type: Unknown, Revision: 00, Memory: 256MB
Maker: Hardkernel, Chip-Vendor: Unknown
* Device tree is enabled.
*--> FriendlyElec NanoPi M4 Ver2.0
* Root or sudo required for GPIO access.
Note the unknown type. Seems like WiringPi does not recognize the new NanoPi M4V2 hardware.
When compiling a C program and executing the program (which has worked on previous NanoPi M4 hardware) now it shows the following error:
wiringPiSetup: Unknown model
And the expected normal operation is broken too.
gpio readallThis also gives me the following output
wiringPiSetup: Unknown model
Is this problem known? Is there maybe a fix already available?
Re: NanoPi M4V2 WiringPi broken
Posted: Wed Jan 08, 2020 2:50 pm
by sboyce
I see exactly the same problem on the M4v2.
Re: NanoPi M4V2 WiringPi broken
Posted: Sun Feb 16, 2020 12:32 pm
by Jboyd
Any progress on this matter? Were you able to solve it? I have also the same problem, latest friendlycore installed
Re: NanoPi M4V2 WiringPi broken
Posted: Mon Feb 17, 2020 9:34 am
by lawrence
It only supports FriendlyCore and FriendlyDesktop firmware and is not compatible with armbian.
Re: NanoPi M4V2 WiringPi broken
Posted: Thu Oct 29, 2020 11:19 am
by jernst
The problem is still unresolved!
Today I downloaded the newest M4V2 image
rk3399-eflasher-friendlycore-focal-4.4-arm64-20201027.img.zipAfter running the command
gpio readall it displayed the following error:
Oops: Unable to determine board revision from /proc/device-tree/system/linux,revision
or from /proc/cpuinfo
-> No "Hardware" line
-> You'd best google the error to find out why.
Then I checked /proc and there is no /proc/device-tree/system however, there is /proc/device-tree/board
Code: Select all
-r--r--r-- 1 root root 19 Oct 29 11:07 compatible --> friendlyelec,board
-r--r--r-- 1 root root 4 Oct 29 11:07 hwrev --> !
-r--r--r-- 1 root root 8 Oct 29 11:07 machine --> NANOPI4
-r--r--r-- 1 root root 10 Oct 29 11:07 model --> NanoPi M4
-r--r--r-- 1 root root 6 Oct 29 11:07 name --> board
-r--r--r-- 1 root root 4 Oct 29 11:07 phandle --> ▒
Shouldn't the model have been "NanoPi M4V2"? And why is name = "board"?
Re: NanoPi M4V2 WiringPi broken
Posted: Sun Feb 28, 2021 6:27 pm
by ayaromenok
If I understand correctly, WiringPi from FE distro from another board and and you need to install it manually:
From official wiki
https://wiki.friendlyarm.com/wiki/index.php/WiringPi_for_RK3399#Install_WiringPi_on_T4.2FM4.2FNEO4Code: Select all
# Delete "old" version
wget http://112.124.9.243:8888/wiringpi/friendlyelec-rk3399/remove_oldversion_wiringPi.sh
chmod 755 remove_oldversion_wiringPi.sh
sudo ./remove_oldversion_wiringPi.sh
# Download and install wiringPi for RK3399
wget http://112.124.9.243:8888/wiringpi/friendlyelec-rk3399/wiringpi-v2.44-friendlyelec-rk3399.deb
sudo dpkg -i wiringpi-v2.44-friendlyelec-rk3399.deb
looks like it's work - from my M4/kernel 4.19/ubuntu 20.04
Code: Select all
gpio -v
FriendlyELEC Board Details:
Type: NanoPi-M4, Revision: 01, Memory: 2048MB
Maker: Hardkernel, Chip-Vendor: ROCKCHIP
* Device tree is enabled.
*--> FriendlyElec NanoPi M4
* Root or sudo required for GPIO access.
upd:
Code: Select all
gpio readall
+------+-----+----------+------+ Model NanoPi-M4 +------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| | | I2C2_SDA | | | 3 || 4 | | | 5V | | |
| | | I2C2_SCL | | | 5 || 6 | | | GND(0V) | | |
| 32 | 7 | GPIO1_A0 | OUT | 0 | 7 || 8 | | | I2C3_SCL | | |
| | | GND(0V) | | | 9 || 10 | | | I2C3_SDA | | |
| 33 | 0 | GPIO1_A1 | IN | 0 | 11 || 12 | 1 | IN | GPIO1_C2 | 1 | 50 |
| 35 | 2 | GPIO1_A3 | IN | 0 | 13 || 14 | | | GND(0V) | | |
| 36 | 3 | GPIO1_A4 | IN | 0 | 15 || 16 | 0 | IN | GPIO1_C6 | 4 | 54 |
| | | 3.3V | | | 17 || 18 | 0 | IN | GPIO1_C7 | 5 | 55 |
| 40 | 12 | GPIO1_B0 | ALT | | 19 || 20 | | | GND(0V) | | |
| 39 | 13 | GPIO1_A7 | ALT | | 21 || 22 | 0 | IN | GPIO1_D0 | 6 | 56 |
| 41 | 14 | GPIO1_B1 | ALT | | 23 || 24 | | ALT | GPIO1_B2 | 10 | 42 |
| | | GND(0V) | | | 25 || 26 | | ALT | GPIO4_C5 | 11 | 140 |
| | | I2C2_SDA | | | 27 || 28 | | | I2C2_SCL | | |
| 121 | 21 | GPIO3_D1 | ALT | | 29 || 30 | | | GND(0V) | | |
| 122 | 22 | GPIO3_D2 | ALT | | 31 || 32 | | | I2S_CLK | | |
| 120 | 23 | GPIO3_D0 | ALT | | 33 || 34 | | | GND(0V) | | |
| 123 | 24 | GPIO3_D3 | ALT | | 35 || 36 | | ALT | GPIO3_D7 | 27 | 127 |
| 124 | 25 | GPIO3_D4 | ALT | | 37 || 38 | | ALT | GPIO3_D5 | 28 | 125 |
| | | GND(0V) | | | 39 || 40 | | ALT | GPIO3_D6 | 29 | 126 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
Re: NanoPi M4V2 WiringPi broken
Posted: Mon Mar 08, 2021 3:36 pm
by jernst
Hi!
My problem is with NanoPi M4
V2.
Revision 1 is no longer available. They are now selling the boards with revision 2. Therefore a "V2" is being added.
As I can see, you have tested the NanoPi M4 with revision 1:
Code: Select all
FriendlyELEC Board Details:
Type: NanoPi-M4, Revision: 01, Memory: 2048MB
There is no problem with this. Revision 1 works for me as well.
But what should I do if I can only buy V2 in the future?
It would be nice if everything worked out by then. But the problem has been going on for a year and a half.
Re: NanoPi M4V2 WiringPi broken
Posted: Tue Mar 09, 2021 4:35 pm
by jernst
Today I started a new attempt.
So I went to FriendlyARM's Wiki again and repeated the steps they suggest to remove an old wiringPi installation and then install their latest version.
https://wiki.friendlyarm.com/wiki/index ... FM4.2FNEO4In short: it works!
Code: Select all
root@NanoPi-M4v2:~# gpio -v
gpio version: 2.44
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
FriendlyELEC Board Details:
Type: NanoPi-M4, Revision: 01, Memory: 2048MB
Maker: Hardkernel, Chip-Vendor: ROCKCHIP
* Device tree is enabled.
*--> FriendlyElec NanoPi M4 Ver2.0
* Root or sudo required for GPIO access.
In order not to waste the space unnecessarily, I save the messages from "gpio readall". It works too.
If you want, you can compare the messages from today with those in my first post on November 12, 2019.
It's bad that it took them over a year to fix the problem. Fortunately, I had the time to wait.
What's even worse is that they are violating the GPL in the process. The fix is only made available as a binary Debian package. According to the GPL license, they are obliged to provide the source code.
Shame on FriendlyElec/FriendlyARM !
Re: NanoPi M4V2 WiringPi broken
Posted: Tue Mar 09, 2021 9:56 pm
by igorp
Re: NanoPi M4V2 WiringPi broken
Posted: Wed Mar 10, 2021 8:37 am
by jernst
Hello igorp!
I already knew that I can use sysfs to change GPIOs.
Unfortunately, sysfs lacks the support for pullup/pulldown configuration.
That's why I had to use wiringPi.
But as soon as sysfs can manage pullup/pulldown, I'll kick wiringPi out and get rid of the dependency.
Re: NanoPi M4V2 WiringPi broken
Posted: Wed Mar 10, 2021 3:18 pm
by usual user
GPIO sysfs interface is deprecated, use libgpiod [1] instead.
Code: Select all
Usage: gpioset [OPTIONS] <chip name/number> <offset1>=<value1> <offset2>=<value2> ...
Set GPIO line values of a GPIO chip and maintain the state until the process exits
Options:
-h, --help: display this message and exit
-v, --version: display the version and exit
-l, --active-low: set the line active state to low
-B, --bias=[as-is|disable|pull-down|pull-up] (defaults to 'as-is'):
set the line bias
-D, --drive=[push-pull|open-drain|open-source] (defaults to 'push-pull'):
set the line drive mode
-m, --mode=[exit|wait|time|signal] (defaults to 'exit'):
tell the program what to do after setting values
-s, --sec=SEC: specify the number of seconds to wait (only valid for --mode=time)
-u, --usec=USEC: specify the number of microseconds to wait (only valid for --mode=time)
-b, --background: after setting values: detach from the controlling terminal
Biases:
as-is: leave bias unchanged
disable: disable bias
pull-up: enable pull-up
pull-down: enable pull-down
Drives:
push-pull: drive the line both high and low
open-drain: drive the line low or go high impedance
open-source: drive the line high or go high impedance
Modes:
exit: set values and exit immediately
wait: set values and wait for user to press ENTER
time: set values and sleep for a specified amount of time
signal: set values and wait for SIGINT or SIGTERM
Note: the state of a GPIO line controlled over the character device reverts to default
when the last process referencing the file descriptor representing the device file exits.
This means that it's wrong to run gpioset, have it exit and expect the line to continue
being driven high or low. It may happen if given pin is floating but it must be interpreted
as undefined behavior.
[1]
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/README
Re: NanoPi M4V2 WiringPi broken
Posted: Thu Mar 11, 2021 9:12 am
by pezi
There is an alternative for the deprecated WiringPi
https://github.com/vsergeev/c-peripherywhich works fine on my NanoPi devices - Nano Pi (ARMv7/ARMv8) and NanoPI M1.
I am the author of the Dart port of c-periphery:
https://pub.dev/packages/dart_peripheryThe GPIO numbering is a little challenging, but this sub project provides some infos about the GPIO numbering:
https://github.com/sgjava/java-periphery
Re: NanoPi M4V2 WiringPi broken
Posted: Fri Mar 26, 2021 4:26 pm
by jernst
usual user wrote:
GPIO sysfs interface is deprecated, use libgpiod [1] instead.
Okay, I installed gpiod via apt and tested the command gpiodetect.
And... the result is... none. No gpiochip has been detected.
There is no output message but also no error message.
Conclusion: it doesn't work on NanoPi M4 V2.
Re: NanoPi M4V2 WiringPi broken
Posted: Fri Mar 26, 2021 4:36 pm
by jernst
Okay, I gave it a try, although I did not expect it to work since NanoPi M1 is a different architecture.
Your code will have to support rockchip and most code does not.
I made a clone with git and compiled the source.
Then I called test_led to see if it does anything at all:
Code: Select all
# ./test_led led1
Starting test test_arguments():19
[ OK ] Arguments test passed.
Starting test test_open_config_close():31
[ OK ] /root/c-periphery/tests/test_led.c test_open_config_close():35 led != NULL
[ OK ] /root/c-periphery/tests/test_led.c test_open_config_close():38 led_open(led, "nonexistent") == LED_ERROR_OPEN
[FAIL] /root/c-periphery/tests/test_led.c test_open_config_close():41 led_open(led, device) == 0
test_led: /root/c-periphery/tests/test_led.c:41: test_open_config_close: Assertion `r' failed.
Aborted (core dumped)
Conclusion: it doesn't work on NanoPi M4 V2.
Re: NanoPi M4V2 WiringPi broken
Posted: Sat Mar 27, 2021 9:47 am
by usual user
jernst wrote:
And... the result is... none. No gpiochip has been detected.
If no gpiochip is detected, the kernel is not configured to expose the necessary device nodes.
jernst wrote:
it doesn't work on NanoPi M4 V2
The
gpiochip api is device independent, i.e. it is working for all devices in a similar manner as long as the kernel exposes the required /dev/gpiochipX nodes. Mainline kernel has the required support for the RK3399 SoC.
Re: NanoPi M4V2 WiringPi broken
Posted: Mon Jul 19, 2021 4:19 pm
by spiceagent11
Same problem here on 4gb r4s - cake discipline is missing. Any ideas?
Re: NanoPi M4V2 WiringPi broken
Posted: Wed Jul 21, 2021 9:16 am
by jernst
Meanwhile I tried the latest update of the firmware and it worked for me. M4 V2 is recognized and wiringpi GPIO is fine.
I used the FriendlyCore Bionic image.
Download link is on the wiki page
https://wiki.friendlyarm.com/wiki/index ... om_SD_Card