stm32g0: 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 <voinea.dragos.alexandru@gmail.com>
This commit is contained in:
Alex Voinea authored and KevinOConnor committed 2022-12-11 20:09:50 -05:00
1 parent 0972561783
commit c7f323e863
1 file changed
+5 -2
+5 -2
View File
@@ -183,8 +183,11 @@ armcm_main(void)
check_usb_dfu_bootloader();
// Set flash latency
FLASH->ACR = (2<<FLASH_ACR_LATENCY_Pos) | FLASH_ACR_ICEN | FLASH_ACR_PRFTEN;
// Set flash latency, cache and prefetch; use reset value as base
uint32_t acr = 0x00040600;
acr = (acr & ~FLASH_ACR_LATENCY) | (2<<FLASH_ACR_LATENCY_Pos);
acr |= FLASH_ACR_ICEN | FLASH_ACR_PRFTEN;
FLASH->ACR = acr;
// Configure main clock
clock_setup();