From 8ab2e4f782c151afabc851a29c208cc75f68d8b6 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Mon, 2 Dec 2019 21:41:31 +1100 Subject: [PATCH] Enable SWD --- inc/stm32f10x_regs.h | 3 ++- src/stm32f10x.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/stm32f10x_regs.h b/inc/stm32f10x_regs.h index 80ffb40..c5c0206 100644 --- a/inc/stm32f10x_regs.h +++ b/inc/stm32f10x_regs.h @@ -321,7 +321,8 @@ struct afio { uint32_t mapr2; /* 1C: AF remap and debug I/O configuration #2 */ }; -#define AFIO_MAPR_SWJ_CFG_DISABLED (4u<<24) +#define AFIO_MAPR_SWJ_CFG_DISABLED (4u<<24) /* JTAG-DP Disabled and SW-DP Disabled */ +#define AFIO_MAPR_SWJ_CFG_JTAGDISABLE (2u<<24) /* JTAG-DP Disabled and SW-DP Enabled */ #define AFIO_MAPR_TIM4_REMAP_FULL (1u<<12) #define AFIO_MAPR_TIM3_REMAP_FULL (3u<<10) #define AFIO_MAPR_TIM3_REMAP_PARTIAL (2u<<10) diff --git a/src/stm32f10x.c b/src/stm32f10x.c index e83cd75..5159ca3 100644 --- a/src/stm32f10x.c +++ b/src/stm32f10x.c @@ -136,7 +136,7 @@ static void peripheral_init(void) rcc->ahbenr = RCC_AHBENR_DMA1EN; /* Turn off serial-wire JTAG and reclaim the GPIOs. */ - afio->mapr = AFIO_MAPR_SWJ_CFG_DISABLED; + afio->mapr = AFIO_MAPR_SWJ_CFG_JTAGDISABLE; /* All pins in a stable state. */ gpio_init(gpioa);