Serial port signal conversion method and device, equipment and medium

By setting up a communication link with signal conversion function and without signal conversion function in the server, detecting and switching link types, the cable diversity problem during UART/USB signal conversion is solved, and efficient serial port signal is achieved Convert and reduce costs.

CN119025455APending Publication Date: 2024-11-26INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411246602.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In the server design, when converting UART/USB signal, it is impossible to confirm that there are UART/USB conversion chips on all boards, resulting in the need to prepare two types of cables, which increases trouble, material costs and time costs, and reduces work efficiency .

Method used

By setting a communication link with signal conversion function and a communication link without signal conversion function in the first device, the signal type is detected and the corresponding communication link is switched, signal conversion is realized and the cable type requirement is reduced.

Benefits of technology

It realizes normal connection of serial port signals, reduces material costs and improves efficiency, and ensures the integrity and success rate of signal transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025455A_ABST
    Figure CN119025455A_ABST
Patent Text Reader

Abstract

The invention discloses a serial port signal conversion method and device, equipment and a medium, and relates to the technical field of communication. After a current signal sent by a first communication link without a signal conversion module is received, if the current signal is a first signal, the signal is directly analyzed, and if the current signal is a second signal, the second signal is converted into the first signal used during communication of first equipment through a second communication link with a conversion function module. And the first signal is analyzed. The link with the signal conversion function and the link without the signal conversion function are simultaneously arranged in the first equipment, so that the first signal can be obtained through different communication links, normal connection of serial port communication is realized, and the communication efficiency is improved. Due to the fact that any kind of signal input from the serial port interface can be converted into the signal used for communication of the first device, only one kind of cable needs to be prepared, troubles are reduced, the material cost is reduced, and the serial port signal conversion efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device, equipment and medium for converting serial port signals. Background Art

[0002] When two different types of interfaces interact, it is often necessary to convert the signal corresponding to one interface into a signal that can be recognized by the other interface. For example, when the Universal Serial Bus (USB) interface interacts with the Universal Asynchronous Receiver / Transmitter (UART) interface, it is necessary to convert the USB signal to the UART signal.

[0003] Currently, UART / USB conversion chips are placed directly at the location where UART signals and USB signals need to be converted. However, in server design, UART / USB conversion chips are generally placed on the board. At this time, external devices can be accessed through the UART serial port by directly connecting via a USB cable; however, it is not certain that UART / USB conversion chips are placed on all boards. At this time, cables with UART / USB conversion chips are required for signal conversion. Without knowing the internal connections of the server, in order to achieve normal connection of UART serial communication, two types of cables need to be prepared: direct connection cables and cables with signal conversion functions, which causes great trouble, increases material costs and time costs, and greatly reduces work efficiency.

[0004] It can be seen that how to improve the efficiency of serial port signal conversion and reduce the cost of serial port signal conversion is a technical problem that people in this field need to solve urgently. Summary of the invention

[0005] The purpose of the present invention is to provide a method, device, equipment and medium for converting serial port signals to solve the technical problems of low efficiency and high cost of serial port signal conversion.

[0006] In order to solve the above technical problem, the present invention provides a method for converting a serial port signal, which is applied to a processor of a first device, and the method comprises:

[0007] Receiving a current signal sent by a serial port interface through a first communication link; wherein the serial port interface is located in the first device; the current signal sent by the serial port interface is transmitted by a cable connected between the serial port interface and a second device; the cable connected between the serial port interface and the second device is a cable with a signal conversion function and a cable without a signal conversion function; the first communication link does not include a signal conversion module;

[0008] When detecting that the current signal is a first signal, parsing the first signal; wherein the first signal is a signal used by the first device for communication;

[0009] When it is detected that the current signal is the second signal, the first communication link with the serial port interface is disconnected, and a second communication link with the serial port interface is established through a signal conversion module, and the second signal is converted into the first signal through the second communication link, and the first signal is parsed; wherein, the second signal is a signal used by the second device for communication, and the signal conversion module is located in the first device.

