On Thu, 2013-10-10 at 13:16 +0100, luke.leighton wrote:
On Thu, Oct 10, 2013 at 1:13 PM, joem joem@martindale-electric.co.uk wrote:
Hi Luke or anyone,
Need to know specific commands to turn on/off EOMA gpio lines for some testing.
i just released an example script, it was my previous post (literally the previous one), you need a sunxi 3.4 kernel to use it. if you're using 3.3 let me know, i have another alternative. the modules to load are different in each case but search "GPIO" in the kernel config you'll find them easily.
OK I got kernel 3.4, and I found this script posted earlier:
#!/bin/sh
cd /sys/class/gpio
echo 1 >export echo 2 >export echo 3 >export echo 4 >export echo 5 >export echo 6 >export echo 7 >export echo 8 >export echo out > gpio6_pf3/direction echo out > gpio5_pf2/direction echo 0 > gpio6_pf3/value echo 1 > gpio5_pf2/value sleep 1 echo 0 > gpio5_pf2/value
Found nothing of importance in kernel config.
Then I find this in script.fex which maps gpio pin names to specific physical port pin:
[gpio_para] gpio_used = 1 gpio_num = 8 gpio_pin_1 = port:PB02<0><default><default><default> gpio_pin_2 = port:PI03<0><default><default><default> gpio_pin_3 = port:PF00<0><default><default><default> gpio_pin_4 = port:PF01<0><default><default><default> gpio_pin_5 = port:PF02<0><default><default><default> gpio_pin_6 = port:PF03<0><default><default><default> gpio_pin_7 = port:PF04<0><default><default><default> gpio_pin_8 = port:PF05<0><default><default><default>
Is that about right? There are only 8 gpio port pins available and they are PB02, PIO2, PF0..5?
Example to turn bit pf2 on for 1 second is:
#1. make available the GPIO pins
cd /sys/class/gpio echo 1 >export echo 2 >export echo 3 >export echo 4 >export echo 5 >export echo 6 >export echo 7 >export echo 8 >export
#2. Turn pf2 to output and turn on LED cd /sys/class/gpio echo "out" > gpio5_pf2/direction echo 1 > gpio5_pf2/value
#3. Pause for 1 second and turn back to logic 0 sleep 1 echo 0 > gpio5_pf2/value
#4. Read from pf3 and store into a file cd /sys/class/gpio echo "in" > gpio5_pf3/direction cat gpio5_pf3/value > ~/pf3_value.txt
If all that is correct, create a web page and I update all the details.