cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411 ADC+DMA+HAL wrong ADCCLK setting

andrey2richter
Associate II

Dear STM32 community,

I have an understanding problem with clock calculation for ADC unit.

The ADC1 will be used with DMA by STM32F411 CPU.

HSE_CLK = 8MHz, HCLK = 96 MHz, PCLK2 = HCLK/4 => 24MHz (for ADC clock).

There are two ADC channel in use: 12 Bit, 480 sampling time => 12 + 480 = 492 clock per each channel.

The ADC run in scan mode , continuous conversion mode. DMA interrupt is activated (DMA2_Stream0_IRQHandler)

Therefore calculated ADC coversion period contain (1/24MHz) x 492 x 2 = 41us

For measuring purpose in DMA interrupt an LED is toggled.

Surprisingly, if your meassuring time with osciloscope, the pulse or pause time contain 82us !!! (x2 from calculated time)

Ok, in CubeMX settings for ADC DMA you can clear checkbox "use FiFo".

In thhis case you will be surprised too,

because on the osciloscope screen your will see the pulse time of 20,5us (1/2 from calculated time)

Can anyone, please, explain this phenomenon ? What I do wrong ?

Many thanks in advance !!!

0 REPLIES 0