# ocularium test firmware This is Arduino-based test firmware written to derisk systems quickly before moving to a Rust implementation. ## SD bug (?) This firmware _doesn't_ work with the stock `SD.h` that ships with the RP2040 Arduino core. It needs the following change at the end of `Sd2Card.cpp:cardCommand`: ```c++ // XXX: Assume CMD0 succeeds. if (cmd == CMD0) { spiRec(); status_ = 0x1; } ``` With this, it works perfectly, but without, it gets stuck unable to ever initialize the card. Logic analyzer says the card (I've tried multiple brands) sends an `0x7f` (general error) in the byte after the CMD0 sequence completes, and _then_ sends the expected `0x01` R1 in the following byte. The SD library is looking for any byte starting with a 0 bit (indicating message presence), so treats this as a genuine error and always fails. If we change the implementation to ignore this byte, the rest of the initialization succeeds without error. Currently, I'm just applying a transient patch to my local PlatformIO download of the RP2040 core to resolve this temporarily.