cancel
Showing results for 
Search instead for 
Did you mean: 

CLKOUT feature on STM32F205

aamirali641989
Associate II
Posted on June 17, 2013 at 11:01

I have used following code to get CLKout on PC9 but it didn't work:

Sysyteminit() was called earlier. 

    /*Enable or disable the AHB1 peripheral clock */

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);

/*Configure GPIO pin alternate function */

GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_MCO);
4 REPLIES 4
Amel NASRI
ST Employee
Posted on June 17, 2013 at 11:43

Hello A2,

You have to configure the pin in AF mode then select the clock to be outpout:

/* Enable the GPIOC peripheral */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); 
/*Configure MCO2 pin(PC9) in alternate function mode */
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); 
GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_MCO); 
/* Select to output the SYSCLK */
RCC_MCO2Config(RCC_MCO2Source_SYSCLK, RCC_MCO2Div_1);

ST.MCU

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

aamirali641989
Associate II
Posted on June 17, 2013 at 12:11

Thanks , it solved the problem. Also when I limit the GPIO freq by 100Mhz. but I set 120Mhz on MC02 & I was able to see it actually. How can this happen, Shouldn't it be limited to 100mhz

Amel NASRI
ST Employee
Posted on June 17, 2013 at 12:32

100MHz is the IO speed not the max system clock.

Even with less speed value, you should be able to output the SYSCLK, PLLCLK or HSE using the prescalers.

Edit: You are right, for garanteed cases, the selected clock to output onto MCO must not exceed the maximum I/O speed.

You can use the prescaler from 1 to 5 to get values greater than this speed (

RCC_MCO2Div_x

).

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on June 17, 2013 at 13:41

How can this happen, Shouldn't it be limited to 100mhz

It's a slew rate control setting, determining how hard/aggressively the pin is driven, it's external performance will be impacted by the capacitive load being driven. It is not a filter or physical limit in the sense you interpreted.

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