Skip to content

Commit ee0dd1f

Browse files
committed
STM32H7: define RCC_LSE_BYPASS to allow using PC_15 as gpio
1 parent 341fb1a commit ee0dd1f

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
@@ -2451,6 +2451,10 @@
24512451
"usb_speed": {
24522452
"help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS",
24532453
"value": "USE_USB_OTG_HS"
2454+
},
2455+
"lse_bypass": {
2456+
"help": "1 to use an oscillator (not a crystal) on 32k LSE",
2457+
"value": "1"
24542458
}
24552459
},
24562460
"macros_add": [

0 commit comments

Comments
 (0)