GPIO

What do you need:

 * Kernel with SUN4I_GPIO_UGLY = y (soon I will write an article how to compile your own kernel for A13 )
 * sunxi-tools from https://github.com/amery/sunxi-tools ( this is for the bin2fex and fex2bin tool )

The Process
- Open a console and connect to your A13.

- Make a directory in /media: mkdir /media/nanda

- Mount the nanda there: mount /dev/nanda /media/nanda

- Copy the file /media/nanda/script.bin to your PC. This file configures the A13.

- Now we need to make it a text file so we use the bin2fex. On a linux machine go into the directory where you compiled the sunxi-tools and from there type this: ./bin2fex /path/to/script.bin > script.fex This will create a text file named script.fex in your current directory.

- Now we need to edit it with a text editor and define the pins that are going to be used for GPIO. Look for a section named "[gpio_para]" if there is no such section (probably there will not be) go to the bottom of the file and add it like this:

 [gpio_para] gpio_used = 1 gpio_num = 1 gpio_pin_1 = port:PE11<1>

gpio_used - do you want to use gpio 1-yes 0-no gpio_num - the number of gpio ports you want gpio_pin_N = PXN where N is the gpio pin number starting from 1, X is 1 for output or 0 for input GPIO PIN,PXN is the name of the pin you want to use. In this example I used pin PE11 wich is pin number 12 on the GPIO-2. The PXN names can be found here: http://linux-sunxi.org/A13-OLinuXino#Expansion_ports. TO CHECK: when I used PE11 this pin is part of the [csi0_para] so I went to [csi0_para] and made csi_used = 0 Not sure if this is needed, but I think it is.

- Now we need to make the modified fex file back to bin format so again from the directory where you compiled the sunxi-tools: ./fex2bin script.fex > script.bin

- Now put back the script.bin on the board and overwrite the old script.bin in /media/nanda

- Unmount the /media/nanda: umount /media/nanda - Reboot the A13

- Log back in and now if you did everything correct in /sys/devices/virtual/misc/sun4i-gpio/pin you will see "pe11" - If you solder a LED and a resistor to the right pin and ground (for example pin 2) http://linux-sunxi.org/images/e/e7/A13-olinuxino-brd.png and type: "echo 1 > /sys/devices/virtual/misc/sun4i-gpio/pin/pe11" the LED will light and "echo 0 > /sys/devices/virtual/misc/sun4i-gpio/pin/pe11" will turn it off.

C++ program
Comming soon

Other stuff
Comming soon