Skip to content

Commit 39db47b

Browse files
author
fpr
committed
Update NUCLEO-L476 clock config: enable HSI to allow uart as wakeup source in stop mode
Signed-off-by: fpr <[email protected]>
1 parent 198cfb7 commit 39db47b

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

variants/NUCLEO_L476RG/variant.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ extern "C" {
103103
/**
104104
* @brief System Clock Configuration
105105
* The system Clock is configured as follows :
106-
* System Clock source = PLL (MSI)
106+
* System Clock source = PLL (HSI)
107107
* SYSCLK(Hz) = 80000000
108108
* HCLK(Hz) = 80000000
109109
* AHB Prescaler = 1
110110
* APB1 Prescaler = 1
111111
* APB2 Prescaler = 1
112-
* MSI Frequency(Hz) = 4000000
112+
* HSI Frequency(Hz) = 16000000
113113
* PLL_M = 1
114-
* PLL_N = 40
114+
* PLL_N = 10
115115
* PLL_R = 2
116116
* PLL_P = 7
117-
* PLL_Q = 4
118-
* Flash Latency(WS) = 4
117+
* PLL_Q = 2
118+
* Flash Latency(WS) = 3
119119
* @param None
120120
* @retval None
121121
*/
@@ -124,20 +124,16 @@ WEAK void SystemClock_Config(void)
124124
RCC_OscInitTypeDef RCC_OscInitStruct = {};
125125
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
126126

127-
/* MSI is enabled after System reset, activate PLL with MSI as source */
128-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
129-
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
130-
131-
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
132-
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
127+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
128+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
129+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
133130
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
134-
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
131+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
135132
RCC_OscInitStruct.PLL.PLLM = 1;
136-
RCC_OscInitStruct.PLL.PLLN = 40;
133+
RCC_OscInitStruct.PLL.PLLN = 10;
137134
RCC_OscInitStruct.PLL.PLLR = 2;
138135
RCC_OscInitStruct.PLL.PLLP = 7;
139-
RCC_OscInitStruct.PLL.PLLQ = 4;
140-
136+
RCC_OscInitStruct.PLL.PLLQ = 2;
141137
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
142138
{
143139
/* Initialization Error */
@@ -151,7 +147,7 @@ WEAK void SystemClock_Config(void)
151147
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
152148
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
153149
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
154-
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
150+
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
155151
{
156152
/* Initialization Error */
157153
while(1);

0 commit comments

Comments
 (0)