1)Different encoding mechanisms can not be mixed, such as RS-232-C can not be directly connected with RS-422 interface, RS-485 interface. There are special kinds of protocol converters on the market, they must be connected through the converter.
2)Check if the welding of the serial line is firm. Otherwise the program is ok, but the wiring problem still exist.
3) Check the male and female heads of the serial port, and then select the serial data cable.
4)If above inspection preparation work is no problem, debugging still has problems, you must check the DTE (data terminal equipment) serial port wiring to implement the standard serial port wiring method. I came across the DTE, which is clearly a public port, but the wiring is based on the problem of the connection of the female port, which wasted several days.
5)When debugging the serial port, prepare a useful debugging tool, such as Serial Port Utility (friendly serial debugging assistant), serial port wizard, etc.

FT232RL USB 2.0 To DB9 RS232 Serial Cable






