- Write Data Clock Recovery Test Circuit
- Write Data Clock Recovery O-Scope Shot
To implement write support for the floppy emulator, the write clock must somehow be recovered from the write data input. The simplest (and probably least robust) way of doing this is in software. When the write enable line becomes active, a “change notice” interrupt on the write data input can be used to detect the first negative-going edge. When triggered, this interrupt would initiate the first SPI receive operation with the proper timing. The rest of the SPI receives would follow, and hopefully there would be little or no jitter on the data (since this is coming from the host). This assumes of course that the host sends data with a perfect 2us interval, which may or may not be the case.
With a little bit of additional circuitry, it is possible to implement more robust clock recovery, which is what I’ve been experimenting with the last few days. I’ve come across a simple circuit based on the 555 timer (CMOS version) used in the Amiga Floppy Reader project. The 555 timer is used to generate the 500khz write data clock, but the write data line is connected to the reset input of the 555 IC. is synchronizes the clock output to the negative-going edges of the write data signal, effectively recovering the clock from the data.
The tiny little board in the photos shows my test implementation of this clock recovery circuit. Early on during my first tests, I realized that there is a minimum width to the reset pulse. This causes the clock pulse to be late. It almost overlaps the positive-going edge of the data signal. Therefore I added a second 555 to delay and enlarge the low pulses of the data signal. That did not work as well as I expected, as the delay introduced by the 555 turned out to be a little too large, as the oscilloscope shot shows.
Another idea that I experimented seems to perform better. Instead of using a 555 for delaying the data signal, a 74hc14 is used to buffer the signal and an RC low pass filter is used to introduce a phase shift. Obviously, a 555 takes up less board space than a 74hc14 and that is why I was experimenting with two 555s instead. A small advantage of the 74hc14 circuit is that there is no need to invert the incoming signal on the MCU side.
As it should be evident from this post, I am already working on a completely new design that will use a PIC32 and on-board memory to fully implement read and write emulation. This is actually a cross between the TFE+ and UFE that I mentioned in one of my previous posts. That is why the test PCB I’ve made uses SMD parts and has a red soldermask, as it was a little exercise for manufacturing the new design.