blob: 4ad7d16cb55bf41fa9341e47f839084ce974c225 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# 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.
|