Other Parts Discussed in Thread: AM3517
Hi, I wanna control am3517 gpio drive a led in linux driver, but I can not control the pin output that what i want?
Can anynone give me an example? thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I just figured this out myself. The first thing to do was to ensure that the pin I wanted was set to a GPIO. Since I'm using the AM3517 evm I edited the u-boot file for the pin mux settings (AM3517evm.h). You could also use the Pin Mux Utility.
Then I rebuilt and reloaded U-boot, and rebuilt and reloaded the kernel.
Then I used the steps to access the GPIO through sysfs as described in this post:
http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/416/p/106693/376227.aspx#376227
To control the GPIO from within a simple C program, I followed what was written here:
http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:gpio-sysfs
There is a similar file from TI in the PSP (linux-03.00.00.05/drivers/gpio/gpiolib.c), but this one was easier for me to understand as it was more basic.
I don't know if you want to control GPIO from the userspace, but it worked for my test at least. Hope that helps.