cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 can't config MCO(PA8) and USB CLK together

verajianglei
Associate
Posted on April 23, 2014 at 17:45

Hello All,

I use STM32F103VCT6 and VirtualComPort_loopback Project, it worked well. But now I want to output clk through PA6(MOC) ,but it did't work unless comment out Set_USBClock(); . Who knows why?

void MCO_Config(void) 
{ 
GPIO_InitTypeDef is; 
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); 
is.GPIO_Pin = GPIO_Pin_8; 
is.GPIO_Speed = GPIO_Speed_50MHz; 
is.GPIO_Mode = GPIO_Mode_AF_PP; 
GPIO_Init(GPIOA,&is); 
RCC_MCOConfig(RCC_MCO_SYSCLK); 
return; 
}

The Main:

***************************************************************************** 
* @file main.c 
* @author MCD Application Team 
* @version V4.0.0 
* @date 21-January-2013 
* @brief Virtual Com Port Demo main file 
***************************************************************************** 
int main(void) 
{ 
MCO_Config(); 
Set_System(); 
Set_USBClock(); // comment out this line MOC will work 
USB_Interrupts_Config(); 
USB_Init(); 
MainLoop(); 
}

Thnaks for any kind of suggestion. #mco-clock-output-vcp-usb
3 REPLIES 3
Posted on April 23, 2014 at 18:30

I don't know that demo, but obviously the

Set_USBClock()

function modifies the RCC_CFGR register in a way which changes the MCO bits in it. So you need to fix that function. JW
Amel NASRI
ST Employee
Posted on April 28, 2014 at 18:47

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Can%20not%20use%20MCO%20output%20in%20VirtualComport_Loopback%20project

(resolved).

-Mayla-

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 April 28, 2014 at 19:05

Although not really explained...

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