Function test fixture for automatic switching detection of serial port modes

By designing a serial port mode test fixture with automatic switching and detection, the inefficiency and error risks of manually configuring jumpers to switch COM port mode are solved, and efficient automatic switching and detection of serial port mode is achieved, improving testing efficiency and accuracy.

CN119166443APending Publication Date: 2024-12-20ADVANTECH CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411136858.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

In industrial machines, testers need to manually replace and configure jumpers to switch the communication mode of the COM port, resulting in inefficient testing and risk of misconfiguration, especially in RS485 mode with only one COM port, which requires another RS485 It is especially inconvenient for the device to transmit data.

Method used

A functional test fixture for automatic switching detection of serial port mode is designed, including input command unit, MCU main control unit, COM switching driver unit and data transmission interface unit. The COM switching driver unit is controlled to switch to RS-232 through the MCU main control unit. , RS-422 or RS-485 test modules realize automatic detection and mode switching, and promptly feedback results during mode switching and data interaction through the determination module.

Benefits of technology

This test fixture greatly improves the testing efficiency and reduces the possibility of omissions and negligence. By automatically switching and detecting the functions of different COM modes, it ensures that the functions in each mode are fully detected, and displays the products to be tested through intuitive output test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166443A_ABST
    Figure CN119166443A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of serial / parallel port testing, in particular to a function testing jig for automatic switching detection of serial port modes. The system comprises an input instruction unit, a power supply unit, an MCU main control unit, a COM switching driving unit, a data transmission interface unit and an output unit, the MCU main control unit comprises an MCU and a determination module, the COM switching driving unit comprises an RS-232 test module, an RS-422 test module and an RS-485 test module, the MCU is connected with the determination module, and the determination module is connected with the COM switching driving unit. According to the tool, the instruction is sent to the MCU, the MCU is made to control the COM switching driving unit to be switched to the designated test module, the function of the product to be tested under the test module is detected through the corresponding instruction, full-automatic detection of the COM port of the product to be tested is achieved, and the test efficiency of the tool is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of serial / parallel port testing, in particular to a functional testing fixture for automatic serial port mode switching detection. Background Art

[0002] The COM port is a serial communication interface on a computer. It is mainly used to realize data transmission between the computer and other peripherals, such as printers, barcode scanners, digital cameras, modems, etc. The basic form of the COM interface is the DB9 type interface, which is a D-shaped 9-pin interface that contains signal lines such as RXD (receive data signal), TXD (send data signal), GND (ground wire), etc. These signal lines are connected to external devices through the DB9 connector to realize data transmission. There are three different serial communication standards: RS-232, RS-422, and RS-485. As a serial communication interface of the computer, the COM interface, together with RS-232, RS-422, RS-485 and other standards, constitutes the basis for communication between computers and external devices. These standards have their own characteristics in terms of interface definition, transmission mode, transmission distance, etc., and are suitable for different application scenarios. In practical applications, the appropriate interface standard can be selected according to specific needs to achieve efficient and stable data transmission.

[0003] In industrial machines, COM ports (serial ports) usually support multiple communication protocols, including RS-232, RS-422, and RS-485. Although there are automatic detection methods for these modes, testers are still required to replace the corresponding fixtures or connecting cables according to the actual test mode. At the same time, for the RS485 mode with only one COM port on the machine, it is necessary to match it with another machine with RS485 for data transmission, which causes trouble and inconvenience to the testers. The mode switching of the COM port is performed by jumpers, and personnel need to manually place the jumpers on the corresponding pins to configure different communication modes. When configuring the jumper, you need to ensure that the jumper is correctly placed in the corresponding slot and does not touch other unnecessary pins. If the jumper is configured incorrectly, it may cause serial port communication failure or even damage the equipment. Therefore, we propose a functional test fixture for automatic switching detection of serial port modes. Summary of the invention

[0004] The purpose of the present invention is to provide a functional test fixture for automatic serial port mode switching detection to solve the problems raised in the above background technology.

