This question is from a project of mine I have been working on for about 3 months now, and I reached a point where I was going to go the route of using an interrupt based handler for my packet receiver when I realized it was not working out successfully, so I switched to a polling approach and it seems to respond to movements and produce non zero results, but, there is the issue of errors. I have implemented a software routine in an embedded system to handle polling and outputting the received data to a terminal, output shows desired movement packets, but it also has quite a bit of what seem to be erroneous data such as detectable cases where bits are 1 when not allowed, or zero when they should be 1.
The mouse transmits 8 bit data packets with a parity bit, so is that something I can use to detect errors, and if so, is it a matter of requesting retransmit, or correction of the individual data burst contained in a single movement packet.
What should I be doing to ideally detect, correct for the data coming in? I do not have familiarity with error correction so that might be of use here if doable.
I am now disregarding the entire frame (4x 8 bits of data) if there are detectable error conditions. I haven't checked parity mismatch.
What can I do to correct for errors ideally? Or do I completely drop the data for that one instance of movement change that occurred? Unfortunately even at present dropping movement still shows values for the individual bytes of data at times that are not supposed to have an assigned value such as the z-axis where the value is not changing but I get a zero. I hope this is not due to my byte receiver misaligning with another byte in another frame without first getting through the previous frame....
Any help would be appreciated.
The current problem is the values of z are changing even when I don't move mouse wheel but just move the mouse x or y and there are present bursts of 4 bytes of data with issues maybe due to misalignment of bytes when I read in software.
See receiver module https://github.com/vahejab/arty_sv_sampler/blob/main/arty_sv_sampler.srcs/sources_1/imports/code_listing_sv/fpga_mcs_sv_src/hdl/mmio/ps2/ps2rx.sv
FIFO (with/without grey code counting - uart uses fifo with binary counting, and ps/2 uses counter with grey coding) https://github.com/vahejab/arty_sv_sampler/blob/main/arty_sv_sampler.srcs/sources_1/imports/code_listing_sv/fpga_mcs_sv_src/hdl/mmio/mmio_support/fifo/fifo_ctrl.sv
See readme for more information https://github.com/vahejab/arty_sv_sampler
Top Level Elaborated RTL Representation
PCA9306 - The Level Shifter on the SparkFun PCA9306 Breakout Board