On Sun, Feb 7, 2016 at 3:03 AM,  <[email protected]> wrote:
> Hi Everyone,
>
> I am new to beaglebone black linux and looking for some support for the
> issue I am facing. I have been following Derek Molleys video tutorials on
> how to configure and program the GPIO's here
> http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/.
> Everything was going fine, until I encountered this weird bug that has to do
> something with the memory segments I believe. Searched on net and came
> across someone who had faced the same issue here
> https://groups.google.com/forum/#!topic/beagleboard/Xe-oIuQOeI8, did the
> respective changes in the code as suggested, yet I keep getting
> segmentation fault error and the execution stops while displaying "Could not
> set the direction of the pin". Here is the code I am trying to fix,
>

>     sprintf(Inputpin_dir,"sys/class/gpio/gpio%d/direction",inputpin);
>...
>     //Set the direction of the pin
>     if((ButtonHandle = fopen(Inputpin_dir, "rb+"))==NULL)
>         {
>           printf("Could not set the direction\n");
>           return 1;----------------> Control comes here and display "Could 
> not set the direction and segmentation fault
>         }

The value for the sysfs node is not correct (you're missing the
initial /). I don't know where the SEGV comes from: compile with with
the -g flag and run under gdb, and it'll tell you which line is the
SEGV in.

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to