2022-07-14 05:34 PM
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?
2022-07-14 06:56 PM
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.
2022-07-14 07:00 PM
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.