summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-06-14 16:55:46 +0700
committerhathach <[email protected]>2024-06-14 16:55:46 +0700
commite1012997f06c5d857de995870cd989be22187ffb (patch)
tree2d5160e94117ce8c313c91e41ad0a70c42b9f1f0
parentf32851cf2ae6ec7aa3b39150c3f0f96d65af9b3a (diff)
more update
-rw-r--r--hw/bsp/ch32v10x/family.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/bsp/ch32v10x/family.c b/hw/bsp/ch32v10x/family.c
index 6de17521e..c41b207e0 100644
--- a/hw/bsp/ch32v10x/family.c
+++ b/hw/bsp/ch32v10x/family.c
@@ -68,6 +68,9 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#endif
+ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
+
+ EXTEN->EXTEN_CTR |= EXTEN_USBFS_IO_EN;
uint8_t usb_div;
switch (SystemCoreClock) {
case 48000000: usb_div = RCC_USBCLKSource_PLLCLK_Div1; break;
@@ -75,9 +78,7 @@ void board_init(void) {
default: TU_ASSERT(0,); break;
}
RCC_USBCLKConfig(usb_div);
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
-
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
+ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_USBFS, ENABLE);
#ifdef LED_PIN
GPIO_InitTypeDef led_init = {