Controlling a floppy drive (designing a custom controller)

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
Latest update:

I am positive this will work. Because writing is inhibited if you just hold the write pin high for too long I was concerned that I would not be able to detect the start bit and then read the correct data fast enough from the floppy. Good news though, the time between the end of the start bit and the start time of actual data writing is consistently 8uS so I can account for this in my code!
 

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
It works!

You can format , read and write sectors. The PIC assembler software is not reliant on interrupts and only requires timer 2 which is used when timing bits. All I need to do now is create a friendly interface so you can send bytes in parallel (8 bits), I2C comms, RS232 or SPI. Dedicated pins are not needed (in other words you can choose which IO pins you want to use for the controller) but the PIC needs to be clocked at 64MHz minimum (16MHz with PLL).

I will write up a technical specification for it soon :)
But yes, you CAN use a PIC to control a floppy drive!

  • 80 Track
  • 12 Sectors / Track
  • 2 Sides
  • 256 bytes / Sector
  • 491KB per floppy
I know the data density is low but considering this is bit-banged that's not bad!
 

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
Here is the external signal requirement for using the controller (still in progress)
  • 4 Address lines (command selection)
  • Chip select (Input - Active low)
  • Wait (Output - Active low)
  • Output Latch (Output - Active high)
  • 8 bit IO bus
The wait is designed to halt any external processor when the controller is completing commands.
The output latch is designed to work with an external buffer controller if connected to a common bus (such as a Z80 system)

The controller has a few internal registers:
  • Track - Current Track
  • Sector - Current Sector
  • Side - Current Side
  • Data Buffer Pointer - Points to a location in the internal data buffer
  • Error Byte - When a sector is read from the disk it stores the received error byte here. This needs to be compared to the calculated error byte

So far the controller has the following command functions (address determines command)

0x00 - Read byte from internal 256 byte data buffer
0x01 - Write byte to internal 256 byte data buffer
0x02 - Reset internal data buffer pointer
0x03 - Set internal data buffer pointer to data bus
0x04 - Get error byte from floppy read
0x05 - Get floppy status
0x06 - Write internal data buffer to sector (track / sector registers hold location)
0x07 - Read sector to internal data buffer (track / sector registers hold location)
0x08 - Set track register
0x09 - Set sector register
0x0A - Goto track define by data bus
0x0B - Goto side defined by data bus

Formatting of the floppy is rather simple but it means it's unreadable by an OS like windows. This is because using a PIC meant that there were serious speed limitations.
  • 80 Tracks Per side
  • 12 Sectors / Track
  • 2 Sides
  • 256 bytes / Sector
  • 491KB per floppy
The controller makes use of the index hole so this system won't be damaging your floppy drives with the good crunchiness of stepper motors! Also, automatic motor turn off will be implemented soon. A watchdog timer will also be used to prevent lock up of the drive.
 

TQFP44

Joined Sep 3, 2016
51
I did a single bd project , way back... but i used a WD2793 chip, as I only had a slow micro RCA1802 , and machine code !

Edit, Not 2793 but WD2797
 
Last edited:
Top