Freescale i.MX 6 & linux & gpio led example

Hello

Sorry for my simple question but the problem is very basic, also I didn’t solve it for a day.
I cannot use gpio to blink a led. I tried to use GPIO Tool but not succeed, and also tried to open via console as described at websites but I could not solved the issue.

I realized the problem is the pin numbers. in board I am using x27.21 GND and x27.18 for GPIO6,
in terminal

echo 6 > /sys/class/gpio/export

echo “out” > /sys/class/gpio/gpio6/direction

echo 1 > /sys/class/gpio/gpio6/value

it now should make the led turn on bu it doesn’t !!!

when I type

cat /sys/kernel/debug/gpio

  • gpio-0 (usb_host_vbus ) out lo
  • gpio-4 (Wake-Up ) in hi
  • gpio-6 (sysfs ) out lo
  • gpio-8 (sysfs ) out lo
  • gpio-25 (phy-reset ) out lo

Please just give me an example to only turn on a led at this context with very basic.

my environment: SoC → apalis imx6 ; board → ixora carrier board

thank you.

alt text

For Ixora and IMX6 Apalis this pin is Linux GPIO No. 169, not 6.

Thanks for reply, how do we get that conclusion, can you explain please

Please find GPIOs explained here and remember to check resp. pin muxing as well and here for the Linux GPIO number.

Allright I have done it and read it but now I could not figured out how to find imx6 pin name(alt5).
any help for it ?
Thanks for reply

alt text

I am not sure to understand your question. So which pin do you want exactly to toggle?
One way to do this is to first to check the Pin you want to use on the Ixora Board. Once you know this, then locate the Sodimm Pin of the module. After this you can know the Gpio number in Linux as explained by marcel.tx above.

an example

in documentation it says this is the formula

Linux numeric representation = [(x-1)*32]+y

this is wanted gpio pin → x27.18

you can see above the image

so I need imx6 name (alt5) → GPIO6_IO09

if I put it in formula [(6-1)*32]+9 = 169

then I reach the what I want, but above the example or any where I couldn’t find the imx6 name’s of pins

are there any of formula for calculating the imx6 names(alt5) or something else ?

Thanks.

also can you give me an example #

I want to access to GPIO8 for example in the image that I present above. Then how do you find the number, just give me a simple solution

Thanks.

Hi

So the GPIO8, (X27.20) on IXORA is the MXMPIN 17 on the module. Once you have this, you go to chapter 4.4 of the Datasheet of Apalis Imx6. There the X1Pin represents the Pin of the MXM3 Connector and you can find out the alt5 or gpio number. From this you can calculate the linux pin number. As already said, you need to check also if the PIN is correctly muxed for GPIO.

Thanks for valuable answer, I am appreciated, and this is the solution for me.

You are welcome.