Creating a RaspberryPi DriveWire server

  • 2016/05/12  This is a work-in-progress article I originally wrote on February 8, 2015, but never completed. The other night I was trying to look up my notes to help Curtis B. with a NitrOS-9 boot disk and I realized I never completed this. I will try to finish it when I have a moment.

Summary

To get DriveWire 4 server running on a Raspberry Pi, you will do the following:

  1. Download the DriveWire server to the Pi and unzip it:
    wget http://sites.google.com/site/drivewire4/download/DriveWire4_4.3.3.zip
    unzip DriveWire4_4.3.3.zip
    cd DriveWire4_4.3.3.zip
  2. Edit the config.xml file to default to your serial port on your Pi in <deviceType> and <serialDevice>. (i.e., “serial” and “/dev/ttyUSB0“)
  3. Run the server with no user interface:
    java -jar DW4UI.jar -noui
  4. On the CoCo, load the needed DriveWire modules from NITROS9/6x08L2/MODULES/RBF:
    dwio.sb, rbdw.dr, x0.dd up to x3.dd
  5. Use the “dw” command to test things by creating a blank disk image:
    dw disk create 0 /home/pi/test.dsk
    format /x0
    dir /x0
  6. Customize your boot disk to include the modules you want and read the documentation to learn how to use all the cool virtual terminals, MIDI and other neat features.

And now, the long version…

Materials Needed

  1. Raspberry Pi B (or B+, or probably the Pi 2 B). I did all these steps on a B.
  2. USB keyboard (a mouse makes things easier, but I do not have one so all of these tips will just use a Pi, keyboard and HDMI TV/monitor).
  3. Compatible* 8GB SD card (or larger).
  4. Ethernet cable to hook the Pi to the Internet. (Required if you plan to do the network install of NOOBS LITE).
  5. WiFi (with a supported USB dongle) or Ethernet is needed later for downloading the DriveWire software and updates, but there are ways to do all of this without any Internet access if you start with the full NOOBs installer.
  6. Compatible* USB serial adapter (or TTL->RS232 converter for use with the built in UART pins of the Pi).

Preparation on Windows/Mac/Linux

  1. Download the “NOOBS” installation for Raspberry Pi (currently 1.3.12). You can get the full NOOBS (780MB, just unzip and copy to the SD card and boot), or the NOOBS LITE (22.8MB) version.
    • NOOBS LITE can also be used. It is a much smaller download, but requires the Pi to be hooked up to the internet via Ethernet to download the rest of the OS files which is about 2355MB.
      http://www.raspberrypi.org/downloads/
  2. Unzip the files, then copy them over to a freshly formatted SD card.

Preparation on the Raspberry Pi

  1. Boot the Pi using this card. You will see a menu of operating systems you can install. Choose “Raspbian [RECOMMENDED]” at the top by using the arrow keys and SPACE to select. You may also wish to hit “l” for Language and set it to “English (US)” or your preference, and “9” for Keyboard and select yours. Once Raspbian is selected, press “I” for install. It will ask if you are sure you wish to overwrite the SD card. Select “Y” for yes.
    • NOOBS LITE: The Pi will then download the Raspbian image (2.3GB), then install.
    • NOOBS: The Pi will then install.
  2. The Pi will (eventually) reboot and after a bit, you get a DOS-like screen for the raspi-config utility. Arrow over to Finish and press ENTER. You will not be at the Pi shell prompt.
    pi@raspberrypi ~ $
  3. At this point, I like to do a full reboot to make sure everything is working properly:
    sudo reboot
  4. On a reboot, you won’t go directly to a shell prompt. You will get a login prompt. The default account is:
    username: pi
    password: rasbperry.
    Log in and you will get back to the shell prompt. You will be in the home directory for user “pi”.
  5. Now we need to download the DriveWire 4 software. Note the filename will change when DriveWire is updated, so check the official site if this does not work.
    wget http://sites.google.com/site/drivewire4/download/DriveWire4_4.3.3.zip
  6. After the zip file is download, you can extract it by typing:
    unzip DriveWire4_4.3.3.zip
  7. DriveWire 4 is set up to run with a nice GUI with mouse control. This requires a keyboard and mouse, and the Pi to be set up with X-Windows running. Since I do not have a mouse, and plan to run the Pi headless with nothing hooked up to it but power and the CoCo, this is not an option for me. Instead, I need to manually edit the configuration file to tell it what Linux serial port I will be using.
    cd DriveWire4_4.3.3
    copy config.xml config.xml.org (always keep a backup!)
    pico config.xml

    The editor will open, and you want to look for a few entries:<instance category=”instance” desc=”Autocreated 2013-03-24 23:57:53.831″ name=”TCP connection via TCP“>

    <DeviceType category=”device” list=”serial,tcp-server,tcp-client,dummy” type=”list”>tcp-server</DeviceType>

    <SerialDevice category=”device” type=”serialdev”>COM14</SerialDevice>The first entry is just the name of the connection. You could change that to “Serial Connection” or whatever. The second “tcp-“server” should be changed to “serial”, and the “COM14” entry should be changed to your serial port device. On my Pi, when I plug in a single USB RS232 adapter, it shows up as /dev/ttyUSB0 so that is what I use.
  8. Save your changes back to the file (Ctrl-X, Y) and now you are ready to run the server without a user interface. (Getting the user interface to run requires installed two more additional packages, and I will make a tutorial for that soon, if anyone wants me to.)
    java -jar DW4UI.jar -noui
  9. After a bit, Java will load and the DriveWire 4 server will start. Java is big, and the Pi is small, so it can be quite sluggish. Now, with the USB cable connected between the Pi and the CoCo, you can start testing.

