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()
292292#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE )
293293 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0 };
294294 PeriphClkInitStruct .PeriphClockSelection = RCC_PERIPHCLK_RTC ;
295+ #if defined(RCC_RTCCLKSOURCE_HSE_DIVX )
295296 PeriphClkInitStruct .RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16 );
297+ #else
298+ PeriphClkInitStruct .RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128 ;
299+ #endif
296300 if (HAL_RCCEx_PeriphCLKConfig (& PeriphClkInitStruct ) != HAL_OK ) {
297301 error ("PeriphClkInitStruct RTC failed with HSE\n" );
298302 }
Original file line number Diff line number Diff line change @@ -65,7 +65,11 @@ void rtc_init(void)
6565#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE )
6666 (void )RCC_OscInitStruct ;
6767 PeriphClkInitStruct .PeriphClockSelection = RCC_PERIPHCLK_RTC ;
68+ #if defined(RCC_RTCCLKSOURCE_HSE_DIVX )
6869 PeriphClkInitStruct .RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16 );
70+ #else
71+ PeriphClkInitStruct .RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128 ;
72+ #endif
6973 if (HAL_RCCEx_PeriphCLKConfig (& PeriphClkInitStruct ) != HAL_OK ) {
7074 error ("PeriphClkInitStruct RTC failed with HSE\n" );
7175 }
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ extern "C" {
4747#error "RTC clock configuration is invalid!"
4848#endif
4949
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 )
5151#error "RTC from HSE not supported for this target"
5252#endif
5353
You can’t perform that action at this time.
0 commit comments