[0010] On the one hand, the serial port interface is further connected to the controller of the first device via a path selection module, and the path selection module is used to select one of the first communication link and the second communication link;

[0011] The disconnecting of the first communication link with the serial port interface and establishing a second communication link with the serial port interface through a signal conversion module comprises:

[0012] When receiving information for indicating the opening of the second communication link, information for disconnecting the first channel and opening the second channel is sent to the path selection module, so as to disconnect the first communication link with the serial port interface through the path selection module, and establish the second communication link with the serial port interface by using the path selection module and through the signal conversion module.

[0013] On the other hand, the path selection module is a single-pole double-throw switch, and the receiving of the current signal sent by the serial port interface through the first communication link includes:

[0014] Controlling the first moving end of the single-pole double-throw switch to close, and receiving the current signal sent by the serial port interface through the first communication link;

[0015] The sending of information of disconnecting the first channel and opening the second channel to the path selection module comprises:

[0016] Information indicating that the first movable end is opened and information indicating that the second movable end is closed are sent to the single-pole double-throw switch.

[0017] On the other hand, the path selection module is a multiplexer, and disconnecting the first communication link with the serial port interface and establishing the second communication link with the serial port interface through the signal conversion module includes:

[0018] Control information for characterizing disconnection of a first communication link with the serial port interface and control information for establishing a second communication link with the serial port interface through a signal conversion module are sent to the multiplexer through a signal transmission link between the processor and the multiplexer, so as to disconnect the first communication link with the serial port interface and establish the second communication link with the serial port interface through the signal conversion module.

[0019] On the other hand, after parsing the first signal, the method further includes:

[0020] determining whether to return information to the second device according to the parsed signal;

[0021] If so, obtaining information to be transmitted to the second device, converting the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmitting the target signal to the second device;

[0022] If not, then end.

[0023] On the other hand, converting the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmitting the target signal to the second device includes:

[0024] Acquire the type of the current signal sent by the first communication link; wherein the type of the current signal is one of the first signal and the second signal;

[0025] In the case where it is detected that the type of the current signal sent by the first communication link is the first signal, determining that an odd number of signal conversion units exist in the cable connecting the serial port interface and the second device;

[0026] Converting the information to be transmitted to the second device into a target signal having the same format as the second signal through a cable having the odd number of signal conversion units, and transmitting the target signal to the second device; wherein the signal conversion unit has a two-way communication function;

[0027] In the case of detecting that the type of the current signal sent by the first communication link is the second signal, determining that there is no signal conversion unit or an even number of signal conversion units in the cable connecting the serial port interface and the second device;

[0028] prompting the user to establish a third communication link including an odd number of signal conversion units;

[0029] When it is detected that the establishment of the third communication link is completed, the information to be transmitted to the second device is converted into a target signal with the same format as the second signal by a signal conversion unit in the third communication link, and the target signal is transmitted to the second device.

[0030] On the other hand, after the signal conversion unit in the third communication link converts the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmits the target signal to the second device, the method further includes:

[0031] The third communication link is disconnected within a preset time period starting from sending the information to be transmitted to the second device to the second device.

[0032] In order to solve the above technical problems, the present invention further provides a serial port signal conversion device, the device comprising:

[0033] A receiving module, configured to receive a current signal sent by a serial port interface through a first communication link; wherein the serial port interface is located in a first device; the current signal sent by the serial port interface is transmitted by a cable connected between the serial port interface and a second device; the cable connected between the serial port interface and the second device is a cable with a signal conversion function and a cable without a signal conversion function; the first communication link does not include a signal conversion module;

[0034] A judging module, used to judge whether the current signal is the first signal; if so, trigger the analyzing module; if not, trigger the disconnection and establishment module;

[0035] The parsing module is used to parse the first signal; wherein the first signal is a signal used by the first device when communicating;

[0036] A disconnection and establishment module; used to disconnect the first communication link between the serial port interface, establish a second communication link between the serial port interface through a signal conversion module, convert the second signal into the first signal through the second communication link, and return to trigger the analysis module; wherein the second signal is the signal used by the second device for communication, and the signal conversion module is located in the first device.

