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 2022-12-09 19:09:23 +01:00 committed by KevinOConnor
parent 0972561783
commit c7f323e863
1 changed files with 5 additions and 2 deletions

View File

@ -183,8 +183,11 @@ armcm_main(void)
check_usb_dfu_bootloader(); check_usb_dfu_bootloader();
// Set flash latency // Set flash latency, cache and prefetch; use reset value as base
FLASH->ACR = (2<<FLASH_ACR_LATENCY_Pos) | FLASH_ACR_ICEN | FLASH_ACR_PRFTEN; 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 // Configure main clock
clock_setup(); clock_setup();