AnsweredAssumed Answered

System Clock Mux HSE doesn't work

Question asked by lee.gordon on Jun 4, 2014
Latest reply on Jun 4, 2014 by manderson

I am using the STM32F415RGT.  A 50MHz oscillator is connected to the HSE input.  In the STM32CubeMX Clock Configuration tab, I selected HSE for the System Clock Mux.  Supposedly the system clock should be driven directly by the oscillator.
But when I run the code, the system appears to run at 16MHz, that is the speed of the HSI.

I thought my oscillator is bad, but when I enable the PLL and choose PLLCLK on the system clock mux, the code runs at the expected SYSCLK rate.  So that means the oscillator is good and is connected to the system correctly.

Does anybody know why the system selects to use the HSI as the input clock instead of the HSE as I selected in the STM32CubeMX?

The system clock configuration code looks like this:
static void SystemClock_Config(void)

  RCC_ClkInitTypeDef RCC_ClkInitStruct;
  RCC_OscInitTypeDef RCC_OscInitStruct;



  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1);