What is DMA/FastADC?
DMA (Direct Memory Access) is a hardware feature that lets peripherals move data directly to memory without the CPU touching every byte. The CPU sets up the transfer — “grab 256 samples from the ADC and put them in this buffer” — then walks away to do other work. When the buffer is full, an interrupt fires and the CPU processes the data in bulk.
“FastADC” is shorthand for using the ESP32-S3’s ADC continuous mode driver, which leverages DMA to read the ADC at high, sustained sample rates instead of calling analogRead() in a loop.
Why This Matters for Your Projects
Section titled “Why This Matters for Your Projects”This is an advanced topic — most tinyCore projects won’t need DMA. But if you’re building audio visualizers, capturing microphone input, doing vibration analysis, or sampling sensors faster than about 1,000 times per second, DMA is how you get there without locking up the CPU.
The Problem DMA Solves
Section titled “The Problem DMA Solves”Without DMA, reading fast sensor data means the CPU is trapped in a tight loop: start conversion → wait → read result → repeat. A single analogRead() call on the ESP32-S3 takes roughly 100 microseconds — that’s only about 10,000 reads per second, and the CPU is 100% occupied doing nothing but waiting.
Need to run WiFi, update a display, or process data at the same time? You can’t. The CPU is stuck babysitting the ADC.
With DMA, the hardware samples autonomously at a precise, jitter-free rate. The CPU only wakes up to process completed data blocks. CPU utilization for data acquisition drops from near-100% to almost zero.
How It Works on the ESP32-S3
Section titled “How It Works on the ESP32-S3”The ESP32-S3 has a dedicated General DMA (GDMA) controller with 10 independent channels (5 transmit, 5 receive). This is a major upgrade over the original ESP32, where ADC DMA piggybacked on the I2S peripheral and caused conflicts.
ADC Continuous Mode
Section titled “ADC Continuous Mode”ADC continuous mode uses one GDMA receive channel. You configure a sample rate, select which ADC channels to read, and set up a buffer pool. The driver uses double-buffering — two memory buffers that alternate: while one fills with fresh samples, the other is available for your code to process.
The maximum sustained sample rate across all configured channels is 83,333 Hz (83.3 kHz). That’s enough for audio-rate signals and most sensor applications.
I2S DMA
Section titled “I2S DMA”For digital audio (microphones and speakers), the ESP32-S3’s two I2S peripherals each have independent DMA channels. I2S DMA handles streaming audio data to amplifiers and from microphones without CPU intervention. See What is I2S? for details.
Double-Buffering
Section titled “Double-Buffering”The core concept behind all DMA: two buffers alternate. While Buffer A fills with incoming data from the hardware, your code processes the completed data in Buffer B. When A is full, they swap — your code gets A, and the hardware starts filling B. Neither the hardware nor your code ever waits on the other. This ping-pong pattern ensures continuous, gap-free data capture.
When You Need DMA vs When You Don’t
Section titled “When You Need DMA vs When You Don’t”analogRead() is perfectly fine for:
- Reading a potentiometer knob position
- Checking battery voltage every few seconds
- Slow environmental sensors (temperature, humidity, light)
- Anything under ~1,000 samples/second where timing precision doesn’t matter
DMA becomes essential for:
- Audio capture (microphone input at 8–44.1 kHz)
- Vibration or motion analysis (accelerometers at 1–10 kHz)
- Anything above ~1,000 sustained samples/second
- Applications needing deterministic sample timing (FFT, waveform analysis)
- Situations where the CPU must also handle WiFi, displays, or computation
The dividing line is roughly 1 kHz sustained. Below that, polling is simple and works. Above that, DMA saves your CPU and your sanity.
What You Can Build
Section titled “What You Can Build”Audio visualization (FFT). Capture microphone input at 16–44.1 kHz via DMA, run a Fast Fourier Transform to extract frequency data, and drive an LED strip that reacts to the beat. DMA delivers the clean, evenly-spaced sample blocks that FFT requires — uneven polling intervals introduce artifacts that corrupt the frequency analysis.
High-speed sensor logging. Capture accelerometer, vibration sensor, or current probe data at 5–50 kHz and write it to an SD card. DMA handles acquisition while your code handles storage.
Basic oscilloscope. At 83 kHz, you can resolve signals up to ~40 kHz (the Nyquist limit). Capture a waveform into a buffer and display it on a screen or stream it over WiFi.
Sound-reactive projects. Analyze audio input in real-time to detect specific frequencies, volume thresholds, or patterns — then trigger lights, motors, or other outputs.
Going Deeper
Section titled “Going Deeper”Implementation has real complexity — this page covers the concepts, but the actual code involves configuring DMA descriptors, buffer sizes, and callback functions. These resources will take you further:
ESP-IDF documentation (the authoritative source):
Quick Reference
Section titled “Quick Reference”| Feature | ESP32-S3 |
|---|---|
| DMA controller | General DMA (GDMA), 10 channels |
| ADC continuous mode max rate | 83,333 Hz total across all channels |
| Buffering | Automatic double-buffering |
| ADC channels for DMA | ADC1 only (GPIO 1–10) |
| I2S DMA | 2 independent I2S peripherals with separate DMA |
analogRead() speed | ~10,000 reads/sec (CPU-bound) |
Learn More
Section titled “Learn More”- What is an ADC? — the basics of analog-to-digital conversion
- What is I2S? — digital audio streaming (also uses DMA)
- What is PWM? — analog output without a DAC
Video: Understanding DMA (Concepts)
Section titled “Video: Understanding DMA (Concepts)”DigiKey (presented by Shawn Hymel) — walks through DMA from scratch with diagrams showing CPU vs DMA data flow, then builds up to filling circular buffers from an ADC. Uses STM32 hardware, but the DMA concepts are identical across microcontroller families.