mirror of https://github.com/ARMmbed/mbed-os.git
STM32 RTC : Start LSI clock asap
parent
3d7f99775a
commit
8d995f3817
|
@ -54,5 +54,21 @@ void mbed_sdk_init()
|
||||||
SetSysClock();
|
SetSysClock();
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
/* Start LSI clock for RTC */
|
||||||
|
#if DEVICE_RTC
|
||||||
|
#if !MBED_CONF_TARGET_LSE_AVAILABLE
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
|
|
||||||
|
if (__HAL_RCC_GET_RTC_SOURCE() != RCC_RTCCLKSOURCE_NO_CLK) {
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
|
||||||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||||
|
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||||
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||||
|
error("Init : cannot initialize LSI\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* ! MBED_CONF_TARGET_LSE_AVAILABLE */
|
||||||
|
#endif /* DEVICE_RTC */
|
||||||
|
|
||||||
mbed_sdk_inited = 1;
|
mbed_sdk_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue