2025-05-21

DMA Rings Without the Panic Spool

By Sora Kwon

Hero for DMA Rings Without the Panic Spool

DMA debugging is where optimism dies. We teach a color strip protocol: green for producer head, amber for consumer tail, red for “frozen — do not touch config registers.” It is low-tech and survives ESD wipes better than whiteboards.

Students script a deliberate underflow, capture the bus hang, then restore using a rehearsed teardown order. The muscle memory matters more than the vendor header file names.

We also log watermarks in RAM with timestamps from a single timer to avoid printf reentrancy traps. The log is ugly and short — that is intentional.

We end with a candid note: if your silicon has errata around chained descriptors, escalate to the errata sheet before polishing software elegance.

#DMA #buffers #discipline