diff --git a/ch32v203fun/ch32v203fun.c b/ch32v203fun/ch32v203fun.c index fb4e9ca081bf72ddf78ac2350f152c45458e464b..e95da26260cb1f1dfc1230da49b186d494af8282 100644 --- a/ch32v203fun/ch32v203fun.c +++ b/ch32v203fun/ch32v203fun.c @@ -905,14 +905,13 @@ void handle_reset( void ) " mret\n" : : [main]"r"(main) ); } -void SystemInit48HSI( void ) +void SystemInit144HSI( void ) { EXTEN->EXTEN_CTR |= EXTEN_PLL_HSI_PRE; RCC->CFGR0 = RCC_HPRE_DIV1 | RCC_PPRE2_DIV1 | RCC_PPRE1_DIV2; RCC->CFGR0 &= (uint32_t)((uint32_t)~(RCC_PLLSRC | RCC_PLLXTPRE | RCC_PLLMULL)); - RCC->CFGR0 |= (uint32_t)(RCC_PLLSRC_HSI_Div2 | RCC_PLLMULL6); - RCC->INTR = 0x009F0000; + RCC->CFGR0 |= (uint32_t)(RCC_PLLSRC_HSI_Div2 | RCC_PLLMULL18); /* Enable PLL */ RCC->CTLR |= RCC_PLLON; diff --git a/ch32v203fun/ch32v203fun.h b/ch32v203fun/ch32v203fun.h index eea1d523c9fd3f847e4614f09f663c0500ede77a..17fbddb2baa67677f567f583e33ffb514084c39a 100644 --- a/ch32v203fun/ch32v203fun.h +++ b/ch32v203fun/ch32v203fun.h @@ -7368,7 +7368,7 @@ int main() __attribute__((used)); void SystemInit(void) __attribute__((used)); // Initialization functions -void SystemInit48HSI( void ); +void SystemInit144HSI( void ); // TODO: Debug and UART diff --git a/examples_v203/blink/blink.c b/examples_v203/blink/blink.c index 0610d47fbd5d014a4479a35e25df839b3e32a376..1b9bf7485da7686c5214975a0366b88f004a16fb 100644 --- a/examples_v203/blink/blink.c +++ b/examples_v203/blink/blink.c @@ -1,12 +1,12 @@ // Could be defined here, or in the processor defines. -#define SYSTEM_CORE_CLOCK 48000000 +#define SYSTEM_CORE_CLOCK 144000000 #include "ch32v203fun.h" #include <stdio.h> int main() { - SystemInit48HSI(); + SystemInit144HSI(); // Enable GPIOs //RCC->APB2PCENR |= RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOC; @@ -19,8 +19,8 @@ int main() while(1) { GPIOA->BSHR = (1<<15); // Turn on GPIO - Delay_Ms( 250 ); + Delay_Ms( 1000 ); GPIOA->BSHR = (1<<(16+15)); // Turn off GPIO - Delay_Ms( 250 ); + Delay_Ms( 1000 ); } }