Skip to content

Commit eff0d4c

Browse files
authored
Merge pull request #14032 from jeromecoutant/PR_RESET_GPIO
STM32: RESET GPIO during init is configurable
2 parents aef93ca + d689e90 commit eff0d4c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

targets/TARGET_STM/mbed_overrides.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ MBED_WEAK void TargetBSP_Init(void) {
9494
/** Do nothing */
9595
}
9696

97+
#if MBED_CONF_TARGET_GPIO_RESET_AT_INIT
9798
void GPIO_Full_Init(void) {
9899
GPIO_InitTypeDef GPIO_InitStruct;
99100

@@ -160,6 +161,7 @@ void GPIO_Full_Init(void) {
160161
__HAL_RCC_GPIOK_CLK_DISABLE();
161162
#endif
162163
}
164+
#endif
163165

164166
// This function is called after RAM initialization and before main.
165167
void mbed_sdk_init()
@@ -311,8 +313,10 @@ void mbed_sdk_init()
311313
#endif /* ! MBED_CONF_TARGET_LSE_AVAILABLE */
312314
#endif /* DEVICE_RTC */
313315

316+
#if MBED_CONF_TARGET_GPIO_RESET_AT_INIT
314317
/* Reset all GPIO */
315318
GPIO_Full_Init();
319+
#endif
316320

317321
/* BSP initialization hook (external RAM, etc) */
318322
TargetBSP_Init();

targets/targets.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,10 @@
11571157
"lpticker_lptim_clock": {
11581158
"help": "Default value for LPTIM clock (lpticker_lptim == 1). Value is the dividing factor. Choose 1, 2 or 4",
11591159
"value": 1
1160+
},
1161+
"gpio_reset_at_init": {
1162+
"help": "if value set, all GPIO are reset during init",
1163+
"value": false
11601164
}
11611165
},
11621166
"overrides": {
@@ -3285,6 +3289,9 @@
32853289
"macro_name": "CLOCK_SOURCE"
32863290
}
32873291
},
3292+
"overrides": {
3293+
"gpio_reset_at_init": true
3294+
},
32883295
"device_has_add": [
32893296
"ANALOGOUT",
32903297
"SERIAL_ASYNCH",

0 commit comments

Comments
 (0)