Skip to content

Commit 6b81de1

Browse files
committed
fix(GNSE): add missing LSE config
prevents RTC to be properly initialized within STM32LoRaWAN. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent aed76aa commit 6b81de1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

variants/STM32WLxx/WL54CCU_WL55CCU_WLE4C(8-B-C)U_WLE5C(8-B-C)U/variant_GENERIC_NODE_SE_TTI.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,20 @@ WEAK void SystemClock_Config(void)
7070
RCC_OscInitTypeDef RCC_OscInitStruct = {};
7171
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
7272

73+
/** Configure LSE Drive Capability
74+
*/
75+
HAL_PWR_EnableBkUpAccess();
76+
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
7377
/** Configure the main internal regulator output voltage
7478
*/
75-
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
79+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
7680
/** Initializes the CPU, AHB and APB busses clocks
7781
*/
78-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
82+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_MSI;
83+
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
7984
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
8085
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
81-
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
86+
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_11;
8287
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
8388
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
8489
Error_Handler();
@@ -94,12 +99,12 @@ WEAK void SystemClock_Config(void)
9499
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
95100
RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;
96101

97-
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
102+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
98103
Error_Handler();
99104
}
100105
}
101106

102107
#ifdef __cplusplus
103108
}
104109
#endif
105-
#endif /* ARDUINO_GENERIC_* */
110+
#endif /* ARDUINO_GENERIC_NODE_SE_TTI */

0 commit comments

Comments
 (0)