cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4 adc max sample rate

Ermin Arnautovic
Associate
Posted on June 08, 2018 at 11:20

Hi,

I have a problem to achieve max. sampling rate of 2.4 MSPS(12 Bit) @168 Mhz Clock, AHB2 Bus is running at  84 MHz and ADC Clock = 42 MHz.

Any idea why I get just sampling rate of  1.4 MSPS and not maximum sampling rate?

static void MX_ADC1_Init(void)

{

  ADC_ChannelConfTypeDef sConfig;

    /**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)

    */

  hadc1.Instance = ADC1;

  hadc1.Init.ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV2;

  hadc1.Init.Resolution = ADC_RESOLUTION_12B;

  hadc1.Init.ScanConvMode = DISABLE;

  hadc1.Init.ContinuousConvMode = ENABLE;

  hadc1.Init.DiscontinuousConvMode = DISABLE;

  hadc1.Init.NbrOfDiscConversion = 0;

  hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;

  hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T3_TRGO;

 // hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;

  hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;

  hadc1.Init.NbrOfConversion = 1;

  hadc1.Init.DMAContinuousRequests = ENABLE;

  hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

  if (HAL_ADC_Init(&hadc1) != HAL_OK)

  {

    _Error_Handler(__FILE__, __LINE__);

  }

    /**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.

    */

  sConfig.Channel = ADC_CHANNEL_1;

  sConfig.Rank = 1;

  sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;

  sConfig.Offset = 0;

  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)

  {

    _Error_Handler(__FILE__, __LINE__);

  }

}

I would be very thankful…

Cheers, 

Ermin

2 REPLIES 2
Posted on June 08, 2018 at 13:44

Any idea why I get just sampling rate of  1.4 MSPS and not maximum sampling rate?

How do you know those 1.4MSPS?

JW

Posted on June 08, 2018 at 13:53

I sampled 100 kHz Sinus and got 14 values over one period. I just counted from lowest to lowest value among sampled values in Debugger.

E.