I was hoping to get some help with the imx53 loco board.
I can't get GPIO access to work.
I've set up the /sys/class sysfs support in the system using a new kernel.
With the ubuntu micro sd shipped with the qsb board (with newly flashed kernel)
I get permission denied when I try to echo 12 > /sys/class/gpio/export
With an ltib made rootfs and kernel
I get all the way through
echo 12 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio12/direction
echo 1 > /sys/class/gpio/gpio12/value
but the value doesn't change on the pin nor the actual file "value"
>cat /sys/class/gpio/gpio12/value
>0
I can change the direction just fine, however the value still eludes me.
I've also tried this on different ports, still nothing works.
Dear Fabio,
I am working on IMX53_smd (sabre tablet). since I was trying to toggle the LEDs in Linux ( charge and user debug D27, D32 from schematic ) which are connected to these pins :
MX53_PAD_EIM_D30__GPIO_30
MX53_PAD_PATA_DA_1__GPIO7_7
But these definitions are already registered in "iomux-mx53.h" and "mx53_smd.c"
so I tried to access the pins directly from sysfs like this....
for MX53_PAD_EIM_D30__GPIO_30 : "echo 94 > /sys/class/gpio/export
But when I do ls i count see any new directory..
for MX53_PAD_PATA_DA_1__GPIO7_7 I did "echo 199 > sys/class/gpio/export
Here also No directories created... I dont understand why .. Is it because these pins are already being used for Charge_done and USER_DEBUG ??
Another case :
I thought I will access the free GPIO pin on the expansion connector,
that is 40th pin on J78 i.e. MX53_PAD_GPIO_17__GPIO7_12
So i Added this pin in "../mach-mx5/mx53_smd.c" in static iomux_v3_cfg_t mx53_smd_pads[] array..
then i recompiled the kernel and deployed it, booted from SD card.
But when I try to access it : echo 204 > export
echo out > gpio204/direction
echo 1 > gpio204/value
But when i see the value it is still '0' and the Pin doesnt change. but direction has changed to "out"
What am I doing wrong here ... ??
Regards,
Winston.
Fabio,
Thankyou, for such a quick reply.
I had actually just discovered the GPIO7 issue. The User guide says that it is GPIO1_12, yet the io PIN mux tool available on the freescale site labeled it GPIO7_12, thank you for supporting that claim.
Also, thank you for going over the mux setup. The user guide just didn't make sense to me. I hope that I can return the favor.
No, GPIO_17 corresponds to GPIO7_12 in ALT1 mode.
So this is what you need to do:
1) Open arch/arm/mach-mx5/mx53_loco.c file and add the following enty to the mx53_loco_pads array:
MX53_PAD_GPIO_17__GPIO7_12,
This will let the kernel configure the MX53_PAD_GPIO_17 pad as GPIO7_12 function.
2) Rebuild and deploy the new kernel.
GPIO7_12 corresponds to (7-1)*32 + 12 = 204 GPIO number in Linux.
3) Access the GPIO as:
echo 204 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio204/direction
echo 1 > /sys/class/gpio/gpio204/value
echo 0 > /sys/class/gpio/gpio204/value
This should work fine.
Fabio,
I'm not sure I know how to do that.
Would you be willing to give me some instruction?
I've looked at the user guide where gpio is concerned and I'm a little confused on the pin muxing.
The exact pin I'd like to configure is GPIO_17 with an alternate name of GPIO1_12.
From the user guide and the hardware layout this pin can be probed via the 40th pin on J13 expansion header.
What is the name of the pin you are trying to access?
Have you setup the IOMUX for this pin as GPIO?
Regards,
Fabio Estevam