[0037] In order to solve the above technical problems, the present invention also provides a serial port signal conversion device, comprising:

[0038] Memory for storing computer programs;

[0039] The processor is used to implement the steps of the above-mentioned serial port signal conversion method when executing the computer program.

[0040] In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above serial port signal conversion method are implemented.

[0041] The beneficial effect of the present invention is that in this method, after receiving the current signal sent by the first communication link that does not include a signal conversion module, the signal is classified. If it is a first signal used by the first device for communication, the signal can be directly parsed. If it is a second signal that cannot be used by the first device for communication, the second signal is converted into the first signal used by the first device for communication through a second communication link with a conversion function module, thereby parsing the first signal. Since a link with a signal conversion function and a link without a signal conversion function are simultaneously set inside the first device, after the signal input from the serial port interface is classified, the first signal used by the first device for communication can be obtained through different communication links to achieve normal connection of the serial port communication. Since any signal input from the serial port interface can be converted into a signal used by the first device for communication, only one type of cable, a direct-connected cable and a cable with a signal conversion function, needs to be prepared, which reduces trouble, reduces material costs, and improves the efficiency of serial port signal conversion.

[0042] In addition, the path selection module is used to disconnect the first communication link that does not include the signal conversion module and to establish a second communication link with the serial port interface with a conversion function module, so that when the first device has two types of communication links at the same time, the signal can only pass through the only communication link, thereby ensuring that the required signal can be obtained and realizing normal communication of the serial port; in addition, the path selection module can be a single-pole double-throw switch or a multiplexer, so that the switching of the communication link can be flexibly realized.

[0043] After parsing the first signal in the first device, it is determined whether information is to be returned to the second device. If so, the information to be transmitted to the second device is converted into a target signal with the same format as the second signal, and the target signal is transmitted to the second device, thereby ensuring the integrity of signal transmission.

[0044] When converting information to be transmitted to the second device into a target signal with the same format as the second signal, the signal conversion unit existing in the cable connecting the serial port interface and the second device is determined according to the type of the current signal sent by the first communication link. When it is detected that the type of the current signal sent by the first communication link is the first signal and the cable has an odd number of signal conversion units, since the signal conversion unit has a two-way communication function, the target signal can be transmitted to the second device using the original cable, thereby improving the utilization rate of the communication line.

[0045] When it is detected that the type of the current signal sent by the first communication link is the second signal, and there is no signal conversion unit or an even number of signal conversion units in the cable, a third communication link including an odd number of signal conversion units is newly established, and the target signal is transmitted to the second device using the third communication link. This method ensures that the target signal can be transmitted to the second device as much as possible, and ensures the success rate and integrity of signal transmission.

[0046] In addition, the present invention also provides a serial port signal conversion device, a serial port signal conversion equipment and a computer-readable storage medium, which have the same or corresponding technical features as the above-mentioned serial port signal conversion method and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 A flowchart of a serial port signal conversion method provided by an embodiment of the present invention;

[0049] Figure 2 A schematic diagram of an interaction scenario provided by an embodiment of the present invention;

[0050] Figure 3 A schematic diagram of UART / USB signal conversion provided by an embodiment of the present invention;

[0051] Figure 4 A schematic diagram of serial port signal conversion on a mainboard provided by an embodiment of the present invention;

[0052] Figure 5 A flowchart of a method for converting a UART USB signal into a serial port signal provided by an embodiment of the present invention;

[0053] Figure 6 A structural diagram of a serial port signal conversion device provided in another embodiment of the present invention. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of 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.

[0055] The core of the present invention is to provide a method, device, equipment and medium for converting serial port signals to solve the technical problems of low efficiency and high cost of serial port signal conversion.

[0056] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 A flowchart of a method for converting a serial port signal provided by an embodiment of the present invention, the method is applied to a processor of a first device, and the method includes:

[0057] S10: receiving a current signal sent by the serial port interface through the first communication link; wherein the serial port interface is located in the first device; and the first communication link does not include a signal conversion module;

