需要的。TX与RX是复用功能的输出与输入。stm8s参考手册(RM0016)中要求复用功能的输入是 floating或者pull-up(For Alternate Function input you should select floating or pull-up input configuration in the DDR and CR1 registers);复用功能输出就强制把DDR设为1了。(Alternate function outputs provide a direct path from a peripheral to an output or to an I/O pad taking precedence over the port bit in the data output latch register (Px_ODR) and forcing the Px_DDR corresponding bit to 1.) 上个类似的帖子,欢迎交流: