关于CH32X035F8U6 uart4的问题

CH32X035F8U6 4个uart口吧,uart4的PB0和PB1脚可以使用吧。

   /* USART4 TX-->B.0  RX-->B.1 */

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;  //PB0 TX

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

GPIO_Init(GPIOB, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;  //PB1 TX

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

GPIO_Init(GPIOB, &GPIO_InitStructure);


USART_InitStructure.USART_BaudRate = 115200;

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_InitStructure.USART_StopBits = USART_StopBits_1;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;


USART_Init(USART4, &USART_InitStructure);

USART_Cmd(USART4, ENABLE);

这样初始化正确吧

您好,CH32X035F8U6只有3个串口,没有串口4,参考下图。具体可看CH32X035数据手册,手册下载链接如下:

https://www.wch.cn/downloads/CH32X035DS0_PDF.html 

image.png


只有登录才能回复,可以选择微信账号登录