Skip to content

Commit 7e3ea68

Browse files
authored
Merge pull request #15385 from UNSW-Sunswift/master
Added extra HSE Values for STM32G431xB
2 parents 17dc3dc + ac8204c commit 7e3ea68

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G431xB/system_clock.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
8888
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
8989
RCC_PeriphCLKInitTypeDef RCC_PeriphCLKInitStruct = { 0 };
9090

91-
#if HSE_VALUE != 24000000
91+
#if HSE_VALUE != 4000000 && HSE_VALUE != 8000000 && HSE_VALUE != 16000000 && HSE_VALUE != 24000000
9292
#error Unsupported externall clock value, check HSE_VALUE define
9393
#endif
9494

@@ -100,7 +100,16 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
100100
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
101101
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
102102
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
103+
#if HSE_VALUE == 4000000
104+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
105+
#elif HSE_VALUE == 8000000
106+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV2;
107+
#elif HSE_VALUE == 16000000
108+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4;
109+
#elif HSE_VALUE == 24000000
103110
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV6;
111+
#endif
112+
104113
//! 170MHz as a core frequency for FDCAN is not suitable for many frequencies,
105114
//! as it provides low accuracy. When no FDCAN is used, the full capacity of 170 MHz
106115
//! should be standard.

0 commit comments

Comments
 (0)