From 30af14ff8f5fbe470a913d74a42c0eab4b79fd28 Mon Sep 17 00:00:00 2001 From: Carsten Thiele <software@carsten-thiele.de> Date: Tue, 21 Mar 2023 18:54:19 +0100 Subject: [PATCH] Prevent overwrite of HSITRIM default-value --- ch32v003fun/ch32v003fun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch32v003fun/ch32v003fun.c b/ch32v003fun/ch32v003fun.c index 66c96cc..90ecd03 100644 --- a/ch32v003fun/ch32v003fun.c +++ b/ch32v003fun/ch32v003fun.c @@ -807,8 +807,8 @@ asm volatile( void SystemInit48HSI( void ) { // Values lifted from the EVT. There is little to no documentation on what this does. - RCC->CTLR = RCC_HSION | RCC_PLLON; // Use HSI, but enable PLL. RCC->CFGR0 = RCC_HPRE_DIV1 | RCC_PLLSRC_HSI_Mul2; // PLLCLK = HSI * 2 = 48 MHz; HCLK = SYSCLK = APB1 + RCC->CTLR |= RCC_HSION | RCC_PLLON; // Use HSI, but enable PLL. FLASH->ACTLR = FLASH_ACTLR_LATENCY_1; // 1 Cycle Latency RCC->INTR = 0x009F0000; // Clear PLL, CSSC, HSE, HSI and LSI ready flags. -- GitLab