KryoFlux - Data Packets


Found the “problem of unformatted tracks” mentioned in the last WIP. It actually had nothing to do with unformatted tracks, it just demonstrated a logic flaw in the decoder. Data arrives in packets, but there is no guarantee that a packet always contains complete encoded sequences of flux data and OOB (Out Of Band) data, so it may continue in the next packet. Now the decoder always checks the required length of every single data element, and if continues in the next packet, it reads more data and retries the decoding.

So far so good...

Now imagine that an OOB packet is inserted after a flux data element that is more than 1 byte to encode, which normally happens with unformatted or strange data. The decoder sees OOB data that is broken, so it tries to collect the data to complete the OOB element and “forgets” that the data preceding the OOB read was incomplete too → logic mayhem.

Fixing it is not trivial though... it requires separate completion logic for OOB and flux elements.

(later, after some more research)

Decided not to fix it on host side for the time being. Instead, the firmware no longer allows splitting of incomplete flux data when there is a concurrent OOB request. It’s not too elegant, and suboptimal for the transfer speed in certain cases, but it saves on a lot of work.

Communication errors now cancel streaming. Ideally that would send an OOB message too, but right now the decoder detects encoding problems very well anyway, so when that is detected the host retries the failed track.