AnsweredAssumed Answered

i.MX28 GPIO access

Question asked by chris321 on Jun 27, 2013
Latest reply on Jun 30, 2013 by chris321

Hello Freescale Community,



I have some trouble adding GPIO support on a i.MX28 Pin.



There is a two color LED on the Pins K4 and L4.



I'm using an 3.9 Kernel and it seems to run a Heartbeat on the LED on Pin K4.



I figured out with the file fsl,mxs-pinctrl.txt that the IDs are:


MX28_PAD_AUART1_RX__GPIO_3_4            0x3043

MX28_PAD_AUART1_TX__GPIO_3_5            0x3053


So I modified the imx28-evk.dts by copying something similar from the GPIO_3_5 to 3_4.


                led_pin_gpio3_4: led_gpio3_4@0 {

                    reg = <0>;

                    fsl,pinmux-ids = <

                        0x3043 /* MX28_PAD_AUART1_RX__GPIO_3_4 */


                    fsl,drive-strength = <0>;

                    fsl,voltage = <1>;

                    fsl,pull-up = <0>;



then I crosscompiled this dts to a dtb and attached it to the zImage


cat arch/arm/boot/zImage arch/arm/boot/dts/imx28-evk.dtb > arch/arm/boot/zImage_dtb

sudo cp arch/arm/boot/zImage_dtb ~/freescale/imx28/ltib/rootfs/boot/zImage


Now I tried to switch the LED GPIO on and off


Linux GPIO Number = <GPIO Instance – 1> × 32 + <GPIO Port number> = (3-1)*32+4 = 68

(found this formula here which document is the source?)


echo 68 >/sys/class/gpio/export

echo out >/sys/class/gpio/gpio68/direction

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

echo 0 >/sys/class/gpio/gpio68/value


but the LED did not go on and off, have I forgot something?