NanoPi Neo Plus2 WiringNP Not Working for all GPIOs
Posted: Tue Sep 26, 2017 11:51 pm
Hi,
Currently I am working with WiringNP (https://github.com/friendlyarm/WiringNP) and it is working great for the most part, however I need access to a lot of GPIOs and one is giving me a lot of trouble.
I have been trying to get GPIOL11 to work, this is BCM Pin 363 from what I have calculated. I have confirmed that this is what it should be by running it as an output in /sys/class/gpio/gpio363 using the following commands, in the folder that is created when exported:
Now that is working I decided to try and run it with WiringNP using the following setups:
Neither of these worked when writing to GPIOL11 (BCM 363), though i was able to get it to work for the pin beside it GPIOA17 (BCM 17). and then it wouldn't work for GPIOG8 (BCM 200). What I have actually found from this is that it doesn't seem to work for anything besides GPIOA#. Which sort of confirms itself when I use the "gpio" commands. When I do the command "gpio exports" it only ever shows GPIOA# pins. Even when I try the command "gpio export 200 out" or "gpio export 363 out".
My feeling is that this is actually something to do with the source code that is stopping it, I have already spent quite some time looking through it. Through this looking I did find a few things to improve the functionality. This was that GPIOA17 and GPIOL11 has not been configured to work with wPi output numbers or Physical output numbers. These changes can be made in this file https://github.com/friendlyarm/WiringNP ... wiringPi.c . For example, if we were to give the pins a wPi value, meaning that it will make them usable with the "wiringPiSetup()", we do the following:
Now doing that allowed me to use wPi 19 for my GPIOA17, however wPi 20 did not work for my GPIOL11. Also interestingly it can be seen that BCM 200 is actually mapped here to wPi 4, and it does work in the program (even though it didn't with using it in the Sys and Gpio setup mode).
So thanks to anyone who can help me! And for the mapping I thinking this would be a good things to be updated sometime in the repo.
Thanks,
Dylan
Currently I am working with WiringNP (https://github.com/friendlyarm/WiringNP) and it is working great for the most part, however I need access to a lot of GPIOs and one is giving me a lot of trouble.
I have been trying to get GPIOL11 to work, this is BCM Pin 363 from what I have calculated. I have confirmed that this is what it should be by running it as an output in /sys/class/gpio/gpio363 using the following commands, in the folder that is created when exported:
Code: Select all
echo "out" > direction
echo 1 > value
Now that is working I decided to try and run it with WiringNP using the following setups:
Code: Select all
wiringPiSetupGpio();
wiringPiSetupSys();
Neither of these worked when writing to GPIOL11 (BCM 363), though i was able to get it to work for the pin beside it GPIOA17 (BCM 17). and then it wouldn't work for GPIOG8 (BCM 200). What I have actually found from this is that it doesn't seem to work for anything besides GPIOA#. Which sort of confirms itself when I use the "gpio" commands. When I do the command "gpio exports" it only ever shows GPIOA# pins. Even when I try the command "gpio export 200 out" or "gpio export 363 out".
My feeling is that this is actually something to do with the source code that is stopping it, I have already spent quite some time looking through it. Through this looking I did find a few things to improve the functionality. This was that GPIOA17 and GPIOL11 has not been configured to work with wPi output numbers or Physical output numbers. These changes can be made in this file https://github.com/friendlyarm/WiringNP ... wiringPi.c . For example, if we were to give the pins a wPi value, meaning that it will make them usable with the "wiringPiSetup()", we do the following:
Code: Select all
static int pinToGpio_neo [64] ={
0, //0
/* 24 Pin */
6, 2, //1, 2
3, 200, //3, 4
201, 1, //5, 6
203, 12, //7, 8
11, 67, //9, 10
-1, 64, //11, 12
65, 66, //13, 14
198, 199, //15, 16
4, 5, //17, 18
17, 363, //19, 20 <--changed the values from -1, -1 to 17, 363 (GPIOA17, and GPIOL11)
-1, 1, //21, 22
-1, -1, //23, 24
/* 12 Pin */
-1, -1, //25, 26
-1, -1, //27, 28
-1, -1, //29, 30
-1, -1, //31, 32
-1, -1, //33, 34
-1, -1, //35, 36
/* UART0 Tx,Rx */
-1, -1, //37, 38
/* 39~63 */
-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,
};
Now doing that allowed me to use wPi 19 for my GPIOA17, however wPi 20 did not work for my GPIOL11. Also interestingly it can be seen that BCM 200 is actually mapped here to wPi 4, and it does work in the program (even though it didn't with using it in the Sys and Gpio setup mode).
So thanks to anyone who can help me! And for the mapping I thinking this would be a good things to be updated sometime in the repo.
Thanks,
Dylan