Unable to change GPIO values or directions

allanmitch
 
Posts: 5
Joined: Sat Jan 02, 2016 12:28 am

Unable to change GPIO values or directions

Sun Jan 31, 2016 2:57 pm

Hi,

I have a Vocore with Dock v2. I'm trying to make a doorbell that sends me a notification that someone rings the doorbell. But I'm having problems changing the value of GPIOs on the Vocore:

List all GPIO, their direction and value

Code: Select all
root@OpenWrt:~# cat /sys/kernel/debug/gpio
GPIOs 0-21, platform/10000600.gpio, 10000600.gpio:
 gpio-0   (gpio0               ) in  hi
 gpio-12  (gpio12              ) in  hi
 gpio-13  (gpio13              ) in  hi
 gpio-17  (gpio17              ) in  lo
 gpio-18  (gpio18              ) in  lo
 gpio-19  (gpio19              ) in  lo
 gpio-20  (gpio20              ) in  lo
 gpio-21  (gpio21              ) in  hi

GPIOs 22-27, platform/10000660.gpio, 10000660.gpio:
 gpio-22  (vocore:green:status ) out hi
 gpio-23  (gpio23              ) in  lo
 gpio-24  (gpio24              ) in  lo
 gpio-25  (gpio25              ) in  hi
 gpio-26  (vocore:orange:eth   ) out hi


Confirming state of GPIO0

Code: Select all
root@OpenWrt:~# cat /sys/class/gpio/gpio0/direction
in
root@OpenWrt:~# cat /sys/class/gpio/gpio0/value
1


Attempting to set GPIO0 value to 0 (low)

Code: Select all
root@OpenWrt:~# echo 0 > /sys/class/gpio/gpio0/value
ash: write error: Operation not permitted



Attempting to set GPIO19 value to 0 (low)

Code: Select all
root@OpenWrt:~# echo 0 > /sys/class/gpio/gpio19/value
ash: write error: Operation not permitted


I've also connected GPIO0 to a circuit powered by the 3.3V pin and a simple button. I've tried both pull down and pull up resistors. But pressing the button does not change the GPIO value. I tried the same thing on GPIO19.

Any ideas on what I'm doing wrong?

Allan

Vonger
 
Posts: 740
Joined: Sun Oct 19, 2014 6:00 am

Re: Unable to change GPIO values or directions

Fri Feb 05, 2016 1:50 am

Hi, it you want to change output data, the direction should be out(but not in).
echo out > ..../direction
echo 0 > ..../value

allanmitch
 
Posts: 5
Joined: Sat Jan 02, 2016 12:28 am

Re: Unable to change GPIO values or directions

Mon Feb 08, 2016 8:15 pm

Embarrassingly, I discovered that I had wired my breadboard incorrectly. Once I had the connections on the breadboard correctly set, the Vocore worked fine. Now, every time I close the doorbell switch, I get a change in GPIO value.

I wanted to change the input data. The GPIO0 direction was set to 'in' because pressing the doorbell sends a signal to the vocore. I set up the circuit to be pull up, so that when the doorbell was open the value was 0. Now, pressing the doorbell successfully changes the value to 1. When the doorbell switch is released, the value returns to 0.

Well, at least I learned a lot.

Return to VoCore & VoCore+Dock

Who is online

Users browsing this forum: No registered users and 1 guest