Preparation on NitrOS-9

This tutorial is being written for someone who already has an active NitrOS-9 system and wants to add DriveWire support to it. If you have no customized

If you are using one of the default NitrOS-9 disk images for you system, it should have a NITROS9 directory, and inside of it will be various device drivers and descriptors, including the ones used by DriveWire. Ultimately, you would want to make a custom boot disk that includes these modules, but here is a simple way to merge them together and just load them when you want to use them. From OS-9:

  1. If you are running a stock CoCo 3 with the standard 6809 processor, go here:
    cd /dd/NITROS9/6809L2/MODULES

    …and if you have upgraded your CPU with a Hitachi 6309, go here:
    cd /dd/NITROS9/6309L2/MODULES
  2. The modules you want depend on what you plan to do. Here is the list:
    • drio.sb – this module handles all communication with the DriveWire server.
    • rbdw.dr – RBF device driver that uses DriveWire for disk access instead of disk hardware
      • ddx0.dd, x0.dd, x1.dd, x2.dd, x3.dd – device descriptors for the DriveWire disk drives (/x0 to /x3, with ddx0.dd being a /dd descriptor for DriveWire).
    • scdwp.dr – printer driver
      • p_scdwp.dd – device descriptor /p for scdwp.dr
    • scdwv.dr – virtual serial port driver
      • n_scdwv.dd, n1_scdwv.dd to n13_scdwv.dd – serial port descriptors. /n is the “next available” descriptor, similar to /w for windows. /n devices may also be used for MIDI.
      • midi_scdwv.dd – this is n14 but named /midi for MIDI programs that are hard coded to look for that name.
      • term_z_scdwv.dt, z1_scdwv.dd to z7_scdwv.dd – (??? not in the doc wiki)
  3. For my example, I am only concerned about the disk drives, so I would merge the following modules together:
    chd RBF
    merge dwio.sb rbdw.dr x0.dd x1.dd x2.dd x3.dd >/dd/dw
    This gives me a single file called “dw” I can load to get DW support instantly. First, I need to set the attributes to allow that:
    attr /dd/dw e
    …then I can just load it when I want to use DriveWire:
    load /dd/dw
  4. If this worked, you should now be able to use the DriveWire command, “dw”, to communicate with the server. Type “dw” and it should report back a list of commands:
    config  disk  log  midi  net  port  server
    …and you can then type “dw config” or “dw disk” to see what all it can do.

Using DriveWire

Here is an example of creating an empty disk image and formatting it:

dw create 0 /home/pi/test.dsk
format /x0
dir /x0

If you look on the Pi, you will see a new file “test.dsk” there. You can now use this disk like any other OS-9 disk. In my test, I copied my NITROS9 directory over to it just for fun:

chd /dd/NITROS9
dsave /x0 ! shell

DriveWire’s performance is not as good as you’d get from a No Halt floppy controller like the Disto Super Controller 2 or a hard drive interface like the Cloud-9 SuperIDE or KenTon SCSI. As disk activity is going on, interrupts are masked while data is blasted out of the bitbanger port. Still, it did a remarkable job keeping up with my typing. Quite impressive for a cheap cable and a $35 computer with a serial port.

TO DO

  1. Make the DriveWire 4 server auto-start.
  2. Update the DriveWire 4 software from the command line (is this even possible?).
  3. Update the Raspberry Pi software.

Problems

One issue I immediately ran in to was a bunch of ERROR #207 (Memory Full) errors. mfree still showed 352K free, and it wasn’t the #237 (RAM Full) that happens when there isn’t enough room left in the main 64K memory map.

4 thoughts on “Creating a RaspberryPi DriveWire server

  1. Russ Le Blang

    Hi,

    I was thinking… is it possible to attach the Coco to a Raspberry PI via the RS232 internally and embed it in the Coco. A Raspberry Pi 3 would be great for this. Any thoughts?

    Russ

    Reply
    1. Allen Huffman Post author

      That’s an interesting idea. I read that the Pi 3 gets really hot (I have a heat sync for mine because of this), but a Pi 2 would probably do okay (without struggling so much like the Pi 1 does). I wonder how easy it would be to tap in to the wires that go to the bitbanger port internally.

      Reply
  2. Russ Le Blang

    Hi Allen,

    I wrote “Return of Coco” back in 2000, a Windows emulator for the Coco. I still have several in the closet and ever since I saw the project where Ray Hague embedded a Pi in an MC10 I wanted to do the same thing. I would think it would be easy to connect wires internally off the motherboard to the Pi. I’d have to figure out leaching 5volts off the power supply. I’d prefer a Pi3 because of the wifi and bluetooth.

    Russ

    Reply
  3. Russ Le Blang

    Following-up. I’ve got a bunch of Pis I use around the house for home automation, home DNS Ad-Blocking, media managers, etc. I have a RaspBerry Pi 1 with a wifi dongle that would work for this task too.

    Reply

Leave a Reply