Home/Support/Support Forum/Control GPIO1_2, GPIO1_9 as output
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Control GPIO1_2, GPIO1_9 as output

0 votes
I want to control GPIO1_2 and GPIO1_9 as output.

Currently when I am tring to control both of this GPIO using SysFs, but it is not working properly.

$ cd /sys/class/gpio
$ echo 9 > export
$ cd gpio9
$ echo out > direction
$ cat value
0
$ echo 1 > value
0

I am using DigiKey iMX53 based evalution kit. Do I need to chnage any thing in kernel?

If yes please guide me where.
asked Sep 16, 2015 in Embedded Devices by kaival New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
the procedure appears to be correct, but you should make sure there are no perepheral driers enabled in kernel that are using this pin. Please first try gpio_test and gpio_sysfs_test sample apps. See if they work as is. Then try to toggle GPIOs used in those apps (user buttons and user LEDs) from user space in the manner you describe above. once you have it working you can go back to GPIO you are trying to control.
for example:
GPIO_17 pad is already being configured to be used as user led 2 in mx53_ccwmx53js_io_init(), so we don’t need kernel changes. To drive it, we can do it from user space:

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

you should observe LED toggle at this point.
answered Sep 17, 2015 by LeonidM Veteran of the Digi Community (3,557 points)
...