rcu_periph_clock_enable(uartx->rcu_uart_x); /* USART configure */ usart_deinit(uartx->uart_x); driver_gpio_general_init(uartx->uart_rx_gpio); driver_gpio_general_init(uartx->uart_tx_gpio); if(uartx->uart_mode_rx==MODE_DMA) { if(uartx->uart_rx_dma!=NULL) { driver_dma_co...
#endif /* configure USART Tx as alternate function push-pull */ gpio_mode_set(GPIOA, GPIO_MODE_AF, GPIO_PUPD_PULLUP, GPIO_PIN_9); gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_9); /* configure USART Rx as alternate function push-pull */ gpio_mode_...
GD32芯片具有多个USART外设用于串口通讯,它是 Universal Synchronous Asynchronous Receiver and Transmitter的缩写,即通用同步异步收发器可以灵活地与外部设备进行全双工数据 交换。有别于USART,它还有具有UART外设(Universal Asynchronous Receiver and Transmitter),它是在USART基础上裁剪掉了同步通信功能,只有异步通信。简单区...
/* USART configure */ usart_deinit(uartx->uart_x); driver_gpio_general_init(uartx->uart_rx_gpio); driver_gpio_general_init(uartx->uart_tx_gpio); if(uartx->uart_mode_rx==MODE_DMA) { if(uartx->uart_rx_dma!=NULL) { driver_dma_com_init(uartx->uart_rx_dma,(uint32_t)&USART...
USART_SyncMasterConfig(USART1,USART_Clock_Idle_Low,USART_Clock_Phase_1Edge,Baudrate);/*USARTInitconfigureSPIMode0*/ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,ENABLE); GPIO_PinAFConfig(GPIOA,GPIO_PinSource11,GPIO_AF_5);/*PA11AFUSART_TXfor...
/* Configure USART1 */ USART_Init(USART1, &USART_InitStructure); /* Enable USART1 receive*/ USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); /* Enable the USART1 */ USART_Cmd(USART1, ENABLE); } 分析问题: 1.为什么没有通讯了?
uint16_t tx_wr; uint8_t *rx_buf; uint16_t rx_buf_size; uint16_t rx_rd; uint16_t rx_wr; void (*config)(void); void (*deconfig)(void); } usart_context_t; void usart_config_init(usart_context_t *pusart_context, uint32_t baud_rate); ...
/* USART configure */ usart_deinit(uartx->uart_x); driver_gpio_general_init(uartx->uart_rx_gpio); driver_gpio_general_init(uartx->uart_tx_gpio); if(uartx->uart_mode_rx==MODE_DMA) { if(uartx->uart_rx_dma!=NULL) { driver_dma_com_init(uartx->uart_rx_dma,(uint32_t)&USART...
/* Configure USART Rx as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_Init(GPIOA, &GPIO_InitStructure); } // void USART1_Configuration(void) { USART_InitTypeDef USART_InitStructure; /* USART resources configuration (Clock, GPIO pins and USART registers) -...