GPIO pins ubuntu 14??

Drop in to chat about anything, or just to introduce yourself in the welcome to the board thread!

GPIO pins ubuntu 14??

Postby WITS-vlf » Tue Sep 08, 2015 6:54 pm

Has anyone used GPIO on the ubuntu 14 image. If so could you help me out, because currently in sys/class/gpio I do not have the gpio pins available , but only gpiocontrolers (like gpiochipXX). I suspect I should probably edit some sort of kernel config, but I have no idea how I would go about doing that. Any help would be much appreciated. Thanks in advance :)
WITS-vlf
 
Posts: 4
Joined: Tue Sep 08, 2015 6:46 pm

Re: GPIO pins ubuntu 14??

Postby Rysler » Wed Sep 09, 2015 3:29 am

Maybe you should have a look here:

viewtopic.php?f=3&t=701

and also here:

http://wiki.wandboard.org/index.php/External_gpios

Steps:

1) Create the GPIO (the gpio number is generated in the following way: (bank-1) * 32 + number)
2) Set the direction
3) Write/read

Regards!
Rysler
Rysler
 
Posts: 23
Joined: Mon Jun 29, 2015 11:48 am

Re: GPIO pins ubuntu 14??

Postby WITS-vlf » Wed Sep 09, 2015 12:03 pm

Thanks very much for the reply, I eventually figured out that the problem I was facing with exporting the gpio pin was due to a permission error and running "sudo echo pin(no) > /sys/class/gpio/export" does not work. The only solution is to switch to root user and then run the command. I'm just posting this for future reference.
WITS-vlf
 
Posts: 4
Joined: Tue Sep 08, 2015 6:46 pm

Re: GPIO pins ubuntu 14??

Postby Tapani » Thu Sep 10, 2015 8:00 am

Right, redirection with '>' forgets about users. So your echo runs as root and the redirection as your mortal user.

My usual trick is to use 'dd' instead of '>':
Code: Select all
echo $PIN | sudo dd of=/sys/class/gpio/export
Tapani
Site Admin
 
Posts: 701
Joined: Tue Aug 27, 2013 8:32 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests