E10 — SD 48 MHz high-speed at every CH32 clock
| ID | E10 |
| Date | 2026-12-02 |
| Status | done |
| Decisions | D86 (DECISIONS.md) |
| Board | #1 (rev A, 12 MHz crystals) |
| Firmware + results | fw/tests/2026-12-02-8-sd-hs-fix (sources, binaries, results.txt) |
| Scripts | sdtune.py, sdhs_verify.py |
Summary: Rising-edge sampling after CMD6 + RST_LGC before every read: 48 MHz SD works at HCLK 48/96/120 MHz.
What
Timing sweep (sample edge × clock phase × input delay) after CMD6, then the root cause of a read-length glitch.
Results
- Falling-edge sampling (the init setting) fails in high-speed mode at ×32/×40; rising edge or PHASEINV pass; TUNE delays irrelevant.
- In high-speed mode the first read of a new length after CMD18 returned wrong data (no flag) or failed (0x8080); a RST_LGC pulse before every read fixes it.
- After the fix: 72/72 mixed-length reads clean, 10 MB verified streams at 24/48 MHz on all three builds; reads 11.5–12 MB/s.
- ⚠️ In the archive’s
results.txt, section 1 (first sweep run) marks two ×16 rows PASS (NEGSMP 1, PHINV 0, DATI 8 and f), but those rows show 470 bad bytes: a substring-match bug in the script. Nothing passed in that run; section 2 is the valid sweep.
Update (E13, D91): the “leftover data” was most likely a stray 512-byte transfer armed by sd_cmd6 (a non-zero BKNUM write starts a transfer). Fixed; RST_LGC kept as a guard. See E13.
Lesson
Don’t judge PASS with a substring; when every setting fails the same way, suspect the test sequence.
Chip facts and numbers: fw/LEARNINGS.md. All experiments: index.