Read GPIO problem
#1
I use Pine64 A64-DB-Rev B board and Debian Jessie.

I need read some GPIO pins (69 and 233 on RPI connector) using sysfs. I use pullup resistors (10k) to 3.3v. Measure voltage on these pins. I get 3 v.
Set direction to 'in'.
But, reading /sys/class/gpio/gpioXX/value i always got 0 !

If switch direction to out, then back to in, reading get 1 ! 

Simple script to test:

Code:
#!/bin/sh

SYSFSDIR=/sys/class/gpio
DOOR_PIN=69
UPLVLPIN=233

setup(){
   if [ ! -d $SYSFSDIR/gpio$1 ] ; then
       echo $1 > $SYSFSDIR/export
   fi
   # If comment out these 2 lines - always read 0 !
   echo 'out' > $SYSFSDIR/gpio$1/direction
   echo 'in' > $SYSFSDIR/gpio$1/direction
}

gpio_read(){
   cat $SYSFSDIR/gpio$1/value
}

setup $DOOR_PIN
setup $UPLVLPIN

case "$1" in
   door)
       gpio_read $DOOR_PIN
       ;;
   uplevel)
       gpio_read $UPLVLPIN
       ;;
   *)
       usage
       ;;
esac

PS: Sorry for my bad english, my native language is Russian Wink
  Reply


Messages In This Thread
Read GPIO problem - by shworker - 02-21-2017, 04:00 AM
RE: Read GPIO problem - by Techsensei - 02-21-2017, 06:41 AM
RE: Read GPIO problem - by shworker - 02-21-2017, 08:58 AM
RE: Read GPIO problem - by MarkHaysHarris777 - 02-22-2017, 04:23 AM
RE: Read GPIO problem - by aromring - 08-05-2017, 09:59 PM
RE: Read GPIO problem - by MarkHaysHarris777 - 08-05-2017, 10:24 PM
RE: Read GPIO problem - by pfeerick - 08-06-2017, 01:33 AM
RE: Read GPIO problem - by MarkHaysHarris777 - 08-06-2017, 10:38 AM
RE: Read GPIO problem - by pfeerick - 08-07-2017, 12:11 AM
RE: Read GPIO problem - by MarkHaysHarris777 - 08-07-2017, 07:21 AM
RE: Read GPIO problem - by pfeerick - 08-07-2017, 07:21 PM
RE: Read GPIO problem - by MarkHaysHarris777 - 08-07-2017, 11:10 PM
RE: Read GPIO problem - by pfeerick - 08-08-2017, 06:20 PM
RE: Read GPIO problem - by MarkHaysHarris777 - 08-15-2017, 02:24 AM
RE: Read GPIO problem - by martinayotte - 08-17-2017, 01:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  RPi.GPIO python module for Pine A64/A64+ aquilegia 97 144,534 02-23-2022, 02:56 PM
Last Post: ncs
  fm transmitter with gpio weasel18 2 5,343 09-10-2019, 04:28 AM
Last Post: desai_amogh
  How to use dts or other setup to declare gpio pin Interrupt (e.g. a button)? dkebler 1 3,916 06-12-2019, 10:37 AM
Last Post: dkebler
Lightbulb Sample GPIO codes highlighting RPi.GPIO-PineA64 and the PI bus MarkHaysHarris777 6 12,135 06-07-2019, 12:37 AM
Last Post: tllim
Star GPIO, SPI and I2C C++ Lib databit 7 12,242 02-04-2019, 05:45 AM
Last Post: Jeff R
Information Howto: Controlling Pine64 GPIO via the filesystem (sysfs) on linux pfeerick 4 12,586 01-24-2019, 03:36 AM
Last Post: Fifth
  GPIO and SPI SamR1 20 34,403 03-15-2018, 10:32 AM
Last Post: jomoengineer
Question GPIO shockr 7 16,028 03-11-2018, 01:52 AM
Last Post: jomoengineer
  GPIO fiq capability joseph 3 6,668 11-10-2016, 06:07 PM
Last Post: joseph
  RPI2-GPIO mus1c 6 10,037 09-22-2016, 05:28 AM
Last Post: mus1c

Forum Jump:


Users browsing this thread: 1 Guest(s)