cancel
Showing results for 
Search instead for 
Did you mean: 

likely bug in cubemx code generation for stm32f103x usb clock

noobee
Associate II
Posted on April 24, 2015 at 16:43

hi

trying to enable USB VCP on the stm32f103c8 device, used the cubemx generator, selected USB device and CDC class, updated the clock generation page so that it generated the 48MHz clock for USB (HSE Prediv=1, PLLsourceMux=HSE, PLLMul=6, USB Prescaler = 1). however, the generated code in SystemClock_Config() still did not set up the USB clock correctly. in particular, the following lines are needed but missing:

RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;

i added them in and was then able to get my PC to recognize the USB (COM) device after that. incidentally, the code is generated for the stm32f 303 device, which was how i found the discrepancy. thanks
1 REPLY 1
stm32cube-t
Senior III
Posted on July 01, 2015 at 11:59

Issue solved with MX 4.8