Read the Kernel docs to learn how to do this correctly. If you have the kernel 
source, the docs are under /Documentation/gpio. The board.txt file will explain 
how to access the DTS definitions for the GPIO. In the DTS, you will define 
which GPIO are allocated to your driver. The driver.txt file will explain how 
to use the generic gpio library to set gpio direction and how to read/write 
from/to the gpio defined in the DTS.

Look at /driver/gpio/gpiolib to learn about the generic gpio interface. Also 
look at /driver/gpio/gpio-omap to see how the generic interface is implemented 
on the AM335x. Specifically, the gpio_bank and gpio_chip are the two structures 
that do everything you need. 

Regards,
John




> On Jun 12, 2016, at 11:37 PM, Raul Piper <[email protected]> wrote:
> 
> I modified the app a bit and  tried running this code on the BBB  under sudo 
> mode :
> 
>         gpio_export(gpio);
> //      gpio_set_dir(gpio, 0);
>         gpio_set_dir(gpio, 1);
>         gpio_set_edge(gpio, "rising");
>         gpio_fd = gpio_fd_open(gpio);
>         printf("debug_1 \n");
>         gpio_set_value(gpio,1);
>         sleep(1000);
>         gpio_set_value(gpio,0);
>         printf("debug_2 \n");
> 
> but I see App stuck @debug_1 and getting this error : 
> gpio-49(sysfs):_gpiod_direction_output_raw:tried to set a  GPIO tied to an 
> IRQ as output.
> 
> I even tried this : 
> 
>      gpio_set_dir(gpio, 0);
>   //      gpio_set_dir(gpio, 1);
> 
> in this I don't get the error but again the App hangs at the same point.
> 
> What I am doign wrong here?My intent is to Set -reset the GPIO1_17 ( that is 
> p9 header pin P9_23) that  is GPIO 17 of 32 (0–31) on the second GPIO chip of 
> four (0–3).
> Am I choosing the wrong GPIO.?
>  
> 
> 
> 
> On Monday, June 13, 2016 at 9:41:34 AM UTC+5:30, Raul Piper wrote:
> CEB, 
> On which platform you tested this?Did you get any issue?Set/Reset of any GPIO 
> works fine on any kernel?4.x+?
> Rp
> 
> On Friday, June 14, 2013 at 2:01:51 AM UTC+5:30, CEB wrote:
> Take a look at https://developer.ridgerun.com/wiki/index.php/Gpio-int-test.c 
> <https://developer.ridgerun.com/wiki/index.php/Gpio-int-test.c>
> 
> Worked for me.
> 
> CEB
> 
> On Wednesday, June 12, 2013 12:46:04 AM UTC-4, MH wrote:
> Just want to start a discussion.  Who all is working or maybe even found a 
> means of controlling the GPIO in C for Beaglebone Black?  I have been hunting 
> for a while and haven't found anything reliable. 
> 
> -- 
> For more options, visit http://beagleboard.org/discuss 
> <http://beagleboard.org/discuss>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beagleboard/c6abe7ba-c08d-42de-8d9a-685a24a4a810%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beagleboard/c6abe7ba-c08d-42de-8d9a-685a24a4a810%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/73F119C2-8CA5-4C3C-A8AC-BC5998B9A227%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to