用stm32好多年,现在才知道TX,RX脚可以软件交换,罪过罪过

2019-12-12 18:19发布

最近有个PCB打板回来调程序一直没调通,最后发现 RX,TX 连线反了,正打算割铜皮时,一同事说RX,TX脚可以软件交换,查了资料,改了程序,果真可以,
以后电工再也不用担心 RX,TX接反了,爽!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
99条回答
our2008
2019-12-17 12:52
本帖最后由 our2008 于 2016-4-29 18:05 编辑

STM32F030    USARTx_CR2寄存器的15位:
Bit 15 SWAP: Swap TX/RX pins
This bit is set and cleared by software.
0: TX/RX pins are used as defined in standard pinout
1: The TX and RX pins functions are swapped. This allows to work in the case of a cross-wired
connection to another UART.
This bit field can only be written when the USART is disabled (UE=0).


STM32F103  USARTx_CR2寄存器的15位没有定义,不过按照ARM的特点,可以设置下15位试试,说不定有惊喜呢?

一周热门 更多>