[0005] To achieve the above object, the present invention provides a functional test fixture for automatic switching detection of serial port modes, comprising an input instruction unit, a power supply unit, an MCU main control unit, a COM switching drive unit, a data transmission interface unit and an output unit, wherein the MCU main control unit comprises an MCU and a determination module, the COM switching drive unit comprises an RS-232 test module, an RS-422 test module and an RS-485 test module, the MCU is connected to the determination module, and the determination module is connected to the COM switching drive unit;

[0006] The input interface of the input instruction unit inputs the corresponding instruction to the MCU, and the MCU sends the corresponding control signal according to the corresponding instruction, which reaches the COM switching drive unit through the judgment module, detects or switches the RS-232 test module, RS-422 test module and RS-485 test module, and feeds the result back to the MCU through the judgment module, and the MCU displays the result on the display module of the output unit.

[0007] As a further improvement of the present technical solution, the determination module adopts the logic of replying first and then performing mode switching or data exchange.

[0008] As a further improvement of the technical solution, the power supply unit includes a constant voltage rectifier circuit, wherein the constant voltage rectifier circuit includes a transformer T1 and a rectifier bridge BG connected to the secondary winding of the transformer T1, wherein:

[0009] The main winding of the transformer T1 is connected to external AC power, one end of the rectifier bridge BG is connected to the resistor R1 and connected to the capacitor C1, the other end of the rectifier bridge BG is connected to the positive electrode of the Zener diode VD, the capacitor C2 and connected to the other end of the capacitor C1, and the resistor R1 is connected to the negative electrode of the Zener diode VD and connected to the other end of the capacitor C2.

[0010] As a further improvement of the technical solution, the MCU sends a Mode instruction to detect the status of the COM1 port and the COM2 port of the data transmission interface unit.

[0011] As a further improvement of the technical solution, the input instruction unit inputs the Change232 instruction through the input interface, switches the COM switching drive unit to the RS-232 test module, and communicates with the product to be tested through the COM port.

[0012] As a further improvement of the present technical solution, the RS-232 test module receives a preset return value through the Test232 instruction, and then sends Test232:RXTXSendStr to read the return value and detect the functions of the RXD and TXD pins.

[0013] As a further improvement of the technical solution, the RS-232 test module short-circuits COM_RTS-COM_CTS-COM_RI through a WRing instruction, and detects the function of the RS-232 test module by setting the pin status.

[0014] As a further improvement of the present technical solution, the input instruction unit inputs the Change422 instruction through the input interface, switches the COM switching drive unit to the RS-422 test module, and at the same time, through the Jumpe setting, sets the RS-422 mode of the mainboard to be tested, thereby detecting the communication status under the RS-422 test module.

[0015] As a further improvement of the present technical solution, the input instruction unit inputs the Change485 instruction through the input interface, switches the COM switching drive unit to the RS-485 test module, and at the same time, through the Jumpe setting, sets the RS-485 mode of the mainboard to be tested, thereby detecting the communication status under the RS-485 test module.

[0016] As a further improvement of the technical solution, the input instruction unit inputs a Reset instruction through the input interface to reset the MCU.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] 1. The functional test fixture of the serial port mode automatic switching detection inputs the corresponding instructions at the input interface of the input instruction unit. The MCU switches the COM switching drive unit to the corresponding test module according to the instructions, and establishes communication with the product under test through the COM1 port and the COM2 port, switches different COM modes (such as RS-232, RS-422, RS-485), and performs corresponding tests, thereby greatly improving the test efficiency.

[0019] 2. When the judgment module receives the command to switch the mode, it first replies to the command and then switches the mode. After switching the mode, it waits for a new command. In this way, when switching modes and interacting with data, the results can be fed back to the MCU in a timely manner and displayed through the display module of the output unit, so as to more intuitively display the test results of the product to be tested.

[0020] 3. Test the functions under different COM modes by inputting corresponding instructions to ensure that the functions under each COM mode are fully tested, reducing the possibility of omissions and negligence. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is an overall schematic diagram of the present invention;

[0022] Figure 2It is a logical flow diagram of the present invention;

[0023] Figure 3 It is a schematic diagram of a constant voltage rectifier circuit of the present invention;

[0024] Figure 4 It is a schematic diagram of the COM port pins of the present invention. DETAILED DESCRIPTION

[0025] The following will be combined with the accompanying drawings in the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0026] The COM port is a serial communication interface on a computer. It is mainly used to realize data transmission between the computer and other peripherals, such as printers, barcode scanners, digital cameras, modems, etc. The basic form of the COM interface is the DB9 type interface, which is a D-shaped 9-pin interface that contains signal lines such as RXD (receive data signal), TXD (send data signal), GND (ground), etc. These signal lines are connected to external devices through the DB9 connector to realize data transmission. There are three main serial communication standards: RS-232, RS-422, and RS-485. As a serial communication interface of the computer, the COM interface, together with RS-232, RS-422, RS-485 and other standards, constitute the basis for communication between computers and external devices. These standards have their own characteristics in terms of interface definition, transmission mode, transmission distance, etc., and are suitable for different application scenarios. In actual applications, you can choose the appropriate interface standard according to specific needs to achieve efficient and stable data transmission. Please refer to Figure 1-Figure 4 As shown, the present invention provides a functional test fixture for automatic switching detection of serial port modes, comprising an input instruction unit, a power supply unit, an MCU main control unit, a COM switching drive unit, a data transmission interface unit and an output unit, wherein the MCU main control unit comprises an MCU and a determination module, the COM switching drive unit comprises an RS-232 test module, an RS-422 test module and an RS-485 test module, the MCU is connected to the determination module, and the determination module is connected to the COM switching drive unit;

[0027] The input interface of the input instruction unit inputs the corresponding instruction to the MCU, and the MCU sends the corresponding control signal according to the corresponding instruction, which reaches the COM switching drive unit through the judgment module, detects or switches the RS-232 test module, RS-422 test module and RS-485 test module, and feeds the result back to the MCU through the judgment module, and the MCU displays the result on the display module of the output unit.

[0028] Principle: connect the COM port of the product to be tested with the COM port of this device, input the corresponding command to the MCU through the input interface of the input command unit, and the MCU sends the corresponding control signal according to the corresponding command to control the COM switching drive unit to switch to the specified test module. Under the corresponding test module, the MCU is controlled to send the corresponding signal through the corresponding command to detect the function of the product to be tested under the test module, so as to realize the full-automatic detection of the COM port of the product to be tested, without the need for personnel to replace the fixture and set the COM mode. When the judgment module receives the switching mode command, it replies to the command first, then switches the mode, and waits for a new command after switching the mode. In this way, when switching modes and interacting data, the results can be fed back to the MCU in time, and displayed through the display module of the output unit, so as to more intuitively display the test results of the product to be tested.

[0029] In order to better feedback the results of mode switching and related data interaction to the MCU, the judgment module adopts the logic of replying first and then switching the mode or exchanging data. The logic flow is as follows: Figure 2 As shown;

[0030] When receiving the switch mode command, reply to the command first, then switch the mode, wait for new commands after switching the mode, and after receiving the reset command, reply Reset OK, and then switch to the correct mode according to the status of Get_Mode1&2. The corresponding control signals are shown in the following table:

[0031] Table 1

[0032]

[0033]

[0034] In order to provide constant voltage direct current for the MCU to enable it to operate stably, the power supply unit includes a constant voltage rectifier circuit, wherein the constant voltage rectifier circuit includes a transformer T1 and a rectifier bridge BG connected to the secondary winding of the transformer T1, wherein:

[0035] The main winding of the transformer T1 is connected to external AC power, one end of the rectifier bridge BG is connected to the resistor R1 and connected to the capacitor C1, the other end of the rectifier bridge BG is connected to the positive electrode of the Zener diode VD, the capacitor C2 and connected to the other end of the capacitor C1, and the resistor R1 is connected to the negative electrode of the Zener diode VD and connected to the other end of the capacitor C2.

[0036] This circuit converts AC into pulsating DC through the rectifier bridge BG, and smoothes and filters it through capacitors C1 and C2. The voltage stabilizing diode VD then outputs constant voltage DC, thus ensuring that the MCU runs stably in a constant voltage DC environment.

