cancel
Showing results for 
Search instead for 
Did you mean: 

measure the frequency of the microcontroller from the outside

fullcaos
Associate II
Posted on October 13, 2012 at 20:32

I need to measure from outside the sampling frequency of a STM32F4 discovery, I have thought about using a pin as an output, and bring it in an alternating manner to VDD and GROUND each time the DMA takes a sample from the ADC and places it in memory ! can anyone suggest me how to do such a thing? or if there are better ways to measure the frequency from the outside? thanks

4 REPLIES 4
Posted on October 14, 2012 at 02:26

If you want internal frequency sources you could presumably output them via the MCO pin(s)

If you are pacing an ADC via a timer, then the TIMx_CHx pins are externally visible.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
fullcaos
Associate II
Posted on October 14, 2012 at 15:45

if I understand correctly I could use the command:

RCC_MCOxConfig (RCC_MCOxSource_xxx, RCC_MCO2Div_x);

to take me on a clock associated to APB2 on pin MCO?

but I can not find the command to bring the clock associated all'APB2 on pin MCO ....

you could write a few lines of code to clarify the procedure?

the sampling frequency of the ADC is FADC = (APB2 / 2) / (number of cycles) but if use more channels for example, four channels of the same ADC must divide by four FADC?

thanks for the help

Posted on October 14, 2012 at 19:06

If you pace the ADC rather than run it a full tilt, you'll have a much better handle on when the conversion starts.

STM32F4-Discovery_FW_V1.1.0\Project\Peripheral_Examples\RCC

/* Output clock on MCO2 pin(PC9) ****************************************/
/* Enable the GPIOC peripheral */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
/* Configure MCO2 pin(PC9) in alternate function */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* System clock selected to output on MCO2 pin(PC9)*/
RCC_MCO2Config(RCC_MCO2Source_SYSCLK, RCC_MCO2Div_2);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
fullcaos
Associate II
Posted on October 15, 2012 at 01:15

thanks for your help