Skip to main content
wuguobing
Associate II
September 30, 2007
Question

How can i use PA8 as MCO?

  • September 30, 2007
  • 3 replies
  • 848 views
Posted on September 30, 2007 at 23:10

How can i use PA8 as MCO?

    This topic has been closed for replies.

    3 replies

    wuguobing
    wuguobingAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:16

    PA8 is a multi-function pin, it's AF can be USART1_CK, TIM1_CH1 or MCO, how can i config it to be MCO?

    I can remap TIM1 to none, but USART1_CK can't be remapped!

    16-32micros
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:16

    Dear wuguobing,

    You can configure PA8 to MCO by simply calling these functions :

    /* Configure GPIOA ------------------------------------------*/

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA , ENABLE);

    /* Output HSE clock on MCO pin */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

    GPIO_Init(GPIOA, &GPIO_InitStructure);

    RCC_MCOConfig(RCC_MCO_HSE);

    You can refer to the STM32 Firmware library using this link :

    http://www.st.com/stonline/products/support/micro/files/um0427.zip

    Then you can go to the RCC Example in this directory ''STM32F10xFWLib/FWLib/examples/RCC'' where you will find more details ;)

    With best regards,

    STOne-32

    wuguobing
    wuguobingAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:16

    Thanks a lot!

    After reset, USART1_CK, TIM1_CH1 and MCO are disabled, to use PA8 as mco, just config MCO to work, and config PA8 to AF mode.:-D

    Only one AF on the same pin can be enabled. But if two AF functions in output mode is enabled at same time, what would happen, stm32 will be destroyed?