A communication circuit and communication method for sharing serial port
By adopting a shared serial port communication circuit in a multi-motherboard system and using RTS signals for serial port selection and control, the problems of complex wiring and low system reliability are solved, and transparent communication and simplified coding between the host computer and multiple motherboards are realized. .
Patent Information
- Application Number
- CN202111583766.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the existing technology, when multiple motherboards share a serial port, the wiring is complicated, the arbitration board is abnormal, resulting in reduced system reliability, and due to the existence of control messages, the host computer cannot communicate completely transparently with the target board.
Using a shared serial port communication circuit, including a public serial interface module and multiple business serial interface modules, through the data path signal switch, control signal regeneration circuit and arbitration circuit, the RTS signal of the host computer is used for serial port selection and control to realize the serial port Address matching and communication.
It avoids the use of arbitration board, simplifies wiring, improves system reliability, realizes completely transparent communication between the host computer and each main board, and simplifies the encoding and decoding of address encoding information.
Smart Images

Figure CN114416629B
Abstract
Description
Technical Field
[0001] The invention relates to a communication circuit and a communication method for sharing a serial port, belonging to the technical field of electronic circuits. Background Art
[0002] Serial ports are often used as motherboard debugging interfaces because they are easy to use and take up little resources. The most basic hardware debugging and diagnosis of the motherboard can be performed through the serial port. With the development of technology, some intelligent electronic devices are developing in the direction of multiple motherboards. Each motherboard is independent of each other and realizes different business functions. However, due to various reasons such as structural design, many intelligent devices generally only retain one serial port for communication with the host computer.
[0003] In order to enable the host computer to communicate with the serial ports of all the mainboards on the smart device, multiple serial ports need to share an interface circuit. A common method is to add an arbitration board. The serial ports of each mainboard are connected to the arbitration board. The arbitration board leads to a serial port to the interface circuit and connects to the host computer serial port. The arbitration board uses the specific control message sent by the host computer serial port to determine which mainboard serial port should communicate with the host computer. Figure 1 However, this method has the following disadvantages
[0004] (1) The serial ports of each motherboard need to be connected to the arbitration board. When there are many motherboards, the wiring is complicated, which is not conducive to the development and design of the equipment;
[0005] (2) When an abnormality occurs on the arbitration board, all boards cannot communicate with the serial port of the host computer;
[0006] (3) Due to the existence of control messages, the host computer cannot communicate with the target board completely transparently.
[0007] Therefore, overcoming the above problems and simplifying the design of wiring are issues that need to be addressed currently. Summary of the invention
[0008] The purpose of the present invention is to provide a communication circuit and a communication method for a shared serial port, so as to solve the defects of the existing method, first, the wiring is complicated when there are a large number of business mainboards, second, the system reliability is reduced due to the introduction of an arbitration board, and due to the existence of control messages, the host computer cannot communicate with the target board completely transparently.
[0009] A communication circuit for sharing a serial port includes a public serial interface module and a plurality of service serial interface modules; the plurality of service serial interface modules are connected and communicated with the serial port of a host computer through the public serial interface module;
[0010] The service serial interface module is provided with a data path signal switch, a control signal regeneration circuit and an arbitration circuit; one end of the data path signal switch is connected to the serial port to be communicated, and the other end is connected to the communication transceiver port in the host computer through the public serial interface module; the input end of the control signal regeneration circuit is connected to the arbitration circuit, receives the control signal output by the arbitration circuit, and provides an out-of-band control signal to the service module according to the matching result of the arbitration circuit;
[0011] The arbitration circuit of each service serial interface module includes a serial port address configuration input terminal, a coding signal input terminal, a matching signal output terminal and an out-of-band control signal output terminal; the serial port address configuration input terminal is used to receive unique serial port address configuration information; the coding signal input terminal is used to receive the control coding signal output by the host computer using the serial port RTS signal via the public serial interface module;
[0012] The arbitration circuit decodes the received control coding signal and matches it with the configured unique serial port address, and outputs a signal to the data path signal switch and the control signal regeneration circuit through the matching signal output terminal according to the matching result, thereby controlling the on and off of the data path signal switch and the output state of the control signal regeneration circuit.
[0013] Furthermore, the arbitration circuit is a CPU module or an FPGA module.
[0014] Furthermore, the public serial interface module is used to convert the signal sent by the business serial interface module into RS-232 level and then connect it to the serial port receiving pin of the host computer; the public serial interface module is also used to convert the RS-232 level signal sent by the host computer into TTL level and connect it to the signal switch.
[0015] A communication method for a communication circuit sharing a serial port, the method comprising:
[0016] The host computer uses the serial port RTS signal to send a control coding signal to each service serial interface module via the public serial interface module;
[0017] The arbitration circuit of the service serial interface module decodes the received control coding signal to obtain the serial port address code and the out-of-band control signal;
[0018] Each arbitration circuit matches the address code in the serial port control code with the configured serial port address code. If the address code in the serial port control code is consistent with the configured address code, the data path signal switch in the corresponding business serial interface module is controlled to be turned on, and the corresponding business serial port can communicate with the host computer.
[0019] Furthermore, the control code includes a start bit, several data bits, a check bit, and a stop bit; among the data bits, the low-order data is the selected communication address, and the high-order data is the out-of-band control signal bit, which is used to control the behavior of the communication terminal.
[0020] Furthermore, the out-of-band control signal output terminal of the serial interface module whose address code in the control code is consistent with the configured address code outputs the out-of-band control signal restored by the arbitration circuit; the out-of-band control signal output of the serial interface module whose address code in the control code is inconsistent with the configured address code remains in an idle state.
[0021] Furthermore, the data bits and check bits on the RTS signal line are encoded using Manchester coding.
[0022] Furthermore, the frame gap between control frames on the RTS signal line is 1000 mS, and the receiver uses the frame gap to synchronize control frame reception.
[0023] Compared with the prior art, the present invention provides a method for multiple mainboards to share serial ports and communicate with a host computer, adopts a slave arbitration mechanism, and utilizes the RTS control line of a standard asynchronous serial to realize slave serial port selection and control, and the beneficial effects achieved are as follows:
[0024] (1) No public arbitration board is required to avoid serial port communication failure when the arbitration board fails;
[0025] (2) Simple connection;
[0026] (3) Completely transparent communication can be achieved between the host computer and each main board;
[0027] (4) The address coding information is sent from the RTS signal of the host computer serial port, and the encoding and decoding is simple;
[0028] (5) Additional control signals can be sent using the RTS signal of the host computer serial port. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a schematic diagram of traditional multiple motherboards sharing one serial port to communicate with the host computer;
[0030] Figure 2 It is a schematic diagram of the communication circuit between the shared serial port and the host computer of the present invention;
[0031] Figure 3 It is a schematic diagram of the frame format of address information encoding in the present invention;
[0032] Figure 4 is a flow chart of the method of the present invention;
[0033] Figure 5It is a schematic diagram of an embodiment of the present invention;
[0034] Figure 6 4 is a waveform diagram of address information encoding on the RTS signal in an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.
[0036] like Figure 2 As shown, a communication circuit with a shared serial port is disclosed, including a public serial interface module and a plurality of service serial interface modules;
[0037] The common serial interface module is provided with a common level conversion circuit; the plurality of service serial interface modules are provided with a data path signal switch, a control signal regeneration circuit and an arbitration circuit;
[0038] The common level conversion circuit is used to convert the signal sent by each service serial port into RS-232 level and then connect it to the receiving pin of the host computer serial port; the common level conversion circuit is also used to connect the sending signal of the host computer serial port to the serial port level conversion circuit on the common communication board, convert it into TTL level and then connect it to the receiving pin of each service serial port after passing through the data path signal switch.
[0039] The data path signal switch is used to receive a signal sent by a single service serial port or a level conversion circuit; the arbitration circuit includes an address configuration input terminal, a control coding signal input terminal, a matching signal output terminal and an out-of-band control signal output terminal; the serial port address configuration input terminal is used to receive serial port address configuration information; the coding signal input terminal is used to receive the address coding signal output by the host computer serial port; the matching signal output terminal is used to output a control signal to the data path signal switch and the control signal regeneration circuit; the out-of-band control signal output terminal is used to provide a restored out-of-band control signal to the control signal regeneration circuit.
[0040] The input end of the control signal regeneration circuit is connected to the arbitration circuit, receives the out-of-band control signal output by the arbitration circuit, and provides the out-of-band control signal to the service serial port according to the result of the arbitration circuit address matching;
[0041] Furthermore, the control signal regeneration circuit regenerates the control signal from the host computer for the serial port selected by the arbitration circuit, and the control signal regeneration circuit that is not selected keeps its control signal in an idle state.
[0042] like Figure 2As shown, in the serial port bus circuit, the sending signals of each serial port are connected in parallel after passing through the data path signal switch in the business serial interface module, and the paralleled signals are connected to the receiving port of the common serial interface module; the sending port of the common serial interface module is connected to the serial port receiving end corresponding to each business serial module through the data path signal switch in each business serial interface module;
[0043] In this embodiment, the arbitration circuit is an FPGA module, which can obtain a preset address code, has an output signal connected to a data path signal switch connected to the serial port to be communicated, and can control the on and off of the signal switch; has an input signal connected to a serial port interface circuit, and can receive and decode a control coding signal sent by the host computer serial port on the RTS signal line; has a control signal output end connected to a control signal regeneration circuit, and can output the decoded and recovered out-of-band control signal from the host computer from the control signal output end to the control signal regeneration circuit.
[0044] In this embodiment, the control signal regeneration circuit is an FPGA module, which receives the out-of-band control signal output by the arbitration circuit, and provides the out-of-band control signal to the serial port to be communicated according to the matching result of the arbitration circuit.
[0045] like Figure 4 As shown, a communication method of a communication circuit sharing a serial port is disclosed, the method comprising:
[0046] The host computer sends a control coding signal to each service serial interface module through the public serial interface module via the serial port RTS signal;
[0047] The arbitration circuit of the service serial interface module decodes the received control coding signal to obtain the serial port address code and the out-of-band control signal;
[0048] Each arbitration circuit matches the decoded address code with the configured serial port address code: if the decoded address code is consistent with the configured serial port address code, the corresponding data path signal switch is turned on, the corresponding serial port communicates with the host computer, and the corresponding control signal regeneration circuit outputs the out-of-band control signal decoded by the arbitration circuit; if the decoded address code is inconsistent with the configured serial port address code, the corresponding data path signal switch is turned off, and the output of the corresponding control signal regeneration circuit remains idle. In this embodiment, the signal idle state is defined as logic 1, and the corresponding logic 0 is the valid state of the control signal.
[0049] In this method, the host computer encodes the selected serial port address information and control signal and transmits it through the serial port RTS signal. Each service serial interface module decodes and determines whether to perform serial port communication. The control information encoding includes a start bit, a number of data bits, a check bit, and a stop bit for each frame of data. In this embodiment, eight data bits are used for the convenience of description. Among the eight data bits, the lower five bits are the selected communication address, and the upper three bits are the control signal encoding, which is used to control the behavior of the communication terminal. When the data bits are transmitted, the lower bits are in front and the higher bits are in the back.
[0050] Among them, the data bits and check bits on the RTS signal line use Manchester encoding; the gap between control frames is 1000mS, and the receiver uses the frame gap to synchronize control frame reception.
[0051] This embodiment has three serial ports in total, which need to communicate with the host computer. The three serial ports are located on business board 1, business board 2, and business board 3 respectively.
[0052] like Figure 5 As shown, the address value corresponding to the serial port on the service board 1 is 1. The sending signal of the serial port 1 of the service board is connected to the serial port level conversion circuit on the communication board after passing through the data path signal switch, and is connected to the receiving pin of the host computer serial port after being converted into RS-232 level; the sending signal of the host computer serial port is connected to the serial port level conversion circuit on the communication board, and is connected to the receiving pin of the serial port of the service board 1 after being converted into TTL level through the data path signal switch. The on and off of the data path signal switch is controlled by the FPGA on the service board 1.
[0053] The address value corresponding to the serial port on the service board 2 is 2. The sending signal of the serial port 2 of the service board is connected to the serial port level conversion circuit on the communication board after passing through the data path signal switch, and is connected to the receiving pin of the host computer serial port after being converted into RS-232 level; the sending signal of the host computer serial port is connected to the serial port level conversion circuit on the communication board, and is converted into TTL level after passing through the data path signal switch and connected to the receiving pin of the serial port of the service board 2. The on and off of the data path signal switch is controlled by the FPGA on the service board 2.
[0054] The address value corresponding to the serial port on the service board 3 is 3. The sending signal of the serial port 3 of the service board is connected to the serial port level conversion circuit on the communication board after passing through the data path signal switch, and is connected to the receiving pin of the host computer serial port after being converted into RS-232 level; the sending signal of the host computer serial port is connected to the serial port level conversion circuit on the communication board, and is converted into TTL level after passing through the data path signal switch and connected to the receiving pin of the serial port of the service board 3. The on and off of the data path signal switch is controlled by the FPGA on the service board 3.
[0055] The RTS signal on the host computer serial port is connected to the serial port level conversion circuit on the communication board, converted into TTL level, and then connected to the FPGA on each board.
[0056] The specific steps to realize the communication between the three serial ports and the host computer are as follows:
[0057] Step 1: According to the serial port to be connected, the serial communication software of the host computer sends the control information code on the RTS signal. For example, if the serial port of business board 1 needs to communicate with the host computer, the data sent on the RTS signal is; ccc00001, where c is a placeholder character, representing 1 bit of control information, c=1 indicates that the corresponding control signal is idle, and c=0 indicates that the corresponding control signal is valid.
[0058] Step 2: The FPGA on each service board receives the control information code sent by the host computer on the RTS signal, and decodes and obtains the serial port address to be communicated sent by the host computer as 1.
[0059] Step 3: Business board 2 and business board 3 compare and decode the serial port address to be communicated and find that it is inconsistent with the serial port address configured on their respective boards. The data path signal switch is disconnected. Business board 1 compares and decodes the serial port address to be communicated and finds that it is consistent with the serial port address configured on the board. The data path signal switch is turned on, and the serial port of business board 1 communicates with the host computer.
[0060] Step 4: The address comparison between business board 2 and business board 3 is inconsistent, the control signal line output by the FPGA module to the serial port is in an idle state, the address comparison between business board 1 is consistent, and the control signal line output by the FPGA module to the serial port is ccc, where c is the control bit corresponding to the encoding.
[0061] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A communication circuit with a shared serial port, It is characterized in that It includes a public serial interface module and multiple business serial interface modules; the multiple business serial interface modules are connected and communicated with the serial port of the host computer through the public serial interface module; The service serial interface module is provided with a data path signal switch, a control signal regeneration circuit and an arbitration circuit; one end of the data path signal switch is connected to the serial port to be communicated, and the other end is connected to the communication transceiver port in the host computer through the public serial interface module; the input end of the control signal regeneration circuit is connected to the arbitration circuit, receives the control signal output by the arbitration circuit, and provides an out-of-band control signal to the service module according to the matching result of the arbitration circuit; The arbitration circuit of each service serial interface module includes a serial port address configuration input terminal, a coding signal input terminal, a matching signal output terminal and an out-of-band control signal output terminal; the serial port address configuration input terminal is used to receive unique serial port address configuration information; the coding signal input terminal is used to receive the control coding signal output by the host computer using the serial port RTS signal via the public serial interface module; The arbitration circuit decodes the received control coding signal and matches it with the configured unique serial port address, and outputs a signal to the data path signal switch and the control signal regeneration circuit through the matching signal output terminal according to the matching result, so as to control the on and off of the data path signal switch and the output state of the control signal regeneration circuit; The host computer uses the serial port RTS signal to send a control coding signal to each service serial interface module via the public serial interface module; The arbitration circuit of the service serial interface module decodes the received control coding signal to obtain the serial port address code and the out-of-band control signal; Each arbitration circuit matches the address code in the serial port control code with the configured serial port address code. If the address code in the serial port control code is consistent with the configured address code, the data path signal switch in the corresponding service serial interface module is controlled to be turned on, and the corresponding service serial port can communicate with the host computer; The data bits and check bits on the RTS signal line are Manchester encoded.
2. The communication circuit for sharing a serial port according to claim 1, It is characterized in that The arbitration circuit is a CPU module or an FPGA module.
3. The communication circuit of the shared serial port according to claim 1, It is characterized in that The public serial interface module is used to convert the signal sent by the business serial interface module into RS-232 level and then connect it to the serial port receiving pin of the host computer; the public serial interface module is also used to convert the RS-232 level signal sent by the host computer into TTL level and connect it to the signal switch.
4. A communication method using a communication circuit with a shared serial port as claimed in any one of claims 1 to 3, It is characterized in that The method comprises: The host computer uses the serial port RTS signal to send a control coding signal to each service serial interface module via the public serial interface module; The arbitration circuit of the service serial interface module decodes the received control coding signal to obtain the serial port address code and the out-of-band control signal; Each arbitration circuit matches the address code in the serial port control code with the configured serial port address code. If the address code in the serial port control code is consistent with the configured address code, the data path signal switch in the corresponding business serial interface module is controlled to be turned on, and the corresponding business serial port can communicate with the host computer.
5. The communication method of a communication circuit sharing a serial port according to claim 4, It is characterized in that The control code includes a start bit, several data bits, a check bit, and a stop bit; among the data bits, the low-order data is the selected communication address, and the high-order data is the out-of-band control signal bit, which is used to control the behavior of the communication terminal.
6. The communication method of a communication circuit sharing a serial port according to claim 4, It is characterized in that The serial interface module whose address code in the control code is consistent with the configured address code, has its out-of-band control signal output terminal outputting the out-of-band control signal restored by the arbitration circuit; the serial interface module whose address code in the control code is inconsistent with the configured address code, has its out-of-band control signal output remaining in an idle state.
7. The communication method of a communication circuit sharing a serial port according to claim 5, It is characterized in that The data bits and check bits on the RTS signal line are Manchester encoded.
8. The communication method of a communication circuit sharing a serial port according to claim 5, It is characterized in that The frame gap between control frames on the RTS signal line is 1000mS. The receiver uses the frame gap to synchronize control frame reception.
