GreaseWeazle on a Blue Pill (F1)

The GreaseWeazle is a very cool project from Keir Frazer documented on his 'Greaseweazle Host Tools' and Greaseweazle: Firmware pages Github pages. The main entry points are the excellent Wiki and the Tutorial There are several variants of the STM MCUs that can be used for a GreaseWeazle. The cheapest is the Blue Pill. With the GreaseWeazle F1 floppy adapter board it is very compact and will fit in the back of a small floppy drive case. work for a single floppy drive.

If you want to connect two floppy drives to one GreaseWeazle, you should use the F7 or V4 version.

Assembly

Stack
front side
Mounting a floppy drive with the GreaseWeazle in a case like this is lots of work, but once completed provides a solid relable archiving tool. In the end, it is the data you can retrieve from the floppies the goal of the whole enterprise.
These floppy drive cases were once used as a portable external backup medium.
Stack
back side
The single +12V power supply was chosen as these are common. Dual voltage supplies are more rare, and the Molex connector isn't designed for regular re-connections. USB C is a common 'future proof' connection. Of course a attached cable directly attached to the Blue Pill (usually micro-USB) is also an option, but somewhat less cool.
Connectors The F1 floppy case is powered by a single 12V DC power supply. An interval DC/DC converters derives the 5V DC. A USV C receptible on the back has a segment of an USB (micro) plug soldered to it leading to the Blue Pill. The back plates are attached with M3 screws and nuts.
Power wiring The +12 VDC is routed directly to the floppy Molex plug and also via the DC/DC converter for the +5V. The connector is attached with M2.5 screws and nuts.
USB wiring The connector on the USB cable segment should match the Blue Pill. Make sure your cable isn't a charge-only one. The short ones usually are. These lack the data wires. The plate securing the USB connector PCB in plate is attached with M2.5 screws, directly screwed in the 3D printed part.
All parts before final assembly
Blue Pill/
GreaseWeazle
The flatcable is just long enough to wrap around the Blue Pill/GreaseWeazle board to isolate them electrically.

Testing firmware & hardware

The first test is for to check the firmware and host tools are correctly installed. Make sure the STM32 board is connected. The GreaseWeazle board and a floppy drive are optional.Type:

gw info

The python script should respond with something like this:

Host Tools: 1.22
Device:
  Port:     /dev/ttyACM0
  Model:    Greaseweazle F1
  MCU:      72MHz, 20kB SRAM
  Firmware: 1.6
  Serial:   GWnnnnnnnnnnnnnnnnnnnnnnn
  USB:      Full Speed (12 Mbit/s), 16kB Buffer

If not you should check the firmware is correctly installed.

Next is checking the GreaseWeazle boarda floppy disk drive and power supply are correctly connected. Put a floppy (any disk with an index hole should be ok. Type:

gw rpm

The floppy drive light should go on and the disk rotating. The response should \ look like this:

Rate: 360.410 rpm ; Period: 166.477 ms

360 rpm indicates a HD-drive running at high speed.. A DD-drive rpm would result in:

Rate: 300.391 rpm ; Period: 199.739 ms

For IBM-compatible drives this is controlled via pin2 of the floppy drive connector. The rotation speed (and density) are switched via pin 2.

gw pin set 2 l

Switches to low speed.

gw pin set 2 h

Switches to high speed.

Reading disks

Reading and decoding an unknown disk can be a challenge, so it is best to start with a well known format, like IBM 360K or 1.2M disks.

gw read --format=ibm.360 /tmp/test.imd

This reads each track from the disk and tries to interpret it as a 360 kByte, double sided PC-DOS disk.

gw write --drive a --format ibm.1200 Dos6.22-5.25.img

The same for a 1.2Mbyte, double sided PC-DOS disk. Make sure pin 2 matches the type of disk in the drive. DOS does this automatically, but gw doesn't.

Other useful commands

These commands can be aborted with Ctrl-C

# erasing a 80 tr. disk (select high density for this):
gw erase --tracks="c=0-80:h=0-1:step=1"

# writing a 40 tr. image with a 80 tr drive (this will not read reliable on a 40 track drive):
gw write --format=ibm.360 --tracks="c=0-80:h=0-1:step=2" /tmp/test.imd

# read 40 tr, DS (read only track 0-39):
gw read  --format=ibm.360  /tmp/test.imd

# write a 1.2 MByte HD-disk. The drive is in HD mode (default or via pin 2:
gw write --drive a --format ibm.1200 Dos6.22-5.25.img

# writing a DD 80 tr. image in a HD drive
gw pin set 2 l
gw write --drive=a --format=ibm.720 IBM\ DOS\ 3.3\ 720K\ Disk.img

# writing a HD 80 tr. image in a HD drive
gw pin set 2 H
gw write --drive=a --format=ibm.1200 d1200.img

# checking the number of tracks of a drive. This command moves the heads to track 40.
gw seek 40

TRS-80 formats

The TRS-80 formats are currently not supported by gw, but a gw2dmk program exists (derived from the old cw2dmk code for the Catweasel).

--tracks argument 
c - track range
h - head range
step - usually 1 or 2

This specification should describe how you want to read/write, not the physical type of the drive.

Background info

This text leans heavy on the tutorial from the Wiki.

Three levels of access for reading or writing any floppy disk:

The Greaseweazle reads the data at the flux level, writes the track to a file on the harddisk, and then optionally interprets this to formatted tracks or sector data. For this interpretation, you have to tell it what format is expected. For reading the flux-level the only data that has to be provided is the number of heads and tracks. Use the --tracks argument for this.

Disks with a known and supported format sized 3 1/2" and 5 1/4" are usually easy, 5 1/4" HD is the exception. (and maybe 8", untested).

When writing a image, GW forst writes a track and then tries to read it again. If this fails, it retries three times. If all retries fail, gw aborts.


Last update: 2025-06-03

fjkraan@electrickery.nl