What I learned about making an Arduino ADB host
Thu, Apr 26, 2012 at 12:25PMIt’s impossible, because the Arduino doesn’t have enough SRAM to properly buffer data that comes from ADB peripherals. For instance, a peripheral my send up to 8 bytes of data, but the bus line needs to be read with an acceptable resolution to tell the difference between a ‘1’ and a ‘0’. With my current implementation, I use an array of boolean values to act as a buffer. However, a boolean value, even though it can only be TRUE
or FALSE
, is still stored as a full byte. I estimate that about 2500 bytes will be needed to properly buffer all 8 bytes. While it’s true that not many devices will broadcast 8 bytes, I’m not satisfied unless the ADB host can accommodate that.
I suppose one could store the boolean bits in a byte, then use bit masking to read them, but storing them would take up precious CPU cycles. And, when you’re reading pulses at 35 microseconds (35 millionths of a second) CPU cycles are extremely precious.
While the Arduino isn’t quite up to the task of acting as an ADB host (when programmed in anything other than assembly), I do believe it would work smashingly as a peripheral. So, that’ll be my next project.
For those interested, I’ve thrown the code up on GitHub.