AnsweredAssumed Answered

Changing clock source from HSE to HSI

Question asked by vandal.sangamesh on Aug 26, 2015
Latest reply on Apr 28, 2017 by Jith cr
Please refer below code to change clock source from external HSE to internal HSI
     /* Enable HSE Oscillator and activate PLL with HSE as source */
#if 0     // Choose External Crystal (HSE) As Source
     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
     RCC_OscInitStruct.HSEState = RCC_HSE_ON;
     RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
     RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
     RCC_OscInitStruct.PLL.PLLM = 25;
     RCC_OscInitStruct.PLL.PLLN = 240;
     RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
     RCC_OscInitStruct.PLL.PLLQ = 5;

#else     // Choose Internal Crystal - 16MHz (HSI) As Source
     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
     RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
     RCC_OscInitStruct.HSIState = RCC_HSI_ON;
     RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
     RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
     RCC_OscInitStruct.PLL.PLLM = 16;
     RCC_OscInitStruct.PLL.PLLN = 240;
     RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
     RCC_OscInitStruct.PLL.PLLQ = 5;


     /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
     clocks dividers */
     RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
     RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
     RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
     HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);

We observed that the most of the peripherals are working fine with this change from HSE to HSI
however the USB host communication (PB14 PB15) which is connected to external HUB IC(which uses 48Mhz crystal) to communicate with 4 USB devices is not as same as we observed with HSE configuration.

Are we missing anything in changing from HSE to HSI, do we need to change anything somewhere else for USB host communication to work normal

Assist us on this