mirror of https://github.com/ArduPilot/ardupilot
AP_BoardConfig: disable STLink debug pins by default
this avoids leaving the debug pins in a state where they may be vulnerable to ESD issues
This commit is contained in:
parent
fe760a51a3
commit
4ee292ec5e
|
@ -269,7 +269,7 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = {
|
|||
// @Param: OPTIONS
|
||||
// @DisplayName: Board options
|
||||
// @Description: Board specific option flags
|
||||
// @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters
|
||||
// @Bitmask: 0:Enable hardware watchdog, 1:Disable MAVftp, 2:Enable set of internal parameters, 3:Enable Debug Pins
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("OPTIONS", 19, AP_BoardConfig, _options, HAL_BRD_OPTIONS_DEFAULT),
|
||||
|
||||
|
@ -362,6 +362,7 @@ void AP_BoardConfig::set_default_safety_ignore_mask(uint16_t mask)
|
|||
void AP_BoardConfig::init_safety()
|
||||
{
|
||||
board_init_safety();
|
||||
board_init_debug();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -176,6 +176,7 @@ public:
|
|||
BOARD_OPTION_WATCHDOG = (1 << 0),
|
||||
DISABLE_FTP = (1<<1),
|
||||
ALLOW_SET_INTERNAL_PARM = (1<<2),
|
||||
BOARD_OPTION_DEBUG_ENABLE = (1<<3),
|
||||
};
|
||||
|
||||
// return true if ftp is disabled
|
||||
|
@ -237,6 +238,7 @@ private:
|
|||
#endif // AP_FEATURE_BOARD_DETECT
|
||||
|
||||
void board_init_safety(void);
|
||||
void board_init_debug(void);
|
||||
|
||||
void board_setup_uart(void);
|
||||
void board_setup_sbus(void);
|
||||
|
|
|
@ -46,6 +46,24 @@ void AP_BoardConfig::board_init_safety()
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
init debug pins. We set debug pins as input if BRD_OPTIONS bit for debug enable is not set
|
||||
this prevents possible ESD issues on the debug pins
|
||||
*/
|
||||
void AP_BoardConfig::board_init_debug()
|
||||
{
|
||||
#ifndef HAL_BUILD_AP_PERIPH
|
||||
if ((_options & BOARD_OPTION_DEBUG_ENABLE) == 0) {
|
||||
#ifdef HAL_GPIO_PIN_JTCK_SWCLK
|
||||
palSetLineMode(HAL_GPIO_PIN_JTCK_SWCLK, PAL_MODE_INPUT);
|
||||
#endif
|
||||
#ifdef HAL_GPIO_PIN_JTMS_SWDIO
|
||||
palSetLineMode(HAL_GPIO_PIN_JTMS_SWDIO, PAL_MODE_INPUT);
|
||||
#endif
|
||||
}
|
||||
#endif // HAL_BUILD_AP_PERIPH
|
||||
}
|
||||
|
||||
|
||||
#if AP_FEATURE_BOARD_DETECT
|
||||
|
||||
|
|
Loading…
Reference in New Issue