GPIO not functioning..

Hi all,
I have a beagleboard clone [DEV 3530] .. i compiled the kernel given
by them according to the instructions in the manual..

i wrote a shell script as follows:

echo 72 > /sys/class/gpio/export

while [ "1" = "1" ]; do
echo "high" > /sys/class/gpio/gpio72/direction
sleep 2
echo "low" > /sys/class/gpio/gpio72/direction
sleep 2
done

echo 72 > /sys/class/gpio/unexport

this code is getting executed but, i could not see any output on
gpio72.

i built my angstrom for a different board [ omp3evm ], but the kernel
is built for the same board, does it have any issues with gpio
functioning?

thankyou..

Hi,

echo 72 > /sys/class/gpio/export
echo “out” > /sys/class/gpio/gpio72/direction
echo “1” > /sys/class/gpio/gpio72/value
echo 72 > /sys/class/gpio/unexport

Thanks and Regards
Nikhil

Thanks and regards
Nikhil

some one’s help is needed…

Could you please also show an example for input?

Set digital or analog?
Analog out?

Thanks,
Mark

@Nikhil, i made the changes said by you.
But, still i could not see any output.
What must have gone wrong?

possibile error…

Hi yaswanth,

I suspect you are not doing the PINMUX configuration…
You have to select the PINMUX so that the GPIO’s are selected and then follow the steps explained by nikhil…

hope this helps…

Thanks,
lokesh Kumar

I do not believe that there is any problem with the PIN mux.
Yaswanth, you should probably take a look at the following website:

http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#Getting_access_to_a_GPIO

There is a brief explanation with nice examples and how to use the
GPIOs in Linux.
Regards,
Frederico

@Fredrico, i had written my code following that link … but, i still get the error.
@ lokesh, how do we pinmux it? Doesn’t kernel take care of that ? Do we need to do it ourselves?

Thank you

For selecting particular gpio pin the following steps to be done

  1. set the pinmux value for particular GPIO pin. you can get pinmux values from
    Ref. guide .
  2. Then follow below steps

echo 72 > /sys/class/gpio/export
echo “out” > /sys/class/gpio/gpio72/direction
echo “1” > /sys/class/gpio/gpio72/value
echo 72 > /sys/class/gpio/unexport

hope this helps …

yeah. But, how to do it in shell scripting?
GPIO Documentation doesn’t give any info about pinmux… does it?

You could do pinmux setting in the shell script with the devmem2 utility.
See following blog post, which explains it. It's all really in Ref.Guide.

http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=56&Itemid=63

Hope this helps,
Maksym.

Hi Yaswanth

Yes … the GPIO Documentation will not give you any information about pinmux…
You have to search in the Reference Guide or any other Documentation which explains about PINMUX of that processor usually it should be in Reference Guide…

and if you want to initalize pinmux in shell scripting then you have devmem command which you can use it…

Thankyou, i will let you guys know the result after i try using devmem