Skip to main content
Visitor II
September 10, 2025
Question

ADC DAC problems

  • September 10, 2025
  • 2 replies
  • 338 views

Hi, i encountered the problem on my stm32 G474RE board, that when i use the adc in dma mode i can not use a dac. The dac simply does not work. As long as i dont start the adc in dma mode, my dac is generating the right waveform, but when i start the adc the dac_setValue function is stuck and wont update? Has anybody encountered that problem? Am i doing something wrong?

    This topic has been closed for replies.

    2 replies

    Super User
    September 10, 2025

    Your ADC interrupts are triggering so fast it prevents the code from doing anything else. Decrease ADC sample rate, increase DMA buffer size. Increasing the sample rate to max is generally beneficial.

    WoelkiAuthor
    Visitor II
    September 11, 2025

    But how can i then use the maximum sampling frequency of the adc? The MCU clock is set to 120MHz so it should be way faster than the ADC sampling frequency. Is there just too much overhead, with the HAL libraries? I basically want to compare consecutive adc values in real time to react on them. Measuring a ton of values and buffering them is not suitable for my application.

    Super User
    September 11, 2025

    Code takes time to run. You can't react to every sample at max sample rate immediately after it happens. The CPU can't keep up.

    Graduate II
    September 12, 2025

    Unless you're doing some real-time processing on each sample, use big buffers for AD and DA data, combined with DMA.

    And for getting (even more) help:

    show your relevant code snippets, using the </> button.

    Some people don't have time / want to download and unzip.