cancel
Showing results for 
Search instead for 
Did you mean: 

Can't change SYSCLK in UART HyperTerminal example

mattscar
Associate II

When I create the UART_HyperTerminal_IT project in STM32Cube, SYSCLK's source is assigned to PLLCLK:

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

  RCC_OscInitStruct.HSIState = RCC_HSI_ON;

 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

...

  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

I tried changing the SYSCLK source to MSI, but this code didn't work:

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI | RCC_OSCILLATORTYPE_HSI

  RCC_OscInitStruct.MSIState = RCC_MSI_ON;

  RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;

  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;

  RCC_OscInitStruct.HSIState = RCC_HSI_ON;

 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

...

  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;

When I use this code, I can't access the MCU with the terminal emulator. Is there a reason that SYSCLK must be set to the PLLCLK produced by HSI?

2 REPLIES 2

Which STM32?

Check/post RCC registers setting. Or, better, write your own code setting the clocks.

JW​

PS. In some'L4, Cube was known to mess up the RC oscillators' trim, search in this forum.

mattscar
Associate II

Thank you. I'm programming the STM32L552 on the Nucleo-L552ZE board.

Normally, I can set SYSCLK's source to MSI without any trouble. But when I change the example project, it stops working.