Amiga USB Floppy: an update

Amiga USB Floppy: an update

Connect an external Amiga floppy drive, via a Arduino, to a USB port on a Mac. Sounds simple doesn’t it? Before you say yes, take a look at my previous posts, anything but simple. As mentioned previously there are existing projects that claim to be working at reading data including:

Keith has the most complete write ups and is defiantly the best place to start with an extreme amount of research done on the topic, do go back and read them and the comments from the start. Most are based on the AFR project by Marco and this is where I am starting, but keeping an eye on all the others with their research and findings in mind. Rather than do it all in one hit like any good engineer I have broken the problem down. I have done a ton of research, then the first practical phase was:

  1. Figure out control lines.
    • Using an Arduino work out how to use all the control lines.
    • Nothing special at this point other than to figure out use of the control lines.
    • Aim to have code complete to allow control of a floppy.

This code is on GitHub, note there is no write control, at this stage my interest is reading. The pin assignments are noted in the code, I will put a diagram up in a future post. At the moment the code allows the motor to be spun, DF1 to be selected, head to be moved, track 0 and index detection and disk ready detection. The code needs a clean up and re-writing, but the core of it is there.

The second step is to read data from the drive. The data is kicked out as flux transitions. A one, according to Keith, is a short pulse from positive to zero. The space between this and the next pulse then dictates how many 0s there are. Each 0 or 1 has a theoretical 2µS window. Having read others research and various datasheets from floppy disk controller chips that window has a tolerance.

This is presenting problems at present. I currently have a timer set-up which counts up to 65535 in 62.5nS increments. This is allowed to overflow and a counter clocks the overflows up. An interrupt is enabled on pin 2, connected to the data output of the drive, triggered on the falling edge. Each time this interrupt is triggered I need to do some processing. The simplest thing, in my mind, was to measure the number of ticks in the timer and transmit it along with the overflow counter to the PC. This needs to be at a high rate, 1Mbps or possibly 2Mbps.

And this is where I am getting problems. Firstly the timer and interrupts are working. I am finding the same issues that Keith had and believe simply that the Arduino Uno is not fast enough to cope and thus I am missing interrupts. By my calculation the system is processing a data pulse every 400µS, much slower than I would expect. It might be something really simple in the code, but at present I think it is the code is too heavy, I need to find a way to make the code lighter, to go assembly or for a faster processor. So how to move forward, and yes this is in order of importance:

  • Get the oscilloscope out and test what is being sent from the floppy;
  • Try the code out on another floppy drive (Amiga or PC);
  • Go the assembly route, abandon Arduino IDE and code the ATMega328 in assembly;
  • Try a more powerful system. Based on the fact that the ADF-Copy project by Nick uses a 72MHz 32bit Teensy, a more powerful system should be able to cope easily. But there is a balance, I want to keep the system as simple as possible. The ADF-Copy project also codes, from the quick look I have had, in Arduino and Processing. So based on this I will take a look at other systems:
    • ESP8266
      • I have a stack of these to try;
      • I could possibly stream the data over WiFi to the PC;
      • Can be programmed using Arduino IDE;
      • More RAM and storage space to allow data to be buffered and then transmitted; and
      • Faster processor.
    • STM32
      • have got a few of these on order;
      • Can be programmed using Arduino IDE.
    • Teensy.
      • The same as the ADF-Copy project;
    • Raspberry Pi Zero W
      • I have a few of these so would be simple to hook up to the GPIO, but would need to go low level. I would like to avoid this at present and have a simple connection if I can. I won’t rule it out, but also not high on the list.
    • UDOO Neo.
      • Again got one sat about, consider this a Raspberry Pi with an Arduino built in, the difference is they are on the same CPU and are faster, the Arduino section supposedly operating at 200MHz. Again this is overkill, but might be an option at a latter date to integrate an emulator with a floppy drive all in one system.
  • Go back to basics, build Marco’s ADF. Now I do not have a parallel port anymore. I could buy an adapter but also occurs that perhaps an Arduino could act as the interface to it.

So now I just need to wait until I get the scope out, or more parts arrive!