cancel
Showing results for 
Search instead for 
Did you mean: 

ADC in continuous mode with DMA stops instead of running indefinitely

Robert_149494
Associate II

We have a STM32U575xx chip, where I want to read a bunch of voltages continuously.

These voltages don't need to be measured at a particularly high rate, nor does the timing need to be strict. So it seemed efficient to run the ADC continuously with DMA. We expect that somewhere in memory there are constantly updating ADC readouts, and we can read these values when we want to, without any blocking calls. Any unused values can just be overwritten again.

However, this doesn't work entirely: we can do a non-blocking ADC read with DMA, but it seems to be only a single read, while I was expected a continuous readout because the ADC is in independent mode.

We start the ADC/DMA on init:

 

        HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);
        HAL_ADC_Start_DMA(&hadc1, m_adc1Values, Adc1NbrChannels);

 

Why does this ADC stop? Am I missing a setting, or does 'continuous' and 'independent' not mean what I expect it to?

 

It concerns ADC1, channels 1 to 7. We set it up with GPDMA1, channel 0. The complete CubeMX configuration is below.

 

Our workaround now is to just restart it whenever the DMA has stopped, with this entry in our on-tick callback:

 

        if (HAL_IS_BIT_CLR(hadc1.Instance->ISR, ADC_FLAG_EOC))
        {
            HAL_ADC_Start_DMA(&hadc1, m_adc1Values, Adc1NbrChannels);
        }

 

 

 

0 REPLIES 0