N32芯片是国民技术的芯片,我使用N32G45X的PA8引脚输出时钟。代码如下:
- void MCO1_Init(void)
- {
- GPIO_InitType GPIO_InitStructure;
- RCC_EnableClockSecuritySystem(ENABLE);
-
- /* Enable GPIOs clocks */
- RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA|RCC_APB2_PERIPH_AFIO, ENABLE);
- /* Configure MCO (PA8) */
- GPIO_InitStructure.Pin = GPIO_PIN_8;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
- GPIO_InitPeripheral(GPIOA, &GPIO_InitStructure);
- RCC_ConfigMco(RCC_MCO_PLLCLK);//输出PLL时钟
- RCC_ConfigMcoPllClk(RCC_MCO_PLLCLK_DIV2);//72/2=36MHZ
- }
|