GPIO Using Fedora 18 on pcDuino

- - posted in Hardware, Linux, Unix, fedora

A Mini PC with Arduino type Interface powered by ARM Pro Spec A Mini PC with Arduino type Interface powered by ARM Pro Spec

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:
    sh <uboot-part-mount>/select-board.sh
  • Select the cubieboard
  • Clone the linux-sunxi/sunxi-tools on your Linux box (not the pcDunio)
  • Compile by typing make Don’t worry if it doesn’t compile everything. The two commands we need – bin2fex and fex2bin will be compiled in that directory
  • Mount your microSD card and grab the script.bin file from the pcDuino (/boot/uboot/script.bin)
  • 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 [gpio_para] into your myboard.fex file at about the same place they were in the pcduino.fex file
  • Convert it back to bin format with fex2bin myboard.fex > script.bin
  • Move it back into place as /boot/uboot/script.bin

  • Unmount your sdcard from your Linux box and boot your pcDuino – it’s got new superpowers now.
  • Follow the guide at elinux.org
  • PROFIT

Bash shell script that blinks the LED

Pic or it didn’t happen