调了几天USART都不行,PC上接不到数据,检查硬件时才发现原理图上是 ST3232,但万利焊的是 MAX202,虽说管脚兼容,但是MAX202要+5V.,3.3V只能是3232.
记得波仔也遇到这个问题,他以为MAX202坏了,其实不环,也不行的 需要重焊3232,或者把RXD TXD引出再接电平转换了
注意,已修改好了,问题解决了,大家注意
------不好意思,是我之前没仔细看,然来DEMO是有硬件握手信号,我把DEMO(USART的Example1)改了改:
USART_InitStructure.USART_BaudRate = 9600;
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_Rx | USART_Mode_Tx;
USART_InitStructure.USART_Clock = USART_Clock_Disable;
USART_InitStructure.USART_CPOL = USART_CPOL_Low;
USART_InitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_InitStructure.USART_LastBit = USART_LastBit_Disable;
上述的 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;原本是
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_RTS_CTS;就是说要与PC的串口通过RTS,CTS握手,但是万利的班子上
RTS,CTS没有通过MAX202连接到PC,所以不行,第一句的波特率改成9600,以前的115200太快.
现在通讯正常
|