Hello, I am trying to access GPIO pins in mini2440. For that I wrote: echo 160 > /sys/class/gpio/export I got the error "Permission denied" error whether I am in the root or not. So I executed: chmod 777 /sys/class/gpio/export and then tried again: echo 160 > /sys/class/gpio/export This time I got the error: bash: echo : write error: Invalid argument So I tried: sh -c echo 160 > /sys/class/gpio/export This time there was no error but no folder named "gpio160" is created in /sys/class/gpio Please help me with the exact commands to access GPIO pins.
configuring the kernel for GPIO access
Try reading through this first: http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO then tells us which GPIO pins are actually available on your platform. There is a good example in the QuickStart guide for the mini2440 on the Pengutronix site.
I read the article you have linked. The pins GPF0 to GPF5, GPG 2,3,5,6,7,9,10,11 and GPE 11,13,14,15 are available for use on my board according to the schematic on friendlyarm site. However, in my /sys/class/gpio folder, there are only two files - export and unexport. The "gpiochipN" folders which are mentioned in the doc are not present.Does this mean my kernel is not properly installed or do I need to get some additional drivers ? Thanks & Regards
I also tried installing the driver " config_mini2440_t35_gpio_spi.zip (10.63 KB)" by Eric Brombaugh you have mentioned in one of your posts. Still, I can't see the "gpiochipN" folder in /sys/class/gpio.
What the schematic says and what the platform actually delivers are two significantly different things. Are you using the FriendlyArm 2.6.32 kernel? It has been a few years since trying to do things the way Eric did but I suspect installing the driver is still only part of the job. Have you enabled support in the kernel for GPIO and if wanted SPI? And re-compiled it? If this is a learning exercise ... keep working at it, if you want something that works with less pain see the mini2440BSP at Pengutronix.
Yes, I am using FriendlyArm 2.6.32 kernel. I have also enabled the GPIO support (sysfs driver) while configuring the kernel and re-compiled it. Can you tell me how do we know the pins which the platform actually delivers?
I thought you just have another look in /sys/class/gpio and they should now be there. If they are not then it sounds to me like you really didn't re-configure your kernel. Also, they should appear in /your_linux_source/drivers/gpio ?? I haven't got gpio enabled so don't know for sure. Maybe, /your_linux_source/arch/arm/mach-s3c2440 ??