STM32F4XX IO口时钟复用功能

基于STM32F412,在PC9上输出System Clock 。 同理,也可以在PA8上输出其他的时钟功能。

    GPIO_InitTypeDef  GPIO_InitStructure;
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_Init(GPIOC, &GPIO_InitStructure); 
    
    GPIO_PinAFConfig(GPIOC,GPIO_PinSource9,GPIO_AF_MCO);
    
    RCC_MCO2Config(RCC_MCO2Source_SYSCLK, RCC_MCO2Div_4); 
输出的参数,可以通过调用RCC_MCO1Config( )和RCC_MCO2Config( ) 这两个函数即可。库函数的解释已经很清晰了,也不用再复述了。


猜你喜欢

转载自blog.csdn.net/EFM32/article/details/78071190