DavidPagels/retro-pico-switch

Single bit errors in PIO receiver?

Closed this issue · 1 comments

I am seeing what looks like single bit errors appearing in the N64 controller receiver / decode;
Easily reproducible with the 5 genuine N64 controllers I have, hold the analogue stick in the upper left or lower left quadrant and the measured value glitches about 1 in 50-100 readings, with the value doubling / overflowing.
i.e an X value of -32 jumps to -64

It also affects buttons, but harder to replicate as you have to hold a few. I thought it was the first bit on 8-bit boundaries being lost, but I cannot be sure.

I have confirmed this is happening in the PIO receive, rather than building the USB report.
I have tried this on an Adafruit feather RP2040 and a XIAO RP2040 so it's unlikely to be hardware related.

It looks like at the current pio frequency is too low and the timings don't always line up correctly. I just updated it locally to double the frequency so the wait commands can keep everything in sync better. With this change, I'm getting data much more reliably. I'll add this change in with the bluetooth update coming shortly!