Skip to content

Commit 650ec46

Browse files
ABOSTMfpistm
authored andcommitted
fix: variant Nucleo F031K6: switch PLL source to HSI
On Nucleo F031K6, the HSE bypass through MCO from STLink is not configured by default (It would need SolderBridge configuration) Thus use HSI by default. Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent 78cd148 commit 650ec46

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Diff for: variants/STM32F0xx/F031K6T/variant_NUCLEO_F031K6.cpp

+12-9
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,23 @@ WEAK void SystemClock_Config(void)
7070
RCC_OscInitTypeDef RCC_OscInitStruct = {};
7171
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
7272

73-
/*
74-
* Initializes the RCC Oscillators according to the specified parameters
75-
* in the RCC_OscInitTypeDef structure.
76-
*/
77-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
78-
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
73+
/** Initializes the RCC Oscillators according to the specified parameters
74+
* in the RCC_OscInitTypeDef structure.
75+
* No HSE Oscillator on Nucleo by default (solderbridge not configured)
76+
*/
77+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
78+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
79+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
7980
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
80-
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
81-
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
81+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
82+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
8283
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
8384
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
8485
Error_Handler();
8586
}
86-
/* Initializes the CPU, AHB and APB buses clocks */
87+
88+
/** Initializes the CPU, AHB and APB buses clocks
89+
*/
8790
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
8891
| RCC_CLOCKTYPE_PCLK1;
8992
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

0 commit comments

Comments
 (0)