[0058] S11: Determine whether the current signal is the first signal; if so, proceed to step S12; if not, proceed to step S13;

[0059] S12: parsing a first signal; wherein the first signal is a signal used by the first device for communication;

[0060] S13: disconnecting the first communication link with the serial port interface, establishing a second communication link with the serial port interface through the signal conversion module, converting the second signal into the first signal through the second communication link, and returning to step S12;

[0061] The second signal is a signal used by the second device for communication, and the signal conversion module is located in the first device.

[0062] First, the interaction scenario of the present invention is described. Figure 2 A schematic diagram of an interaction scenario provided by an embodiment of the present invention, such as Figure 2 As shown, the interaction scenario includes a first device and a second device. The first device includes a processor and a serial port interface. There are two communication links between the processor and the serial port interface, one communication link is a communication link with a signal conversion module, and the other communication link is a communication link without a signal conversion module. It is worth noting that at the same time, only one communication link is in a conducting state. The serial port interface of the first device is connected to the second device through a cable.

[0063] There is no limitation on the first device and the second device, such as the first device is a server and the second device is a terminal device. The serial port interface of the first device is connected to the second device via a cable. In order to meet communication needs, signal conversion is often required. For example, in daily applications, the USB interface has a more universal application range than the UART interface. Therefore, in server design, UART signals are often used to connect to external devices through the USB interface, and then the UART signals need to be converted. At present, UART / USB conversion chips are directly placed at the position where the UART signal and the USB signal need to be converted, but in server design, UART / USB conversion chips are generally placed on the board. At this time, the external device can be directly connected via a USB cable to achieve access through the UART serial port. However, it is impossible to determine whether the UART / USB conversion chip is placed on all boards. At this time, a cable with a UART / USB conversion chip is required to convert the signal. Figure 3 A schematic diagram of UART / USB signal conversion provided by an embodiment of the present invention, such as Figure 3 As shown, the universal asynchronous receiver / transmitter signal and the universal serial bus signal are converted by the asynchronous receiver / transmitter / universal serial bus conversion chip. The cable between the serial port interface of the first device and the second device can be a cable with a signal conversion function or a cable without a signal conversion function.

[0064] When these two situations occur at the same time, if the internal connection of the server is not clear, two types of cables need to be prepared, which will cause great trouble and increase material and time costs, greatly reducing efficiency. Therefore, in the embodiment of the present invention, the cable connected between the serial port interface and the second device is a cable with a signal conversion function and a cable without a signal conversion function. There is no limitation on the cable used, which is determined according to the actual situation.

[0065] During the signal transmission process, the second device sends a signal to the serial port interface of the first device through a cable connected between the serial port interface of the first device and the second device, and the serial port interface transmits the signal to the processor of the first device through a first communication link that does not include a signal conversion module. The processor of the first device can be a complex programmable logic device (CPLD), etc., which is not limited to this.

[0066] After the processor of the first device obtains the current signal sent by the serial port interface through the first communication link, it can identify the current signal. Taking the identification of the first signal as an example, in implementation, determining the first signal includes: predetermining the reference transmission rate, reference transmission format and reference data transmission scenario corresponding to the first signal; after obtaining the current signal, if the current transmission rate, current transmission format and current data transmission scenario of the current signal; if it is detected that the difference between the current transmission rate and the reference transmission rate is within a preset range, and / or the current transmission format is the same as the reference transmission format, and / or the current data transmission scenario is the same as the reference data transmission scenario, then the current signal is determined to be the first signal.

[0067] By using the transmission rate, transmission format or data transmission scenario as a basis for identifying the first signal, the first signal is identified.

