Category Archives: DriveWire

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.

Introducing the CoCoPilot DriveWire Server

NEW “PRODUCT” ANNOUNCEMENT

Sub-Etha Software is proud to announce plans for its latest bit of vaporware: The CoCoPilot DriveWire Server, or “CoPi” for short.

The CoPi is a tiny device (which is approximately the size of a Raspberry Pi in a case) that comes with everything you need to have a functioning DriveWire server without having to keep your Mac or Windows machine nearby and powered on just so you can type “dir /x0”.

Pricing is to be announced but hopefully it will be around $50. Kit versions will also be available so you can just buy the bits you need in case you already have some of the other bits.

CoCoPilot Configurations

  • Turnkey – This is a “plug and go” version, where all you have to do is install the DriveWire drivers for NitrOS-9, or load the appropriate RS-DOS software (like the special DriveWire version of HDB-DOS), and plug it in. It comes complete with the server hardware, power supply, server-to-CoCo interface device (often called an RS232 cable), and internal solid-state boot device (sometimes called an “SD card”).
  • BYOE – The bring-your-own-everything edition is shipped as a set of simple instructions that will let you transform a boring Raspberry Pi in to the amazing CoCoPilot DriveWrite Server. All you have to do is provide the Raspberry Pi, SD card, RS232 adapter and CoCo serial cable. And do a bunch of typing*. And downloading. And editing. And configuring. But the end result is you have everything that the Turnkey edition has at a fraction of the price.
  • Custom – Also planned to be available are various custom configurations. Already have a Pi? Don’t need another CoCo serial cable? Our custom configuration engineers are ready to custom tailor your order.

Pricing

We estimate complete pricing will be around $50. Or maybe $60. But probably not more than $75.Unless someone really wants to overpay for this.

Availability

The first working prototype was just turned on last night. Quit rushing us. We’ll announce availability when it is ready.

For more information, be sure to follow this blog.

(In case you didn’t get it, I started working with DriveWire on my Raspberry Pi. I will try to document all my steps to make things easier for you if you want to try it. And if you just want a Pi already setup, I’ll probably be able to do that as well.)


* Actually, it’s not really that much typing. I will have a full “from getting a Pi, to using DriveWire” tutorial next. But if you already know your away around the Pi, you pretty much can boot a freshly installed Pi, login and type:

wget http://sites.google.com/site/drivewire4/download/DriveWire4_4.3.3.zip
unzip DriveWire4_4.3.3.zip
cd DriveWire4_4.3.3

Then, you have to edit the “config.xml” file to tell it what serial port you are using. For instance, if you plug in a USB-RS232 adapter, it might appear as device “/dev/ttyUSB0”. You just edit the file and change two bits:

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

…and…

<SerialDevice category="device" type="serialdev">/dev/ttyUSB0</SerialDevice>

Then all you have to do to start it up is type:

java -jar DW4UI.jar -noui

Tada! Now your DriveWire-enabled CoCo should be able to start issuing commands to the server.

However, DriveWire has many more features that you can only get to using the DriveWire GUI. If you have a display, mouse and keyboard hooked to your Pi, you can instead run the GUI like this:

startx

That will start up the X-Windows desktop GUI on the Pi. Now all you have to do is run the DriveWire GUI. One way to do this is by opening up a Terminal to get to a shell prompt (Ctrl-Escape -> Accessories -> Terminal).

But wait! The GUI requires a few elements that are not part of the default Pi Linux installation, so you need to add them first by typing:

sudo apt-get install libswt-gtk-3-java
sudo apt-get install  libswt-cairo-gtk-3-jni

Now you are ready to run the DriveWire 4 GUI:

cd DriveWire4_4.3.3
java -jar DW4UI.jar

Now you can do things like update the DriveWire software and many other things you cannot do without a mouse (apparently).

Check back later for a full, step-by-step article on taking a fresh out-of-the-box Pi and turning it in to a DriveWire server. (Or I can sell you one already configured.)