cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling Frequency of ADC on STM32F4 Discovery

kyaw
Associate II
Posted on November 07, 2015 at 11:42

Hi. I'm fairly new to the concepts of ADC and currently, I'm using STM32F4 Discovery. For ADC, I have these settings for my ADC settings in my ADC_init() (source codes from an author online).

ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;

ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent;

ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div4;

ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;

ADC_CommonInit(&ADC_CommonInitStruct);

and my ADC channel config is:

ADC_RegularChannelConfig(ADC1, channel, 1, ADC_SampleTime_15Cycles);

How do I calculate sampling frequency of my ADC from these values?

#adc #adc-sampling-rate #stm32f4-discovery
3 REPLIES 3
Posted on November 07, 2015 at 15:39

For 12-bit sampling

SAMPFREQ = (APBFREQ / 4) / (12 + 15)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kyaw
Associate II
Posted on November 08, 2015 at 04:13

Hi. May I know what APBFREQ is and where I can find its set value?

Posted on November 08, 2015 at 16:53

The speed the APB (peripheral bus) to which the ADC is connected. So on the F4, APB2, probably 84 MHz depending on how you have configured it.

{

  RCC_ClocksTypeDef  RCC_ClockFreq;

  RCC_GetClocksFreq(&RCC_ClockFreq);

  printf(''%d\n'', RCC_ClockFreq.PCLK2_Frequency);}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..