<?xml version='1.0' encoding='utf-8' ?>
<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <channel>
    <title>Wolfmans Howlings: Fun with a PC104 board, embedded Linux and wifi</title>
    <link>http://blog.wolfman.com/articles/2009/10/21/fun-with-a-pc104-board-embedded-linux-and-wifi</link>
    <description>A programmers Blog about Ruby, Rails and a few other issue</description>
    <language>en-us</language>
    <ttl>40</ttl>
    <item>
      <title>Fun with a PC104 board, embedded Linux and wifi</title>
      <description>
        &lt;p&gt;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.&lt;/p&gt;
        
        &lt;p&gt;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.&lt;/p&gt;
        
        &lt;p&gt;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
          &lt;a href=&quot;http://www.wowwee.com/en/products/tech/telepresence/rovio/rovio&quot;&gt;Rovio&lt;/a&gt;
          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.&lt;/p&gt;
        
        &lt;p&gt;I bought one of these gizmos to play with, and to &quot;use&quot; 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.&lt;/p&gt;
        
        &lt;p&gt;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.&lt;/p&gt;
        
        &lt;p&gt;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).&lt;/p&gt;
        
        &lt;p&gt;The board has 32Mb of RAM, and that was fully loaded, it also ran
          &lt;a href=&quot;http://www.blast.com/index.php?id=35&quot;&gt;WhiteDwarf Linux&lt;/a&gt; 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 &quot;no drq after write&quot;, this was caused by it going to
          sleep, as I found if I did &lt;/p&gt;
        
        &lt;pre&gt;&lt;code&gt;&amp;gt; dd if=/dev/hda of=/dev/null`
        &lt;/code&gt;&lt;/pre&gt;
        
        &lt;p&gt;in a separate terminal, it kept it awake. The long term workaround
          was to execute &lt;/p&gt;
        
        &lt;pre&gt;&lt;code&gt;&amp;gt; hdparm -B255 /dev/hda
        &lt;/code&gt;&lt;/pre&gt;
        
        &lt;p&gt;as soon as possible after boot, this turns off the power saving
          mode. I put it in &lt;code&gt;/etc/rc.d/rc.S&lt;/code&gt; which is the first thing to get
          executed on startup. This error is more than annoying it corrupted
          the disk more than once.&lt;/p&gt;
        
        &lt;p&gt;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.&lt;/p&gt;
        
        &lt;p&gt;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
           &lt;code&gt;orinoco_cs&lt;/code&gt; 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
           &lt;code&gt;wl_lkm_718_release.tar.gz&lt;/code&gt;), 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 &lt;code&gt;wpa_supplicant&lt;/code&gt;
           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).&lt;/p&gt;
        
        &lt;p&gt;Initially the driver didn't seem to work too well, &lt;code&gt;iwlist eth1
         scanning&lt;/code&gt; did not seem to return anything, and &lt;code&gt;wpa_supplicant&lt;/code&gt; 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 &lt;code&gt;/etc/agere/iwconfig-eth1&lt;/code&gt; file. I set the SSID, the
         download_firmware and the debugging flags, and it seemed to fix
         everything. The &lt;code&gt;wpa_supplicant.conf&lt;/code&gt; 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.&lt;/p&gt;
        
        &lt;p&gt;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.&lt;/p&gt;
        
        &lt;p&gt;So things learned...&lt;/p&gt;
        
        &lt;ul&gt;
        &lt;li&gt;There are no USB boards for ISA (or PC104) based PCs&lt;/li&gt;
        &lt;li&gt;New PCMCIA cards are 3.3v and won't work on older PCMCIA adapters
        (or Laptops)&lt;/li&gt;
        &lt;li&gt;There are no converters that allow you to run a newer 3.3v PCMCIA
        card in a 5v slot&lt;/li&gt;
        &lt;li&gt;Orinoco cards can be made to work with WPA, but require newer
        firmware and the Agere drivers.&lt;/li&gt;
        &lt;li&gt;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&lt;/li&gt;
        &lt;li&gt;Using a compact card microdrive to run Linux off of is possible but
        you need to disable the power management in the drive&lt;/li&gt;
        &lt;/ul&gt;
        
        &lt;p&gt;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 :)&lt;/p&gt;
        
        &lt;p&gt;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
         &lt;a href=&quot;http://www.descentbb.net/viewtopic.php?t=15526&quot;&gt;done&lt;/a&gt; but for
         Windows. I am going to modify it to talk a serial protocol so I can
         plug it into my Linux workstation.&lt;/p&gt;
        
        &lt;p&gt;&lt;a href=&quot;http://technorati.com/tag/microdrive+linux&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;
        &lt;a href=&quot;http://technorati.com/tag/orinoco+wpa&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;
        &lt;a href=&quot;http://technorati.com/tag/whitedwarf+linux&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;/p&gt;
      </description>
      <author>Jim Morris</author>
      <pubDate>Wed, 21 Oct 2009 01:37:39 -0700</pubDate>
      <link>http://blog.wolfman.com/articles/2009/10/21/fun-with-a-pc104-board-embedded-linux-and-wifi</link>
      <guid isPermaLink='false'>urn:uuid:b5bad6f1-dd48-4e85-9fdd-c9a2042b6efc</guid>
    </item>
  </channel>
</rss>
