An idle comment about DMA in gossamer yesterday made me realize it’s beyond time for me to crack that nut. Alas, being in plain old C-land, I couldn’t leverage an object oriented solution like ZeroDMA. No matter; this morning I buckled down and grokked enough of it to write a C API for doing DMA jobs. Useful for many things, but for my battery-free solar powered name tag, it lets me operate entirely without the CPU, which means it works indoors now (at least fairly close to the windows, haha).

naming things is hard, and I think the hardest part I had with grokking the DMAC is that it's all named so opaquely. There are channels, there are triggers, there are actions and descriptors and it all becomes a jumble. It should be simple: you have a job to do. You configure how the job gets done (that's the channel). then you configure what the job does (that's the descriptor).

…at least I think that's how it should work? Gonna take this API out for a spin while I DMA the DAC peripheral next.

Promising enough! DMA shoving a sine wave to the DAC on a CircuitPlayground, at a frequency determined by one of the timer/counters. There is an annoying gap in the wave, seemingly where the DMA task loops around, but that’s a problem for tomorrow-Joey to solve.

LOL, with fresh eyes this morning I realized that this wasn’t a DMA problem at all. I’d just run into the other hard problem in computer science: off-by-one errors. Life pro tip: if you can output a 10-bit value, that’s values from 0 to 1023, not 0 to 1024.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.