DMA & Bus Arbitration
DMA Bandwidth & FIFO Overrun Calculator
Estimate DMA throughput, bus utilization percent, half-transfer interrupt deadlines and peripheral FIFO headroom before locking your memory map.
e.g. 72 MHz F1, 168 MHz F4, 216 MHz F7, 240 MHz H7 AXI
STM32 DMA typically spends 4-6 AHB cycles per P2M beat
STM32 DMA FIFO is 16 bytes (4 words); SPI DR is 2-4 bytes
Workload presets:
Healthy bus headroom: 8.80% DMA utilization with 22.7x FIFO service margin.
Sustained Throughput3.81 MB/sPeak bus cap 43.4 MB/s
Bus Utilization8.80%Excluding CPU instruction/data contention
Half / Full Buffer IRQ2.05 ms8.0 KB total; HT IRQ every 1024.0 us
FIFO Overrun Window4.00 usBurst takes 176 ns (22.7x margin)
Sizing DMA buffers and burst lengths
Large bursts lower bus arbitration overhead, yet they block lower-priority channels for longer windows. Keep burst sizes at INCR4 when high-rate UART or SPI peripherals share the same AHB matrix as a display or camera stream.
| Metric | Formula | Target margin |
|---|---|---|
| Sustained rate | sample_rate * channels * beat_bytes | Keep under 35% of bus peak so CPU fetches stay unblocked. |
| FIFO window | fifo_bytes / sustained_rate | Must exceed worst-case concurrent burst latency by at least 5x. |
| HT IRQ deadline | (buffer_bytes / 2) / sustained_rate | Must exceed your worst-case DSP or ISR processing time. |
Frequently asked questions
| Question | Answer |
|---|---|
| Why does a DMA stream trigger FIFO overrun even when average bus utilization is under 20%? | Overruns depend on peak bus latency rather than average bandwidth. If another high-priority DMA channel executes a 16-beat burst across a slow bus bridge, a 2-byte SPI or UART data register can overflow before arbitration returns. |
| How does double-buffered (ping-pong) DMA reduce missed interrupts? | Circular DMA fires a half-transfer interrupt when the first half fills and a transfer-complete interrupt at the end. Your CPU gets half the total buffer duration to process samples before DMA overwrites the same region. |
| What extra step does Cortex-M7 require before reading DMA buffers? | Cortex-M7 cores with D-Cache enabled return stale SRAM data unless you place DMA buffers in a non-cacheable MPU region or call SCB_InvalidateDCache_by_Addr() aligned to 32-byte cache lines. |