[0068] After identifying that the current signal is the first signal, since the first signal is the signal used when the first device communicates, the first signal can be directly parsed. After identifying that the current signal is the second signal, since the second signal cannot be used when the first device communicates, the first communication link with the serial port interface is disconnected in the embodiment of the present invention, and a second communication link with the serial port interface is established through a signal conversion module, and the second signal is converted to the first signal through the second communication link, and then the first signal is parsed. There is no limitation on the signal conversion module used, which is determined according to the specific converted signal. For example, when converting a USB signal to a UART signal, the signal conversion module used is a UART / USB conversion chip. There is no limitation on the method of disconnecting the first communication link with the serial port interface and establishing the second communication link with the serial port interface.

[0069] In some embodiments, a path selection module is provided between the serial port interface in the first device and the controller to disconnect the first communication link with the serial port interface and establish the second communication link with the serial port interface. The path selection module is used to select one of the first communication link and the second communication link;

[0070] Disconnecting a first communication link with the serial port interface and establishing a second communication link with the serial port interface through a signal conversion module includes:

[0071] When receiving information for indicating the opening of the second communication link, information for disconnecting the first channel and opening the second channel is sent to the path selection module, so as to disconnect the first communication link with the serial port interface through the path selection module, and establish the second communication link with the serial port interface by using the path selection module and through the signal conversion module.

[0072] The path selection module may be a single-pole double-throw switch or a multiplexer.

[0073] When the path selection module may be a single-pole double-throw switch, receiving the current signal sent by the serial port interface through the first communication link includes:

[0074] Controlling the first moving end of the single-pole double-throw switch to close, and receiving a current signal sent by the serial port interface through the first communication link;

[0075] The information of disconnecting the first channel and opening the second channel is sent to the path selection module, including:

[0076] Information indicating that a first movable end is opened and information indicating that a second movable end is closed are sent to the single-pole double-throw switch.

[0077] When the path selection module is a multiplexer, disconnecting the first communication link with the serial port interface and establishing the second communication link with the serial port interface through the signal conversion module includes:

[0078] Control information for characterizing disconnection of a first communication link with the serial port interface and control information for establishing a second communication link with the serial port interface through a signal conversion module are sent to the multiplexer through a signal transmission link between the processor and the multiplexer, so as to disconnect the first communication link with the serial port interface and establish the second communication link with the serial port interface through the signal conversion module.

[0079] Figure 4 A schematic diagram of serial port signal conversion on a motherboard provided by an embodiment of the present invention, such as Figure 4 As shown, the main board includes a serial port interface, a path selection module, a processor and a signal conversion module. The output end of the serial port interface is connected to the input end of the path selection module, the channel 1 of the path selection module is connected to the processor (called the first communication link), and the channel 2 of the path selection module is connected to the processor (called the second communication link). It is worth noting that at the same time, the path selection module only controls one of the first communication link and the second communication link to be turned on. In order to trigger the path turned on by the path selection module, in implementation, when the enable signal is received from the processor, the path selection module turns off the first communication link and turns on the second communication link.

[0080] Add a path selection module to the signal conversion module and serial port interface in the motherboard design (taking the conversion of USB signals to UART signals as an example, the signal conversion module in the motherboard design is a UART / USB conversion chip). Its upstream source is the serial port interface, and the downstream interface is two channels. Channel 2 is connected to the signal conversion module, and the channel is connected to the processor. The path selection module opens channel 1 and closes channel 2 by default. When the enable signal is received from the processor, channel 1 of the path selection module is closed and channel 2 is opened.

[0081] In order to enable those skilled in the art to better understand the serial port signal conversion process of the present invention, the following takes the conversion of USB signals into UART signals as an example to illustrate the serial port signal conversion process of UART USB signals. Figure 5 A flowchart of a method for converting a UART USB signal into a serial port signal is provided in an embodiment of the present invention, such as Figure 5 As shown, the method includes:

[0082] S14: Serial port interface receives signal;

[0083] S15: The serial port interface transmits the received signal to the processor;

[0084] S16: The processor determines whether the signal is an asynchronous receiver / transmitter signal; if so, it proceeds to step S17; if not, it proceeds to step S18;

[0085] S17: normal recognition, signal transmission completed;

[0086] S18: trigger the processor to block direct transmission;

