diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/board.c b/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/board.c index afc4802dc..4d7f3875d 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/board.c +++ b/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/board.c @@ -62,7 +62,6 @@ extern RxBuffer2; extern uint16_t UART_ReceiveData(USART_TypeDef* USARTx); void InitBoardHardware() { - _SysTick_Config(SystemCoreClock / TICK_PER_SECOND); /* initialize memory system */ InitBoardMemory(MEMORY_START_ADDRESS, (void*)MEMORY_END_ADDRESS); @@ -70,17 +69,19 @@ void InitBoardHardware() #ifdef BSP_USING_UART4 InstallConsole("uart4", "uart4_drv", "uart4_dev4"); #endif - // #ifdef BSP_USING_UART2 - // InstallConsole("uart2", "uart2_drv", "uart2_dev2"); - // #endif #ifdef BSP_USING_ETH InitHwEth(); #endif - KPrintf("consle init completed.\n"); KPrintf("board initialization......\n"); KPrintf("board init done.\n"); KPrintf("start okernel...\n"); + // while (1) { + // uint32_t ans = (uint32_t)UART_ReceiveData(USART3); + // KPrintf("%d\n", ans); + // for (int i = 0; i < 10000; i++) + // ; + // } } diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/third_party_driver/uart/connect_uart.c b/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/third_party_driver/uart/connect_uart.c index 24424f447..e2db436f2 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/third_party_driver/uart/connect_uart.c +++ b/Ubiquitous/XiZi_IIoT/board/ch32v307vct6/third_party_driver/uart/connect_uart.c @@ -167,7 +167,7 @@ static int SerialGetChar(struct SerialHardwareDevice* serial_dev) } static const struct SerialDataCfg data_cfg_init = { - .serial_baud_rate = 1500000, + .serial_baud_rate = BAUD_RATE_9600, .serial_data_bits = DATA_BITS_8, .serial_stop_bits = STOP_BITS_1, .serial_parity_mode = PARITY_NONE, @@ -259,7 +259,7 @@ void USART1_IRQHandler(void) uint16_t UART_ReceiveData(USART_TypeDef* USARTx) { - return (uint16_t)(USARTx->DATAR & (uint16_t)0x01FF); + return (uint16_t)(USARTx->DATAR); } #ifdef BSP_USING_UART2 @@ -365,7 +365,7 @@ int InitHwUart(void) GPIO_Init(GPIOA, &gpio_init_struct); USART_InitTypeDef usart_init_struct; - usart_init_struct.USART_BaudRate = 1500000; + usart_init_struct.USART_BaudRate = 9600; usart_init_struct.USART_HardwareFlowControl = USART_HardwareFlowControl_None; usart_init_struct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; usart_init_struct.USART_WordLength = USART_WordLength_8b; @@ -429,7 +429,7 @@ int InitHwUart(void) GPIO_Init(GPIOB, &gpio_init_struct_2); USART_InitTypeDef usart_init_struct_2; - usart_init_struct_2.USART_BaudRate = 1500000; + usart_init_struct_2.USART_BaudRate = 9600; usart_init_struct_2.USART_HardwareFlowControl = USART_HardwareFlowControl_None; usart_init_struct_2.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; usart_init_struct_2.USART_WordLength = USART_WordLength_8b; @@ -493,7 +493,7 @@ int InitHwUart(void) GPIO_Init(GPIOC, &gpio_init_struct_4); USART_InitTypeDef usart_init_struct_4; - usart_init_struct_4.USART_BaudRate = 1500000; + usart_init_struct_4.USART_BaudRate = 9600; usart_init_struct_4.USART_HardwareFlowControl = USART_HardwareFlowControl_None; usart_init_struct_4.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; usart_init_struct_4.USART_WordLength = USART_WordLength_8b;