Skip to content

MDB adapter v2.0

Compare
Choose a tag to compare
@temoto temoto released this 10 Jun 11:38
· 221 commits to master since this release
MDB adapter v2.0 over SPI

When VMC and keyboard (also I2C master) were talking to mega
simultaneously, mega (or keyboard) would go crazy, respond as random
slave addresses (as shown by i2cdetect) then stop responding at all.
Most likely it was caused by incorrect handling of TW_STATUS in my mega
firmware. Wasted two days of random changes without stable solution.

So we decided to rewrite everything to SPI, primarily because it's a
separate (even electrically) bus. Had we got ATMega328PB on hands or
similar device with more peripherals, I would choose UART for VMC-mega
communication.

Current implementation of SPI handler on mega is blocking other
interrupts for longer than required. This caused UART errors (likely buffer overflow).
Applied workaround to defer keyboard reports back to VMC while MDB
session in progress. It works reliably now with SPI speed 200-500KHz
and could be further improved by separating SPI IO from processing as
done in UART(MDB) part.

Among with other changes in mega protocol, basically it was downgraded
to single-tasking that Alex wanted from the start. I failed to make
ambitious async protocol work and it cost us precious time.