[0087] S19: The signal is transmitted to the asynchronous receiver / transmitter / universal serial bus conversion chip for signal conversion, and the process returns to step S17.

[0088] When the serial port is connected to an external device, the signal is first transmitted from the external device to the mainboard. The signal is directly connected to the processor through channel one that is opened by default in the path selection module (enabling communication through channel one). At this time, the processor identifies and distinguishes the signal. When the transmission signal is a UART signal, the external cable is equipped with an asynchronous receiver / transmitter / universal serial bus conversion chip. At this time, the signal transmission is completed and serial port communication is carried out normally. When the transmission signal is a USB signal, the processor identifies it and triggers the enable signal from the processor to the path selection module, so that channel one is closed and channel two is opened. At this time, USB signal → channel two of the path selection module → asynchronous receiver / transmitter / universal serial bus conversion chip → processor. The external cable does not have an asynchronous receiver / transmitter / universal serial bus conversion chip. At this time, the signal transmission is completed.

[0089] In the motherboard design, regardless of whether the UART signal is connected to the external USB interface with a UART / USB conversion chip, the motherboard design needs to be rechecked during maintenance in order to select the appropriate cable during the serial port connection process, which increases the workload, reduces work efficiency, and increases maintenance costs. When a motherboard with this design is connected to an external device through a serial port interface, regardless of whether the cable has a UART / USB conversion chip, the UART serial port communication can be connected normally, reducing the subsequent maintenance cost, and all applications involving UART signal external connection can achieve cost reduction effects.

[0090] The above describes the process of transmitting a signal from the second device to the first device. In implementation, after the second device transmits a signal to the first device, the first device may need to transmit a signal to the second device. Therefore, after parsing the first signal, the following is also included:

[0091] Determining whether to return information to the second device according to the parsed signal;

[0092] If yes, obtaining information to be transmitted to the second device, converting the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmitting the target signal to the second device;

[0093] If not, then end.

[0094] Specifically, converting the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmitting the target signal to the second device includes:

[0095] Acquire the type of a current signal sent by the first communication link; wherein the type of the current signal is one of a first signal and a second signal;

[0096] In the case where it is detected that the type of the current signal sent by the first communication link is the first signal, determining that an odd number of signal conversion units exist in the cable connected between the serial port interface and the second device;

[0097] Converting information to be transmitted to a second device into a target signal having the same format as the second signal through a cable having an odd number of signal conversion units, and transmitting the target signal to the second device; wherein the signal conversion unit has a two-way communication function;

[0098] In the case where it is detected that the type of the current signal sent by the first communication link is the second signal, determining that there is no signal conversion unit or an even number of signal conversion units in the cable connected between the serial port interface and the second device;

[0099] prompting the user to establish a third communication link including an odd number of signal conversion units;

[0100] When it is detected that the establishment of the third communication link is completed, the information to be transmitted to the second device is converted into a target signal with the same format as the second signal by the signal conversion unit in the third communication link, and the target signal is transmitted to the second device.

[0101] After converting the information to be transmitted to the second device into a target signal having the same format as the second signal through the signal conversion unit in the third communication link, and transmitting the target signal to the second device, the method further includes:

[0102] The third communication link is disconnected within a preset time period starting from sending the information to be transmitted to the second device to the second device.

[0103] There is no limit on the preset time length, as long as it is ensured that the target information can be transmitted to the second device.

[0104] In the method provided in this embodiment, when converting the information to be transmitted to the second device into a target signal with the same format as the second signal, the signal conversion unit existing in the cable connecting the serial port interface and the second device is determined according to the type of the current signal sent by the first communication link. When it is detected that the type of the current signal sent by the first communication link is the first signal and the cable has an odd number of signal conversion units, since the signal conversion unit has a two-way communication function, the target signal can be transmitted to the second device using the original cable, thereby improving the utilization rate of the communication line. When it is detected that the type of the current signal sent by the first communication link is the second signal and there is no signal conversion unit or an even number of signal conversion units in the cable, a new third communication link containing an odd number of signal conversion units is established, and the target signal is transmitted to the second device using the third communication link. This method ensures that the target signal can be transmitted to the second device as much as possible, and ensures the success rate and integrity of the signal transmission.

