2016-04-28 10:22 PM
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 #stm322016-04-28 10:59 PM
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.
2016-04-28 11:08 PM
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);