[vc_row][vc_column width=”1/1″][vc_column_text]Original: http://conecuh.com/2013/04/gpio-using-fedora-18-on-pcduino/
I recently purchased a pcDuino because of it’s plenitude of I/O (5v) GPIO pins. My Raspberry Pi was an interesting board, but it lacked the GPIO and Analog to Digital inputs that make the Arduino so useful. The Arduino, while imminently useful, lacks the power to handle images and other high-bandwith tasks so it’s relegated to motor control and simple I/O.
The pcDuino comes well-outfitted compared to both the Raspberry Pi and the Arduino:
* CPU: 1GHz ARM Cortex A8 * GPU: OpenGL ES2.0, OpenVG 1.1 Mali 400 core * DRAM: 1GB * Onboard Storage: 2GB Flash, SD card slot for up to 32GB * Video Output: HDMI * OS: Linux + Android * Extension Interface: 2.54 mm Headers compatible with Arduino * Network interface: RJ45 and USB WiFi Dongle
Once I saw the horrid version of Lubuntu that came pre-installed on the device, I started looking for a Fedora port. Luckily Hans de Goede has published a Fedora port for the Allwinner 10 chip. Loading this was simple and straightforward – just follow the README
Then came the task of accessing the GPIO. The Lubuntu image that came with the device exposed some GPIO pins at
/sys/devices/virtual/misc/gpio, but Fedora did not show any pins there. After a couple of days of probing the Internet for the source, I stumbled across the amazing GPIO sysfs capabilities of Linux.
After following the guide on elinux.org, I was still unable to access *any* GPIO. Then I remembered that I chose “cubieboard” when I loaded the port by Hans. More hunting revealed uboot, sunxi-tools and the
script.bin file. Following are the rough instructions on how to get access to the GPIO on your pcDunio in Fedora…
Start with the Fedora port by Hans de Goede.
- In step 6 when it asks you to select a board with:
- Select the cubieboard
- Clone the linux-sunxi/sunxi-tools on your Linux box (not the pcDunio)
- Compile by typing
makeDon’t worry if it doesn’t compile everything. The two commands we need –
fex2binwill be compiled in that directory
- Mount your microSD card and grab the script.bin file from the pcDuino (
- Convert it to fex format
bin2fex script.bin > myboard.fex
- Grab the pcDuino fex file from linux-sunxi / sunxi-boards
- Copy the lines from section
myboard.fexfile at about the same place they were in the
- Convert it back to bin format with
fex2bin myboard.fex > script.bin
- Move it back into place as
- Unmount your sdcard from your Linux box and boot your pcDuino – it’s got new superpowers now.
- Follow the guide at elinux.org
Bash shell script that blinks the LED
Download the code here