Skip to content

Commit d4fa585

Browse files
committed
STM32: F1 GPIO: Enable AFIO clock
It is required to enable AFIO clock before using __HAL_AFIO_REMAP_xy macros, which was missing here. Without clocks enable, the remap actually doesn't occur. This would possibly cause some PIOs (part of PB_3, PB_4, PA_13, PA_14, PA_15) to not behave as expected. In most cases AFIO clock was enabled in stm_pin_SetAFPin function, so that this bug was not visible. But there were few cases left were stm_pin_DisconnectDebug would be called first. A typical case was with GCC_ARM in case a DigitalInOut variable is declared as global.
1 parent 7653f65 commit d4fa585

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

targets/TARGET_STM/TARGET_STM32F1/pin_device.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ extern const uint32_t ll_pin_defines[16];
3737

3838
static inline void stm_pin_DisconnectDebug(PinName pin)
3939
{
40+
// Enable AFIO clock
41+
__HAL_RCC_AFIO_CLK_ENABLE();
42+
4043
// Disconnect JTAG-DP + SW-DP signals.
4144
// Warning: Need to reconnect under reset
4245
if ((pin == PA_13) || (pin == PA_14)) {

0 commit comments

Comments
 (0)