sadkhann Posted May 22, 2019 Posted May 22, 2019 Hello friends; I have board which Orange Pi Win Plus running Armbian. My problem is, boards 7, 8, 10 and 16 physical pins are not working. When I tried to I/O with this pins, console says: Segmentation Error. Is it possible to fix it or is it normal? Thank You.
martinayotte Posted May 22, 2019 Posted May 22, 2019 4 minutes ago, sadkhann said: My problem is, boards 7, 8, 10 and 16 physical pins are not working Do you mean S_PWM, S_UART_TX, S_UART_RX and PL9 according to schematic ? 5 minutes ago, sadkhann said: When I tried to I/O with this pins, console says: Segmentation Error. How do you try it ? Which image are you running ?
sadkhann Posted May 22, 2019 Author Posted May 22, 2019 I added screenshot and marked yellow dot the unworking pins. I running Armbian which Armbian Xenial desktop legacy kernel 3.10.y and before this image I tried Armbian Stretch mainline based kernel 4.19.y and Armbian Bionic desktop mainline based kernel 4.19.y both I can work with other pins with no problem but these pins are not working. #include <stdio.h> #include <wiringPi.h> // LED Pin - wiringPi pin 0 is BCM_GPIO 17. #define LED 15 int main (void) { printf ("Raspberry Pi blink\n") ; wiringPiSetup () ; pinMode (LED, OUTPUT) ; for (;;) { digitalWrite (LED, HIGH) ; // On delay (500) ; // mS digitalWrite (LED, LOW) ; // Off delay (500) ; } return 0 ; }
martinayotte Posted May 22, 2019 Posted May 22, 2019 2 hours ago, sadkhann said: I can work with other pins with no problem but these pins are not working. All those pins are on PL gpio bank. This bank is powered with 1.8V instead of 3.3V on other banks. So, if you connect something one those, you need to be aware about voltage level and maybe need a voltage shifter. To test them and check them with voltmeter, you can use gpio sysfs, here an example : echo 354 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio354/direction echo 1 > /sys/class/gpio/gpio354/value For the "Segmentation Error", it maybe simply a bug of wiringPi not been able to access PL PinController (pinctrl@1f02c00) which is not the same for all other banks (pinctrl@1c20800) ...
sadkhann Posted May 22, 2019 Author Posted May 22, 2019 Thank you for replying me I am so glad. I realized what you are considering. The codes you write, do I write them console or a file? I haven't done this type of stuff, can you explain a little bit deeper?
sadkhann Posted May 22, 2019 Author Posted May 22, 2019 Now I tried a lot and find the solution with your help. In your way the GPIO pins looks fine but how to I control them? The classical way of gpio mode 16 out gpio write 16 1 not works with this pins.
martinayotte Posted May 22, 2019 Posted May 22, 2019 58 minutes ago, sadkhann said: do I write them console or a file? As written above was at the console/shell, but you could write a bash script too, here is a blinking script : #!/bin/bash echo 354 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio354/direction while true ; do echo 0 > /sys/class/gpio/gpio354/value spleep 0.25 echo 1 > /sys/class/gpio/gpio354/value spleep 0.25 done 19 minutes ago, sadkhann said: In your way the GPIO pins looks fine but how to I control them? The above way ... Or you can also use python library such pyA64 from https://pypi.org/project/pyA64/ #!/usr/bin/env python """Basic blinking led example. """ import os import sys if not os.getegid() == 0: sys.exit('Script must be run as root') from time import sleep from pyA64.gpio import gpio from pyA64.gpio import port led = port.PD5 gpio.init() gpio.setcfg(led, gpio.OUTPUT) try: print ("Press CTRL+C to exit") while True: gpio.output(led, 1) sleep(0.1) gpio.output(led, 0) sleep(0.1) gpio.output(led, 1) sleep(0.1) gpio.output(led, 0) sleep(0.1) sleep(0.6) except KeyboardInterrupt: print ("Goodbye.")
sadkhann Posted May 22, 2019 Author Posted May 22, 2019 Thank you so much I am so glad I will try them.
Recommended Posts