[0105] In the above embodiments, the serial port signal conversion method is described in detail, and the present invention also provides a serial port signal conversion device and a serial port signal conversion device corresponding to the embodiment. It should be noted that the present invention describes the embodiment of the device part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.

[0106] A serial port signal conversion device provided by an embodiment of the present invention includes, based on the perspective of functional modules, the following:

[0107] A receiving module, used for receiving a current signal sent by the serial port interface through the first communication link; wherein the serial port interface is located in the first device; the current signal sent by the serial port interface is transmitted by a cable connected between the serial port interface and the second device; the cable connected between the serial port interface and the second device is a cable with a signal conversion function and a cable without a signal conversion function; the first communication link does not include a signal conversion module;

[0108] A judgment module, used to judge whether the current signal is the first signal; if so, trigger the analysis module; if not, trigger the disconnection and establishment module;

[0109] A parsing module, used to parse a first signal; wherein the first signal is a signal used by the first device for communication;

[0110] A disconnection and establishment module; used to disconnect the first communication link with the serial port interface, establish the second communication link with the serial port interface through the signal conversion module, convert the second signal into the first signal through the second communication link, and return to trigger the analysis module; wherein the second signal is the signal used by the second device for communication, and the signal conversion module is located in the first device.

[0111] In some embodiments, the serial port signal conversion device further includes:

[0112] A first determination module, configured to determine whether information is to be returned to the second device according to the parsed signal; if so, triggering the acquisition and transmission module; if not, ending;

[0113] The acquisition and transmission module is used to acquire information to be transmitted to the second device, convert the information to be transmitted to the second device into a target signal with the same format as the second signal, and transmit the target signal to the second device.

[0114] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0115] Figure 6 This is a structural diagram of a serial port signal conversion device provided by another embodiment of the present invention. This embodiment is based on the hardware perspective, such as Figure 6 As shown, the serial port signal conversion device includes:

[0116] A memory 20, used for storing computer programs;

[0117] The processor 21 is used to implement the steps of the method for converting the serial port signal mentioned in the above embodiment when executing the computer program.

[0118] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0119] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, the relevant steps of the serial port signal conversion method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the above-mentioned serial port signal conversion method, etc.

[0120] In some embodiments, the serial port signal conversion device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0121] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the serial port signal conversion device, and may include more or fewer components than those shown in the figure.

[0122] The serial port signal conversion device provided by the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: the serial port signal conversion method has the same effect as above.

[0123] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned serial port signal conversion method when executed by a processor.

[0124] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0125] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0126] The computer-readable storage medium provided by the present invention includes the above-mentioned serial port signal conversion method, and the effect is the same as above.

[0127] The above is a detailed introduction to a serial port signal conversion method, device, equipment and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

[0128] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A method for converting a serial port signal, characterized in that: The method is applied to a processor of a first device, and includes: Receiving a current signal sent by a serial port interface through a first communication link; wherein the serial port interface is located in the first device; the current signal sent by the serial port interface is transmitted by a cable connected between the serial port interface and a second device; the cable connected between the serial port interface and the second device is a cable with a signal conversion function and a cable without a signal conversion function; the first communication link does not include a signal conversion module; When detecting that the current signal is a first signal, parsing the first signal; wherein the first signal is a signal used by the first device for communication; When it is detected that the current signal is the second signal, the first communication link with the serial port interface is disconnected, and a second communication link with the serial port interface is established through a signal conversion module, and the second signal is converted into the first signal through the second communication link, and the first signal is parsed; wherein, the second signal is a signal used by the second device for communication, and the signal conversion module is located in the first device.

2. The method for converting serial port signals according to claim 1, characterized in that: The serial port interface is also connected to the controller of the first device via a path selection module, and the path selection module is used to select one of the first communication link and the second communication link; The disconnecting of the first communication link with the serial port interface and establishing a second communication link with the serial port interface through a signal conversion module comprises: When receiving information for indicating the opening of the second communication link, information for disconnecting the first channel and opening the second channel is sent to the path selection module, so as to disconnect the first communication link with the serial port interface through the path selection module, and establish the second communication link with the serial port interface by using the path selection module and through the signal conversion module.

