How to toggle GPIO of Colibri T20

I’m new to toradex family, somehow I managed to flash Linux image in colibri T20 SOM. Now I don’t know how to toggle GPIOs or get started with this board. Can anybody tell me how to toggle GPIO ?? thanks in advance.

Please refer our article on GPIO for Linux.

You might find the Getting Started page helpful as well.

simply, I tried to toggle particular GPIO ON/OFF through command line, there is no error in CLI but pin is not toggling. I’m referring this page

http://developer.toradex.com/knowledge-base/gpio-(linux)

Which exact pin did you try this on? How/where exactly did you measure it? Can you please provide output of the commands you tried? What hardware/software versions of things are you trying this with?

colibri Evaluation board V3.1A and module is Col.T20 512MB V1.2A.
I tried on SODIMM_55 , 56, 67 pins, I’m simply trying to toggle GPIO through LXTerminal
commands I used

  1. echo 55 > /sys/class/gpio/export
  2. echo “out” > /sys/class/gpio/gpio55/direction
  3. echo 1 > /sys/class/gpio/gpio55/value
    or
    echo 0 > /sys/class/gpio/gpio55/value
    but this didn’t work then I tried
    echo 0 > /0
    echo 1 > /1
    but this didn’t work too.
    what ever command I’m sending no effect on GPIO voltage level is same as you can see in Image.
    Image will give you clear Idea about my setup .

Can you please refer the article here?

SODIMM number and GPIO number are not equivalent. SODIMM 55 is GPIO 14 for the Colibri T20 and should be already exported.

Can you please try with already existing GPIO 14 and check?

when I try GPIO 14 it says device or resource busy. but when I try GPIO 22 no error message, can you please tell me where gpio 22 is located on col eval board 3.1A?? because I could not find it. the link you gave me shows gpio 22 is sysfs, what does that means??

What is the image version on the module?

root@colibri-t20:~# cd /sys/class/gpio/gpio14/                                                                            
root@colibri-t20:/sys/class/gpio/gpio14# cat direction 
in
root@colibri-t20:/sys/class/gpio/gpio14# echo out > direction 
root@colibri-t20:/sys/class/gpio/gpio14# cat value 
0
root@colibri-t20:/sys/class/gpio/gpio14# echo 1 > value 
root@colibri-t20:/sys/class/gpio/gpio14# echo 0 > value         

The above works fine on V2.6 Beta 1 using SODIMM 55 connected to LED 1 on Colibri Evaluation Board.

Image is same, now I’m frustrated, whole day wasted but could not able to toggle a single GPIO. uhhhh!!!
I tried your code as well but didn’t work.

Still didn’t get any solution… how It could be done???

As @Sanchayan already pointed, please note that SODIMM numbers are not actual GPIO numbers.
One need to find the actual GPIO number from the pin functions table in respective modules datasheet.
Only actual GPIO numbers are valid to access GPIO’s from userspace.

e.g.
SODIMM_PIN: 55 | Tegra GPIO name: GPIO_B6 | Actual GPIO number: 14

Refer this article for more information on finding actual GPIO numbers.

Seems you are trying to export the GPIO in sysfs which is already available.
We already exported all free IO’s as GPIO’s i.e those free IO’s are available in user-space via GPIO sysfs. For more information on available GPIO’s one can refer ‘# cat /sys/kernel/debug/gpio’
Instead of exporting again try setting the direction and toggle the IO.

thank!!

I’m done GPIO toggling through cross-tool chain. Clear my doubt–

  1. I can only access the free GPIO which are already exported, and can’t access other GPIO pins which are not exported, through sysfs. yes or no??

To access GPIO’s from user-space in Linux one need to access them via GPIO sysfs. Since free pins are muxed as GPIO’s we made those IO’s to be exported by default during boot. In general one need to export the GPIO in sysfs and access them.
NOTE:
If a pin is already used for some alternate function one cannot use that particular pin as GPIO.
To use that pin as GPIO one need to free the IO, pinmux it to GPIO and use it via GPIO sysfs from user-space.