Skip to content

Commit

Permalink
Enable SWD
Browse files Browse the repository at this point in the history
  • Loading branch information
penfold42 committed Dec 3, 2019
1 parent 27bb535 commit 8ab2e4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion inc/stm32f10x_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/stm32f10x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8ab2e4f

Please sign in to comment.