Skip to content

Commit 1b76d1b

Browse files
committed
STM32H7: define RCC_LSE_BYPASS to allow using PC_15 as gpio
1 parent 3de5065 commit 1b76d1b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

targets/TARGET_STM/lp_ticker.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ void lp_ticker_init(void)
170170

171171
/* Enable LSE clock */
172172
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
173+
#if MBED_CONF_TARGET_LSE_BYPASS
174+
RCC_OscInitStruct.LSEState = RCC_LSE_BYPASS;
175+
#else
173176
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
177+
#endif
174178
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
175179

176180
/* Select the LSE clock as LPTIM peripheral clock */

targets/TARGET_STM/rtc_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ void rtc_init(void)
6565
#if MBED_CONF_TARGET_LSE_AVAILABLE
6666
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
6767
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
68+
#if MBED_CONF_TARGET_LSE_BYPASS
69+
RCC_OscInitStruct.LSEState = RCC_LSE_BYPASS;
70+
#else
6871
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
72+
#endif
6973

7074
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
7175
error("Cannot initialize RTC with LSE\n");

targets/targets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,10 @@
27092709
"usb_speed": {
27102710
"help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS",
27112711
"value": "USE_USB_OTG_HS"
2712+
},
2713+
"lse_bypass": {
2714+
"help": "1 to use an oscillator (not a crystal) on 32k LSE",
2715+
"value": "1"
27122716
}
27132717
},
27142718
"macros_add": [

0 commit comments

Comments
 (0)