6# 香水城
有试过,但是没效果。再向香主请教个问题。
/* Configure USART Tx as alternate function push-pull */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Pin = COM_TX_PIN[COM];
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(COM_TX_PORT[COM], &GPIO_InitStructure);
/* Configure USART Rx as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Pin = COM_RX_PIN[COM];
GPIO_Init(COM_RX_PORT[COM], &GPIO_InitStructure);
/* USART configuration */
USART_Init(COM_USART[COM], USART_InitStruct);
/* Enable USART */
USART_Cmd(COM_USART[COM], ENABLE);
1.这个是在stm32f10e_eval.c对USART1_TX/USART1_RX引脚的配置,我的问题是USB虚拟串口数据是从DP、DM数据线上传来的,为什么还要配置TX/RX引脚?
2.还有从USB读写数据USART_To_USB_Send_Data();USART_ReceiveData(USART1)的函数也是对USARTx->DR寄存器读写,而USB总线上的数据是有个Analog Transceiver接收发送。这样的话从USARTx->DR读写的数据与USB总线的数据不是不一样了吗?
|