Python and STM32 serial communication

        Recently, due to the serial communication between STM32 and upper computer Python, the communication cannot be completed. I don’t know the reason. The serial port debugging software of STM32 and upper computer can successfully complete the data transmission, but I don’t know why it can’t be completed with Python. Communication, there are not many things about this aspect on the Internet, and I have not found a suitable serial port debugging method. Today, I accidentally learned that the host computer Python can communicate with the serial port debugging software on the host computer through the virtual serial port.

        First of all, check the installation method of the virtual serial port on the Internet (check it out)

        As shown in the figure below, it is a pair of virtual serial ports I installed.

        At the Python program, the code is as follows.

Under the serial port debugging tool, as shown below.

As shown below, it is the joint debugging interface.

        STM32 and the serial port are successfully debugged, and Python is also successfully debugged through the virtual serial port. However, the serial port between STM32 and Python is always difficult to communicate, which is really confusing.

Guess you like

Origin blog.csdn.net/m0_53573725/article/details/132609697