diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-08-05 11:33:21 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-08-05 11:39:42 -0400 |
commit | 3d0f7188df100ca7e0500740053d5b9fb4466075 (patch) | |
tree | 2fccf61ddca90cc3fc9f89c8f2665f9a480a1104 /src/stm32 | |
parent | 664c869f7749da96bbea7307beb043dfe52593c5 (diff) | |
download | kutter-3d0f7188df100ca7e0500740053d5b9fb4466075.tar.gz kutter-3d0f7188df100ca7e0500740053d5b9fb4466075.tar.xz kutter-3d0f7188df100ca7e0500740053d5b9fb4466075.zip |
stm32: Automatically disable SWD if PA13/PA14 is used on stm32f103
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32')
-rw-r--r-- | src/stm32/stm32f1.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c index 3064d4c8..d4a5c853 100644 --- a/src/stm32/stm32f1.c +++ b/src/stm32/stm32f1.c @@ -85,6 +85,10 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup) regs->BSRR = 1 << pos; else if (pullup < 0) regs->BSRR = 1 << (pos + 16); + + if (gpio == GPIO('A', 13) || gpio == GPIO('A', 14)) + // Disable SWD to free PA13, PA14 + AFIO->MAPR = AFIO_MAPR_SWJ_CFG_DISABLE; } // Main clock setup called at chip startup |