flashfloppy icon indicating copy to clipboard operation
flashfloppy copied to clipboard

floppy: apply NCO-based 2nd-order PLL to WDATA line

Open mx-shift opened this issue 1 year ago • 42 comments

Centurion Finch Floppy Controller (FFC, https://github.com/Nakazoto/CenturionComputer/wiki/FFC-Board) is an 8" floppy controller that applies up to 350ns write precompensation. FlashFloppy's existing approach of re-aligning the bit clock to the last pulse edge causes enough additional error for bitcells to be missed or injected in this case.

This commit applies a 2nd-order (proportional and integral) PLL to the incoming WDATA to mitigate both frequency offset and extreme write precompensation. The implementation is based on a virtual numerically-controlled oscillator with a frequency 2^16 times FlashFloppy's tick rate. Proportional and integral constants were chosen to nominally provide a 715kHz natural loop frequency and a damping factor of 1 and then adjusted to be powers of 2 to allow computation to use bit shifts instead of multiplication and division.

This commit has been successfully tested with a variety of PC-compatible floppy controllers as well as Centurion FFC.

mx-shift avatar Jan 21 '24 00:01 mx-shift