r/stm32f4 • u/arash_hitech • 5d ago
ADC-to-DAC Spike Problem on STM32 (Random Glitches in ADC → DMA → DAC)
Hi everyone,
I'm looking for someone with solid STM32F4 experience who can help me debug and verify a simple but problematic ADC-to-DAC signal path on an STM32F407VGT6.
The project:
MCU: STM32F407VGT6
ADC input: ADC3 on PA3
DAC output: DAC1 on PA4
Sampling rate: 100 kHz
ADC and DAC use DMA
Timer-triggered ADC sampling
No EQ, filters, or other audio processing in the current test
The problem:
The input signal passes through the system, but the DAC output contains occasional short glitches or spikes. Grounding the ADC input makes the glitches disappear or become unnoticeable. Changing the compiler optimization level also changes their frequency.
I've already tested different buffer configurations and DMA arrangements. Some changes improve the result, but I haven't identified the root cause.
What I'm looking for:
Is there an experienced STM32 developer who can review my existing code, identify the underlying problem, and help produce a reliable, verified implementation?
I'm particularly interested in checking:
ADC triggering and DMA timing
DMA buffer handling and data alignment
ADC-to-DAC sample transfer
Possible race conditions or missed samples
Any other potential source of the glitches
I can provide my current main.c, stm32f4xx_hal_msp.c, and stm32f4xx_it.c, along with oscilloscope observations and details of the tests I've performed.
I'm not looking for random code changes or guesses. I'd like to identify the actual cause and verify the solution through testing.
If you have relevant STM32F4, DMA, or embedded audio experience, I'd appreciate your help.
Thank you!