| .. | ||
| lib/startup_sd | ||
| scripts | ||
| src | ||
| platformio.ini | ||
| README.md | ||
Exercise 13: SD Card Diagnostics
Dedicated SD hardware + software diagnostics for T-Beam Supreme.
This exercise is meant to isolate SD failures like:
- card only works after reinsertion,
- intermittent mount loss,
- one unit never mounts while others do,
- possible interconnect / socket / power rail issues.
What it does
- Uses the
startup_sdwatcher library from Exercise 12 for continuous card presence monitoring. - Logs PMU telemetry repeatedly:
- BLDO1 (SD rail enable state)
- VBUS voltage
- battery voltage and battery-present flag
- Samples SD SPI GPIO logic levels (
CS,SCK,MISO,MOSI) at runtime. - Runs SPI idle-byte probes on both
HSPIandFSPI. - Runs full mount matrix scans:
- buses:
HSPI, thenFSPI - frequencies:
400k,1M,4M,10M
- buses:
- Performs SD file I/O validation when mounted:
- append to
/diag/sd_diag_probe.log - flush
- reopen and read back verification token
- append to
- Every few cycles, power-cycles SD rail (BLDO1) and re-tests mount.
- Shows live status on OLED and detailed logs on Serial.
Build
source /home/jlpoole/rnsenv/bin/activate
pio run -e amy
Upload (using your udev aliases)
source /home/jlpoole/rnsenv/bin/activate
pio run -e amy -t upload --upload-port /dev/ttytAMY
Monitor
pio device monitor --port /dev/ttytAMY --baud 115200
Interpreting key log lines
Mount OK bus=... hz=...- SD stack works at that bus/speed.
Mount FAIL ...on all combos- usually hardware path, socket contact, power rail, interconnect, or card format issue.
SPI probe ... ff=8- typical idle/pull-up style response.
SPI probe ... zero=8- suspicious: line stuck low/short or bus contention.
BLDO1=0while testing- SD rail is off; card cannot function.
I/O FAILafter mount success- media/filesystem instability or write path issue.
Practical A/B troubleshooting workflow
- Use one known-good SD card and test it in a known-good unit and Amy.
- Compare whether
Mount OKappears in both units. - If Amy never gets
Mount OKbut good unit does, suspect Amy hardware path. - Gently flex/reseat board stack while monitoring logs for mount transitions.
- If behavior changes with pressure/reseat, interconnect/socket contact is likely root cause.