cancel
Showing results for 
Search instead for 
Did you mean: 

Determining the ADC frequency and # of Sampling Periods

bryan costanich
Associate II
Posted on November 11, 2017 at 04:06

Hi folks!

I'm working with a Netduino, which has an STM32F4, running at 168MHz.

I'm trying to doa calculation (specifically the following), which needs the ADC frequency (

Fadc

) and number of sampling periods (

k

:(

0690X0000060PD9QAM.png

I'm having a little trouble tracking these down, however.

Tackling

Fadc

first,

https://github.com/WildernessLabs/Netduino_SDK/blob/master/Netduino_3_NETMF/DeviceCode/Targets/Native/Netduino_STM32/DeviceCode/STM32_Analog/STM32_AD_functions.cpp#L35

https://github.com/WildernessLabs/Netduino_SDK/blob/master/Netduino_3_NETMF/DeviceCode/Targets/Native/Netduino_STM32/DeviceCode/STM32_Analog/STM32_AD_functions.cpp#L35

, which is peripheral clock / 2 (according to the note next toit). I’m pretty sure from my reading that the peripheral clock is the same as the MCU clock, and my MCU is set to 168MHz. So 168MHz / 2 = 84MHz. However, the data sheet says that the ADC Clock Frequency (fADC) is between 30 and 36MHz for VDDA of 2.5V to 3.6V, and the VDDA on the Netduino should be around 3.3V. So what is the actual value here?

For the number of sampling periods, Ifound the following in source:

#

define

STM32_AD_SAMPLE_TIME

2

//

sample time = 28 cycles

ADC1->SMPR1 =

0x00249249

*

STM32_AD_SAMPLE_TIME

;

So SMPR1 has a hex value of 0x00249249 which is2,396,745 in base 10, so I get 4,793,490 for the number sampling periods, but that can't be right either, considering when I was looking at a sample for the STM32F1, it had a sampling time of 8:

0690X0000060PDVQA2.png

With my answer 6 orders of magnitude off, I think it's probably not right. So I'd appreciate the help.

10 REPLIES 10
Posted on November 14, 2017 at 17:40

There must be some other place where it's being set, though we can't seem to find it. 

I'll keep digging. Until I know

Fadc

, I can't do the resistance calc.

:(