[0037] In order to detect the connection status of the COM1 port and the COM2 port when the COM port of the fixture is connected to the COM port of the product to be tested, the MCU sends a Mode instruction to detect the connection status of the COM1 port and the COM2 port of the data transmission interface unit.

[0038] Connect the COM1 port or COM2 port of this fixture to the COM port on the machine to be tested using a connecting cable. The machine to be tested runs the detection software, and the program automatically sends the command: Mode. After the device recognizes it, it returns the current connected COM status and returns OK to identify the connection status of the COM1 port and the COM2 port.

[0039] In order to switch the fixture to RS-232 mode, the input instruction unit inputs the Change232 instruction through the input interface, switches the COM switching drive unit to the RS-232 test module, and communicates with the product under test through the COM port.

[0040] Send Change232 command to switch the fixture to RS-232 mode. Figure 4 As shown: DCD, DTR, DSR pins are short-circuited (pins 1, 4, 6), RTS, CTS, RI pins are short-circuited (pins 7, 8, 9), RXD, TXD pins remain unchanged (pins 2, 3 remain unchanged), and communication with the product under test is carried out.

[0041] In order to detect the functions of the RXD and TXD pins in RS-232 mode, the RS-232 test module receives the preset return value through the Test232 instruction, and then sends Test232:RXTXSendStr to read the return value and detect the functions of the RXD and TXD pins.

[0042] The Test232 command is sent from the input interface through the input instruction unit, and the preset return value is received. Then, Test232:RXTXSendStr is sent and the return value is read. If the return value is Test232:RXTXSendStr, the RxTx signal detection is normal.

[0043] In order to detect the functions of the remaining pins of the COM port, the RS-232 test module shorts COM_RTS-COM_CTS-COM_RI through the WRing instruction, and detects the functions of the RS-232 test module by setting the pin status.

[0044] Set the DCD status of pin 1 to Enable, read whether DTR and DSR of pins 4 and 6 are Enable, then set RTS of pin 7 to Enable, and read whether CTS and RI of pins 8 and 9 are Enable. In this way, all functions of RS-232 mode are tested.

[0045] In order to switch the fixture to RS-422 mode and test its functions in this mode, the input command unit inputs the Change422 command through the input interface, switches the COM switching drive unit to the RS-422 test module, and sets the motherboard to be tested to RS-422 mode through Jumpe setting, so as to detect the communication status under the RS-422 test module.

[0046] The detection of RS-422 mode uses the same pin connection as the detection of RS-232 mode. Send the Test422 command, receive the preset return value, then send Sned422Str:ABCD1234xyz, read the return value. If the return value is Sned422Str:ABCD1234xyz, the RS-422 mode communication detection is normal.

[0047] In order to switch the fixture to RS-485 mode and test its functions in this mode, the input command unit inputs the Change485 command through the input interface, switches the COM switching drive unit to the RS-485 test module, and sets the mainboard to be tested to RS-485 mode through Jumpe setting, so as to detect the communication status under the RS-485 test module.

[0048] Send the Test485 command, receive the preset return value, then send Sned485Str:ABCD1234xyz, read the return value. If the return value is Sned485Str:ABCD1234xyz, the RS-485 mode communication detection is normal.

[0049] The Reset command is input through the input interface of the input command unit to reset the MCU, thereby realizing a quick reset of the fixture for the next use.

[0050] The communication instructions of the fixture are shown in the following table:

[0051] Table 2

[0052]

[0053]