3. The method for converting serial port signals according to claim 2, characterized in that: The path selection module is a single-pole double-throw switch, and the receiving of the current signal sent by the serial port interface through the first communication link includes: Controlling the first moving end of the single-pole double-throw switch to close, and receiving the current signal sent by the serial port interface through the first communication link; The sending of information of disconnecting the first channel and opening the second channel to the path selection module comprises: Information indicating that the first movable end is opened and information indicating that the second movable end is closed are sent to the single-pole double-throw switch.

4. The method for converting serial port signals according to claim 2, characterized in that: The path selection module is a multiplexer, and the disconnection of the first communication link with the serial port interface and the establishment of the second communication link with the serial port interface through the signal conversion module comprises: Control information for characterizing disconnection of a first communication link with the serial port interface and control information for establishing a second communication link with the serial port interface through a signal conversion module are sent to the multiplexer through a signal transmission link between the processor and the multiplexer, so as to disconnect the first communication link with the serial port interface and establish the second communication link with the serial port interface through the signal conversion module.

5. The method for converting serial port signals according to any one of claims 1 to 4, characterized in that: After parsing the first signal, the method further includes: determining whether to return information to the second device according to the parsed signal; If so, obtaining information to be transmitted to the second device, converting the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmitting the target signal to the second device; If not, then end.

6. The method for converting serial port signals according to claim 5, characterized in that: The converting the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmitting the target signal to the second device comprises: Acquire the type of the current signal sent by the first communication link; wherein the type of the current signal is one of the first signal and the second signal; In the case where it is detected that the type of the current signal sent by the first communication link is the first signal, determining that an odd number of signal conversion units exist in the cable connecting the serial port interface and the second device; Converting the information to be transmitted to the second device into a target signal having the same format as the second signal through a cable having the odd number of signal conversion units, and transmitting the target signal to the second device; wherein the signal conversion unit has a two-way communication function; In the case of detecting that the type of the current signal sent by the first communication link is the second signal, determining that there is no signal conversion unit or an even number of signal conversion units in the cable connecting the serial port interface and the second device; prompting the user to establish a third communication link including an odd number of signal conversion units; When it is detected that the establishment of the third communication link is completed, the information to be transmitted to the second device is converted into a target signal with the same format as the second signal by a signal conversion unit in the third communication link, and the target signal is transmitted to the second device.

7. The method for converting serial port signals according to claim 6, characterized in that: After the signal conversion unit in the third communication link converts the information to be transmitted to the second device into a target signal having the same format as the second signal, and transmits the target signal to the second device, the method further includes: The third communication link is disconnected within a preset time period starting from sending the information to be transmitted to the second device to the second device.

8. A serial port signal conversion device, characterized in that: The device comprises: A receiving module, configured to receive a current signal sent by a serial port interface through a first communication link; wherein the serial port interface is located in a first device; the current signal sent by the serial port interface is transmitted by a cable connected between the serial port interface and a second device; the cable connected between the serial port interface and the second device is a cable with a signal conversion function and a cable without a signal conversion function; the first communication link does not include a signal conversion module; A judging module, used to judge whether the current signal is the first signal; if so, trigger the analyzing module; if not, trigger the disconnection and establishment module; The parsing module is used to parse the first signal; wherein the first signal is a signal used by the first device when communicating; A disconnection and establishment module; used to disconnect the first communication link between the serial port interface, establish a second communication link between the serial port interface through a signal conversion module, convert the second signal into the first signal through the second communication link, and return to trigger the analysis module; wherein the second signal is the signal used by the second device for communication, and the signal conversion module is located in the first device.

9. A serial port signal conversion device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the serial port signal conversion method as claimed in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the serial port signal conversion method according to any one of claims 1 to 7 are implemented.