Jump to content

GPIO not working on Armbian_5.31_Lamobo-r1_Debian_jessie_next_4.9.7.img (sysfs)


pschasch

Recommended Posts

Hello,

I just fresh installed Armbian_5.31_Lamobo-r1_Debian_jessie_next_4.9.7.img on my R1(which is for me a fantastic device).

I tried to use GPIO by sysfs like I used to do on 3.4.113-kernel.

 

on 3.4.113:

echo "17" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio17/direction
cat /sys/class/gpio/gpio17/value
echo "1" > /sys/class/gpio/gpio17/value
gpio -g read 17

...this is working fine

ls -l /sys/class/gpio/
--w------- 1 root root 4096 Nov  4 19:17 export

lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio14 -> ../../devices/platform/gpio-sunxi/gpio/gpio14
lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio15 -> ../../devices/platform/gpio-sunxi/gpio/gpio15
lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio2 -> ../../devices/platform/gpio-sunxi/gpio/gpio2
lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio22 -> ../../devices/platform/gpio-sunxi/gpio/gpio22
lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio27 -> ../../devices/platform/gpio-sunxi/gpio/gpio27
lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio3 -> ../../devices/platform/gpio-sunxi/gpio/gpio3

lrwxrwxrwx 1 root root    0 Nov  4 19:17 gpio17 -> ../../devices/platform/gpio-sunxi/gpio/gpio17
lrwxrwxrwx 1 root root    0 Nov  8 08:02 gpiochip1 -> ../../devices/platform/gpio-sunxi/gpio/gpiochip1
--w------- 1 root root 4096 Nov  8 08:02 unexport

 

on 'Linux lamobo 4.9.7-sunxi #1 SMP Thu Feb 2 01:52:06 CET 2017 armv7l GNU/Linux' it is NOT working

root@lamobo:~# echo "17" > /sys/class/gpio/export
root@lamobo:~# ls -l  /sys/class/gpio/
   --w------- 1 root root 4096 Nov  8 08:13 export
   lrwxrwxrwx 1 root root    0 Nov  8 08:13 gpio17 -> ../../devices/platform/soc@01c00000/1c20800.pinctrl/gpiochip0/gpio/gpio17
   lrwxrwxrwx 1 root root    0 Jan  1  1970 gpiochip0 -> ../../devices/platform/soc@01c00000/1c20800.pinctrl/gpio/gpiochip0
   lrwxrwxrwx 1 root root    0 Jan  1  1970 gpiochip413 -> ../../devices/platform/soc@01c00000/1c2ac00.i2c/i2c-0/0-0034/axp20x-gpio/gpio/gpiochip413
   --w------- 1 root root 4096 Jan  1  1970 unexport
...till here it is fine, but when I do

echo "out" > /sys/class/gpio/gpio17/direction (or  'echo out > /sys/class/gpio/gpio17/direction' )

no function of this command / something is crashing and even the "Network/swich" is crashing,

the network does not work anymore and the lights of all ethx's go on in 'dimmed'-modus on.

 

With other gpio's I are also not working:

->22 does no switch-crash, but shows error on 'out'-command

root@lamobo:~# echo "22" > /sys/class/gpio/export                                                                                                                                                           
root@lamobo:~# echo "out" > /sys/class/gpio/gpio22/direction
-bash: echo: write error: Unknown error 517

 

->14 no error on 'out'-command, but no PIN-function on hardware

root@lamobo:~# echo "14" > /sys/class/gpio/export
root@lamobo:~# echo out > /sys/class/gpio/gpio14/direction
root@lamobo:~# echo "0" > /sys/class/gpio/gpio14/value
root@lamobo:~# echo "1" > /sys/class/gpio/gpio14/value

 

How Do I get the/those(14,15,2,22,27,3) gpio's to work?

regards

 

 

gpio-3.4.113-kernel.png

gpio-BPi.png

 

 

gpio-R1.png

Link to comment
Share on other sites

Hi Tido,

 

thanks for fast answer.

R1 is AP and switch.

- Additional I control 4 LED's to check stuff/States

- 4 Inputs to controll my (smart)homeserver FHEM

- set some relais...

- get IR codes from remote control

- PIR to react on movements near to R1

 

I also need to use gpio for send 433MHz codes, now based on 3.4.113 and wiringpi and rc-switch

 

My first test with armbianIO failed:

