PERTEC D3422 DRIVE RESTORATION
I reworked the synchronization logic to be tolerant of a small number of spurious 1 bits while adjusting timing in the long series of 0 bits of the preamble or inter-field gap. I also made it tolerant if it incorrectly thinks it is seeing a sync byte but that too was a spurious one.
Any time I see a spurious 1 bit during the preamble or gap, I decrement the count of zeros, while incrementing on receipt of 0 bits. When I hit the count of 80 for preamble or 20 for gap, I then watch for eight 1 bits in a row which defines the synchronizer byte.
If I am partway through a suspected sync byte and find a 0 bit, I restart waiting for a 1 bit. Thus, I can only sync on eight consecutive 1 bits and only after seeing at least 80 or 20 zero bits first. If a sector pulse arrives before I sync up, I mark a sync error.
The read logic was initially abandoning the load of the FIFO when I reached a count of 256, which is the size of the data field, but I forgot to include the five bytes of the header field that were already in the FIFO and the two CRC bytes that complete the data field.
I have something wrong with my logic to pull out bytes from the FIFO and display them, but reading appears to be successful at this point. I see the count in the FIFO go down each time I request another byte from the contents I had read, but I am always seeing zero.
I cleaned up several things but still have the problem of the FIFO contents always coming out as x00. I am not sure if I am not storing the proper data or whether the problem is on the fetch, but things are pretty solid otherwise.
I suspected I am writing the wrong value, which I traced to the way I am handling the bytevalue signal from the byte assembler logic. The value of bytevalue was only non-zero for one cycle while the byteavailable signal is asserted, but now I don't zero it out at the start of assembly for the new byte. I had a couple of other timing errors, but gradually the design is shaping up.
It is about time to create a quick and dirty program on the PC that can script actions such as seeking, selecting the platter, head and sector, read in the sector and then retrieve each byte from the controller.