cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure the system core clock on discovery board

n.serina
Associate III
Posted on April 29, 2016 at 07:22

Hello, 

I have discovery board , which runs with stm32f407vg MCU. i want to measure the system core clock by bringing it on the gpio or any other means ??

Is it doable ? please help me how to do it 

#clock #stm32
2 REPLIES 2
Posted on April 29, 2016 at 07:59

You won't be able to output 168 MHz, you can output a fraction of that via PA8 (MCO) or by using a timer/channel combination.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 29, 2016 at 08:08

Or PC9 (MCO2)

/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* 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);
/* Output HSE clock on MCO1 pin(PA8) ****************************************/
/* Enable the GPIOA peripheral */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* Configure MCO1 pin(PA8) in alternate function */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
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(GPIOA, &GPIO_InitStructure);
/* HSE clock selected to output on MCO1 pin(PA8)*/
RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);

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