Its solved, but I'm surprised at what was happening. Consider the following psudo-code:
Code: Select all
SET CA1 = low to indicate DATA READY //this also sets CAS2 HIGH, as per the datasheet
while (CA2 == HIGH) {} //wait for CA2 to trigger LOW
SET CA1 = HIGH // reset CA1
I decided to find out, and put a 1 millisecond delay, before my "check CA2 loop". Voila, it worked! I dumped the hard-coded delay, and now wait for it to go HIGH, before waiting for it to go LOW, and yup, still works!
Okay, so the fast running MCU was starting its loop before the VIA was setup. It just doesn't seem possible to me that even with the MCU running 8 times faster than the CPU, that 11 measly nano seconds would matter, but here we are. If my math checks, that means a clock cycle for the AVR is 125 nano seconds. So that delay is a tenth of a cycle. How is this happening? Even accounting for the 2 clocks being un-correlated?