File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,11 @@ void mbed_sdk_init()
292
292
#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE )
293
293
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0 };
294
294
PeriphClkInitStruct .PeriphClockSelection = RCC_PERIPHCLK_RTC ;
295
+ #if defined(RCC_RTCCLKSOURCE_HSE_DIVX )
295
296
PeriphClkInitStruct .RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16 );
297
+ #else
298
+ PeriphClkInitStruct .RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128 ;
299
+ #endif
296
300
if (HAL_RCCEx_PeriphCLKConfig (& PeriphClkInitStruct ) != HAL_OK ) {
297
301
error ("PeriphClkInitStruct RTC failed with HSE\n" );
298
302
}
Original file line number Diff line number Diff line change @@ -65,7 +65,11 @@ void rtc_init(void)
65
65
#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE )
66
66
(void )RCC_OscInitStruct ;
67
67
PeriphClkInitStruct .PeriphClockSelection = RCC_PERIPHCLK_RTC ;
68
+ #if defined(RCC_RTCCLKSOURCE_HSE_DIVX )
68
69
PeriphClkInitStruct .RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16 );
70
+ #else
71
+ PeriphClkInitStruct .RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128 ;
72
+ #endif
69
73
if (HAL_RCCEx_PeriphCLKConfig (& PeriphClkInitStruct ) != HAL_OK ) {
70
74
error ("PeriphClkInitStruct RTC failed with HSE\n" );
71
75
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ extern "C" {
47
47
#error "RTC clock configuration is invalid!"
48
48
#endif
49
49
50
- #if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE ) && !(TARGET_STM32F2 || TARGET_STM32F4 || TARGET_STM32F7 )
50
+ #if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE ) && !(TARGET_STM32F2 || TARGET_STM32F4 || TARGET_STM32F7 || TARGET_STM32F1 )
51
51
#error "RTC from HSE not supported for this target"
52
52
#endif
53
53
You can’t perform that action at this time.
0 commit comments