[0054] When the functional test fixture of the automatic switching detection of the serial port mode is used, the COM port of the product to be tested is connected to the COM port of this device, and the external AC power is converted into constant voltage DC power through the constant voltage rectifier circuit of the power supply unit, so as to ensure the stable operation of the MCU under the constant voltage DC environment. The COM1 port or COM2 port of this fixture is connected to the COM port on the machine to be tested with a connecting line. The machine to be tested runs the detection software, and the program automatically sends the command: Mode. After the fixture recognizes it, it returns the current connected COM status, returns OK, recognizes the connection status of the COM1 port and the COM2 port, and then sends Change232 command, switch this fixture to RS-232 mode, send Test232 command from the input interface through the input command unit, receive the preset return value, then send Test232:RXTXSendStr, read the return value, if the return value is Test232:RXTXSendStr, the RxTx signal detection is normal, set the DCD state of pin 1 to Enable, read whether DTR and DSR of pins 4 and 6 are Enable, then set RTS of pin 7 to Enable, read whether CTS and RI of pins 8 and 9 are Enable. In this way, all function tests of RS-232 mode are completed. The detection of RS-422 mode and RS-232 mode use the same pin connection. Send the Test422 command, receive the preset return value, then send Sned422Str:ABCD1234xyz, read the return value, if the return value is Sned422Str:ABCD1234xyz, the RS-422 mode communication test is normal, send the Test485 command, receive the preset return value, then send Sned485Str:ABCD1234xyz, read the return value, if the return value is Sned485Str:ABCD1234xyz, the RS-485 mode communication test is normal.

[0055] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A functional test fixture for automatic switching detection of serial port modes, characterized by: It includes an input instruction unit, a power supply unit, an MCU main control unit, a COM switching drive unit, a data transmission interface unit and an output unit, wherein the MCU main control unit includes an MCU and a determination module, the COM switching drive unit includes an RS-232 test module, an RS-422 test module and an RS-485 test module, the MCU is connected to the determination module, and the determination module is connected to the COM switching drive unit; The input interface of the input instruction unit inputs the corresponding instruction to the MCU, and the MCU sends the corresponding control signal according to the corresponding instruction, which reaches the COM switching drive unit through the judgment module, detects or switches the RS-232 test module, RS-422 test module and RS-485 test module, and feeds the result back to the MCU through the judgment module, and the MCU displays the result on the display module of the output unit.

2. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The determination module adopts the logic of replying first and then switching modes or exchanging data.

3. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The power supply unit includes a constant voltage rectifier circuit, wherein the constant voltage rectifier circuit includes a transformer T1 and a rectifier bridge BG connected to a secondary winding of the transformer T1, wherein: The main winding of the transformer T1 is connected to external AC power, one end of the rectifier bridge BG is connected to the resistor R1 and connected to the capacitor C1, the other end of the rectifier bridge BG is connected to the positive electrode of the Zener diode VD, the capacitor C2 and connected to the other end of the capacitor C1, and the resistor R1 is connected to the negative electrode of the Zener diode VD and connected to the other end of the capacitor C2.

4. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The MCU sends a Mode instruction to detect the connection status between the COM1 port and the COM2 port of the data transmission interface unit.

5. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The input instruction unit inputs the Change232 instruction through the input interface, switches the COM switching drive unit to the RS-232 test module, and communicates with the product to be tested through the COM port.

6. The functional test fixture for automatic serial port mode switching detection according to claim 5, characterized in that: The RS-232 test module receives a preset return value through the Test232 instruction, and then sends Test232:RXTXSendStr to read the return value and detect the functions of the RXD and TXD pins.

7. The functional test fixture for automatic serial port mode switching detection according to claim 5, characterized in that: The RS-232 test module short-circuits COM_RTS-COM_CTS-COM_RI through the WRing instruction, and detects the function of the RS-232 test module by setting the pin status.

8. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The input instruction unit inputs the Change422 instruction through the input interface, switches the COM switching drive unit to the RS-422 test module, and at the same time sets the tested mainboard to RS-422 mode through Jumpe setting, thereby detecting the communication status under the RS-422 test module.

9. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The input instruction unit inputs the Change485 instruction through the input interface, switches the COM switching drive unit to the RS-485 test module, and at the same time sets the RS-485 mode of the mainboard to be tested through the Jumpe setting, thereby detecting the communication status under the RS-485 test module.

10. The functional test fixture for automatic serial port mode switching detection according to claim 1, characterized in that: The input instruction unit inputs a Reset instruction through the input interface to reset the MCU.