From 09725617831bf4a1379e90edf47ab11434279f88 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Sat, 3 Dec 2022 15:17:32 +0100 Subject: [PATCH] stm32g4: Do not disable SWD by accident Keep SWEN as 1 in FLASH->ACR register such that the SWD interface doesn't get disabled. Signed-off-by: Alex Voinea --- src/stm32/stm32g4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stm32/stm32g4.c b/src/stm32/stm32g4.c index d75bcbe1..bd4c6ee0 100644 --- a/src/stm32/stm32g4.c +++ b/src/stm32/stm32g4.c @@ -130,7 +130,7 @@ clock_setup(void) ((CONFIG_CLOCK_FREQ>30000000) ? FLASH_ACR_LATENCY_1WS : FLASH_ACR_LATENCY_0WS))))); FLASH->ACR = (latency | FLASH_ACR_ICEN | FLASH_ACR_DCEN - | FLASH_ACR_PRFTEN); + | FLASH_ACR_PRFTEN | FLASH_ACR_DBG_SWEN); enable_pclock(PWR_BASE); PWR->CR3 |= PWR_CR3_APC; // allow gpio pullup/down