Hello everyone, I am a ruffian balance, is a serious technical ruffian. Today ruffian balance to introduce you is the serial debugging tool PZH – PY -com birth of joint debugging.

Software development is inseparable from debugging. There are two debugging methods: one is black-box debugging, which directly tests whether software functions are normal from the perspective of input/output. In this way, problems can only be found, but the cause of the problem cannot be directly located. Python is a scripting language, but with the help of some Python IDES, you can also achieve single-step debugging. Through single-step debugging, you can find the root cause of the problem. We have in front of the preliminary realized PZH – py – com, the rascal scale will respectively from the perspective of black and white box testing PZH – py – com function:

First, black box debugging: VSPD + SSCOM

To test pzh-py-com, you need to use a physical serial port device, such as the following classic CH34x serial port to USB module, CH34x official homepage www.wch.cn/products/ca… .

After installing the CH34x module driver and connecting the USB port of the module to the PC, you can view the serial port device in the Ports of the device manager. A physical module can complete the test. You only need to connect the RXD and TXD cables of the module directly to realize the loopback test. Most of the time have no physical serial port devices, so this time we need to use virtual serial port software, VSPD is a virtual serial port driver, its official home page for www.eltima.com/products/vs… , VSPD can be used on the PC virtual out of the serial device and virtual connection, because VSPD does not support a single device loopback connection, so we need to virtual out two serial devices and realize the connection, ruffin balance using VSPD virtual COM10 and COM11, and the connection:

Ruffian balance uses VSPD virtual serial port to test, and the final black box test environment is as follows:

Combined with SSCOM test serial port data sending and receiving, it can be seen that the basic serial port data sending and receiving function of PZH-py-COM is normal, and the most basic black box test has passed.

White box debugging: PyCharm

If there is a problem with the pzh-py-com function during the black box test, and the problem cannot be immediately inferred from the point of view of the code logic, the Python IDE should be used for online debugging. After creating the pzh-py-com project, put it in the pzh-py-com home directory. The project will automatically add all source files in the directory. Select the main.py file and select Debug (Shift+F9) to perform single-step debugging.

PyCharm debugging tips can be referenced in the following two articles:

Confluence.jetbrains.com/display/PYH… www.jetbrains.com/help/pychar…

At this point, serial debugging tool pzh-py-com birth of the joint debugging ruffian balance will be introduced to the end, applause where ~~~

Welcome to subscribe to

The article will be published on my blog park homepage, CSDN homepage and wechat public account platform at the same time.

Wechat search “ruffian balance embedded” or scan the following two-dimensional code, you can see the first time on the phone oh.