root@lamobo:~/io/ArmbianIO# ./demo

 0=Le potato (Lamobo R1)
 1=Banana Pi M2 Zero (not 'Lamobo R1')
 2=Raspberry Pi (not 'Lamobo R1')
 ...
 15=Tinkerboard (not 'Lamobo R1')
Unrecognized board type, aborting...
Problem initializing ArmbianIO library

...no "Banana Pi" no "R1", this would be compatible...

I do not know if it is compatible to raspi???

 

 

But why is sysfs NOT working?

   echo "17" > /sys/class/gpio/export
   echo "out" > /sys/class/gpio/gpio17/direction
   cat /sys/class/gpio/gpio17/value
   echo "1" > /sys/class/gpio/gpio17/value

and why does 17 crash the switch?

 

Why is sysfs activated in this lamobo kernel if does not work?

other adresses/gpionumbers?

I do not understand the problem with sysfs...

 

 

 

 

Link to comment
Share on other sites

OK...I am smarter now...

CON3-P01     VCC-3.3V     
CON3-P02     VCC-5V     
CON3-P03     TWI2-SDA     PB21
CON3-P04     VCC-5V     
CON3-P05     TWI2-SCK     PB20
CON3-P06     GND     
CON3-P07     GPCLK     PI3
CON3-P08     UART3-TX     PH0    (8-1)*32+0=224 [3.4.113 old-gpio-number-> 14 RxD ] old-WiringPi-number 15
CON3-P09     GND     
CON3-P10     UART3-RX     PH1
CON3-P11     IO-0(UART2-RX)     PI19    (9-1)*32+19=275 [3.4.113 -> 17 ALT4 ]
CON3-P12     IO-1     PH2
CON3-P13     IO-2(UART2-TX)     PI18
CON3-P14     GND     
CON3-P15     IO-3(UART2-CTS)     PI17
CON3-P16     IO-4(CAN_TX)     PH20

 

works now by sysfs for physical-pin-8:

echo "224" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio224/direction
cat /sys/class/gpio/gpio224/value
echo "1" > /sys/class/gpio/gpio224/value

 

Now I have to test it 433mhz-transmitter also works with new adress...

 

Are those new adresses because of kernel change?

From 3 to 4 or 5 ?

Why?

 

 

 

 

Link to comment
Share on other sites

wiringpi does not see those changes:

/home/Funksteckdosen/433Utils/RPi_utils# cat /sys/class/gpio/gpio224/direction
out

/home/Funksteckdosen/433Utils/RPi_utils# gpio readall
 +-----+-----+---------+------+---+-Model  A-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |   IN | 0 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 0 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 0 | IN   | TxD     | 15  | 14=in-kernel-3.x   ,NOW in-4.xkernel 224  |
 |     |     |      0v |      |   |  9 || 10 | 0 | IN   | RxD     | 16  | 15  |

...
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model  A-+---+------+---------+-----+-----+

 

Has someone an idea to fix/convert this?

maybe in wiringpi?

I need this wiringpi-adresses for example

/home/Funksteckdosen/433Utils/RPi_utils/codesend 123...023

   nano codesend.cpp

      int PIN = 15; //wiringpi-definition, this shoud be gpio224
      fprintf(stderr, "\n PIN=%i",PIN);

 

433Utils/RPi_utils needs WiringPi...

 

 

Link to comment
Share on other sites

2 hours ago, pschasch said:

My first test with armbianIO failed:

This library aims to create simple wrapper functions for accessing I2C, SPI and creates a consistent numbering scheme for accessing GPIO ports based on the physical pin number.

Information about it  https://forum.armbian.com/topic/5655-armbianio-api-proposal/?do=findComment&comment=44769

How to: https://forum.armbian.com/topic/5655-armbianio-api-proposal/?do=findComment&comment=45825

 

Link to comment
Share on other sites

Ok, here my result from weekend for those who are interested:

 

armbianio needs patch for Lamobo(armbianio.patch):

------------------------------------------

...armbianio.patch

diff --git a/armbianio.c b/armbianio.c
+static int iLamobor1Pins[] = {-1,-1,-1,53,-1,52,-1,259,224,-1,
+                        225,275,226,274,-1,273,244,-1,245,268,
+                        -1,269,272,267,266,-1
+            ,270};
...

------------------------------------------

 

Sending 433-Mhz-codes now also work with WiringBPi on kernel >=4... with WiringPi it does not work.

 

Only thing I do still not unterstand is why on PI19(275) worked with 17 on 3.4.x

But, now my gpio's work like it should, if I change addresses like in io-3.x-vs-4-x.png

io-3.x-vs-4-x.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines