Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Fun with a PC104 board, embedded Linux and wifi

Posted by Jim Morris on Wed Oct 21 01:32:16 -0700 2009

Around 10 years ago I was playing with some home robotics, built a simple robot, with some sensors and an on-board Linux-based PC. The purpose was to experiment with Robot AI, a continuation of my PhD thesis I started on some 30 years ago, but did not complete.

The robot had a camera, a digital compass, a sonar scanner and a short range IR range detector, plus some bump detectors. I could control it over a wifi connection, that was a Orinoco PCMCIA board plugged into the PC104, 586 based Linux PC that was on-board. All powered by several batteries.

I ran out of time and interest and energy and shelved the project. 10 Years later I stumbled upon a relatively cheap camera, wifi based robot called a Rovio made by Wowwee, its basically a toy, but a cool one. The Rovio has much better manouverability than my feeble attempt, and it has a camera and is controlled over Wifi by some well documented HTTP calls.

I bought one of these gizmos to play with, and to "use" as a remote security camera to check on the dogs when I am not home. It fired up my Robot hobby enthusiasm, and as I have a lot of time on my hands these days I dug out all my old stuff, which I had mostly forgotten, and dusted off the old PC104 embedded system and tried to get it up and running again. I'm not sure what I'll use it for but it was pretty expensive back in the day, so I'll find some use for it. Maybe I'll stick it on the Rovio to give it some more computing power.

Anyway things have changed a lot since then, a PC104 is ISA based, and this board had no USB ports, but I did have a PCMCIA slot, which was 5v 16 bit only. This posed a problem as all PCMCIA cards today are Cardbus 3.3v and usually 32 bit. The only wifi card I had that was 5v was the old Lucent Orinoco 802.11b card. But my AP these days is a WPA/WPA2 based 802.11b/g.

The first fun thing was to get wpa_supplicant running on this old thing, if possible. I mentioned no USB because one workaround was to use a newer wifi card, I also wanted to use some flash drives. But this turns out to be impossible as no ISA/PC104 USB cards were ever built (according to an extensive Google search).

The board has 32Mb of RAM, and that was fully loaded, it also ran WhiteDwarf Linux out of a 32Mb disk-on-a-chip board that plugs into the IDE socket. The old version of WDLINUX I had definitely would not run the newer Hermes Linux drivers and wpa_supplicant. I found that Whitedwarf is still in business and have a newer version of wdlinux2.2. This is a Slackware based Dist, that fits in under 32Mb of Ram and Disk. But I want to run Ruby on this thing, and probably Java, so I needed some more room which meant swap space, and swap and flash drives don't go well together, so I dug out a 4Gb Seagate Microdrive I bought at Frys a few years back, which would do really nicely. However getting it to work reliably turned out to be tricky. I grabbed the latest version of wdlinux, and did some digging to find it seems to be based on Slackware 8.1, which is important as you need more packages to make it useful than wdlinux has, so installing from Slackware makes things easier. They have an ISO so I installed the ISO in a Vmware Workstation, so I could compile a new kernel and compile any application on my workstation, and then tried to install it also on the 4Gb microdrive. This worked eventually but it turns out the microdrive likes to go to sleep every few seconds, (I guess to save power when it is plugged into a camera or whatnot). This caused Linux to get upset (the kernel version is 2.4.29). I saw a lot of errors saying "no drq after write", this was caused by it going to sleep, as I found if I did

> dd if=/dev/hda of=/dev/null` 

in a separate terminal, it kept it awake. The long term workaround was to execute

> hdparm -B255 /dev/hda

as soon as possible after boot, this turns off the power saving mode. I put it in /etc/rc.d/rc.S which is the first thing to get executed on startup. This error is more than annoying it corrupted the disk more than once.

I ordered a compact flash to ide44 adapter and short 44pin f-f cable so I could plug the microdrive into the ide connector on the board.

So now I had wdlinux 2.2 installed on a 4Gb microdrive on the PC104 board. Luckily 2.2 came with PCMCIA and associated tools already built into the kernel, unfortunately the module for my particular PCMCIA adapter board was not built, so I built a new kernel with the relevant driver built as a module, and was able to get the PCMCIA system up, plugging in the Orinoco card loaded the orinoco_cs driver which would work fine if I was still using WEP. After much Googling I found that the Orinoco which is a Hermes-I based card, would apparently work with wpa_supplicant if you upgraded the firmware and used a Linux driver released by Agere (who have since been acquired and their web site dismantled) Luckily I found the source online somewhere (Google for wl_lkm_718_release.tar.gz), and built it. The driver is called wlags49 and comes in a Hermes-I and Hermes-II flavors and for pccarc and pci, also the firmware is downloaded and can be either station or ap modes. After browsing through the source code they provided (which BTW only works on 2.4.x kernels) I figured out how to build it properly and also build the version of wpa_supplicant and Hermes driver that came with it. (I saw that some people have provided patches to make the code compile under 2.6.x kernels, but that didn't help me too much).

Initially the driver didn't seem to work too well, iwlist eth1 scanning did not seem to return anything, and wpa_supplicant also barfed when it tried to scan for AP's. A bit more digging and reading the sparse docs, looked like I needed to do some configuration of the module when it was loaded, rather than allow wpa_supplicant to do all the configuration. They provide a way to configure the Agere based chips with a /etc/agere/iwconfig-eth1 file. I set the SSID, the download_firmware and the debugging flags, and it seemed to fix everything. The wpa_supplicant.conf file was pretty sparse as it was a really old version of wpa_supplicant they were using, but it was enough to finally get a connection via WPA to my AP. Note WPA2 is not supported.

Along the way I was looking for alternatives, like using a newer PCMCIA card, I had a 3.3v newer card, but that wouldn't plug in to the 5v adapter, and I couldn't find a 5v to 3.3 v adapter on the market, which is odd as it is one chip to do it. I also couldn't find many 5v wireless cards, although it looked like I could still buy a Linksys WPC11 card so long as it was v1, v2 or v3, the new ones are v4 and appear to be 3.3v only.

So things learned...

  • There are no USB boards for ISA (or PC104) based PCs
  • New PCMCIA cards are 3.3v and won't work on older PCMCIA adapters (or Laptops)
  • There are no converters that allow you to run a newer 3.3v PCMCIA card in a 5v slot
  • Orinoco cards can be made to work with WPA, but require newer firmware and the Agere drivers.
  • working with old H/W is a pain, but embedded boards such as PC104 are still using old technology, although PC104+ does have a PCI bus which allows newer boards to be used
  • Using a compact card microdrive to run Linux off of is possible but you need to disable the power management in the drive

Now I finally have my old PC104 board running again with its wireless card and talking WPA, I have to figure out what to do with it :)

My next project is to build a USB adapter for my old Microsoft Sidewinder 3D Pro joystick, so I can use it on Linux to control my Rovio. This has already been mostly done but for Windows. I am going to modify it to talk a serial protocol so I can plug it into my Linux workstation.

Posted in Linux,Embedded  |  Tags linux,pc104,wpa_supplicant,microdrive  |  no comments


(leave email »)