Implementation method of serial port server and terminal

By expanding serial port resources through communication between embedded processors and establishing TCP service mapping, the problem of limited embedded chip resources is solved, and efficient expansion of serial communication and flexible system management are achieved.

CN119201823BActive Publication Date: 2026-02-24CONTEMPORARY NEBULA TECH ENERGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411709155.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2026-02-24
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

Embedded chip peripheral resources are limited and cannot meet the needs of integrating a large number of devices into a complex system. Furthermore, existing resource reuse schemes reduce system reliability and management convenience.

Method used

By communicating between the main embedded processor and the auxiliary embedded processor, the serial port resources of the auxiliary processor are extended to the resources of the main processor, and serial port transceiver services and TCP transceiver services are established to realize the mapping between serial port and TCP communication.

Benefits of technology

It expands the limited serial port resources, simplifies the connection between serial communication devices and EMS or other systems, improves data transmission efficiency and system flexibility and scalability, and supports remote IO port control and status monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201823B_ABST
    Figure CN119201823B_ABST
Patent Text Reader

Abstract

The application discloses a kind of implementation method and terminal of serial port server, the serial port server includes one main embedded processor and at least one auxiliary embedded processor, by the communication between embedded processors, the serial port resource of the auxiliary embedded processor is as the serial port resource of the main embedded processor extension;For each serial port resource, respectively establish serial port transceiver service and TCP transceiver service;Through software data transceiver processing mechanism, mapping is established between the serial port transceiver service and the TCP transceiver service for each serial port resource;Realize the expansion of limited serial port resource through the communication between embedded processors, and according to serial port resource, TCP service is established, serial port communication and TCP communication are one-to-one mapping, and the connection mode of various serial port communication equipment and EMS or other systems is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication transmission technology, and in particular to a method for implementing a serial port server and a terminal thereof. Background Technology

[0002] With the rapid development of the Internet of Things, embedded devices are widely used in industrial production. In particular, the field of energy storage systems requires the integration of a large number of devices into complex systems, which places increasingly higher demands on the integration of embedded devices. The limited resources of a single embedded device cannot meet the needs of more devices forming a system at the same time.

[0003] Existing solutions employing resource reuse schemes reduce system reliability. Furthermore, EMS or other systems and hardware devices require connections through various middleware, hindering unified management. Therefore, addressing the issue of limited embedded chip peripheral resources preventing the integration of numerous devices into complex systems, and improving the convenience and flexibility of system management, are the current challenges. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method for implementing a serial port server, which solves the problem of limited peripheral resources of embedded chips and simplifies the connection and control methods between serial communication devices and external systems.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0006] A method for implementing a serial port server, the serial port server comprising a main embedded processor and at least one auxiliary embedded processor, comprising the following steps:

[0007] S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as the serial port resources extended by the main embedded processor;

[0008] S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources;

[0009] S3. A mapping is established between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism.

[0010] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:

[0011] A terminal for implementing a serial port server includes a main embedded processor and at least one auxiliary embedded processor, a memory, and an embedded program stored in the memory and executable on the processor. When the processor executes the embedded program, it performs the following steps:

[0012] S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as the serial port resources extended by the main embedded processor;

[0013] S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources;

[0014] S3. A mapping is established between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism.

[0015] The beneficial effects of this invention are as follows: It provides a terminal for implementing a serial port server, which expands the limited serial port resources through communication between embedded processors, and establishes TCP services based on the serial port resources, mapping serial port communication to TCP communication one by one, thus simplifying the connection method between various serial port communication devices and EMS or other systems. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating an implementation method of a serial port server according to an embodiment of the present invention;

[0017] Figure 2 This is a structural diagram of a terminal implementing a serial port server according to an embodiment of the present invention;

[0018] Figure 3 This is a schematic diagram of the system framework of a serial port server according to an embodiment of the present invention;

[0019] Figure 4 This is a communication mapping diagram of an implementation method of a serial port server according to an embodiment of the present invention;

[0020] Figure 5 This is a schematic diagram illustrating the configuration information of serial port parameters in an implementation method of a serial port server according to an embodiment of the present invention.

[0021] Label Explanation:

[0022] 1. A terminal for implementing a serial port server; 2. A processor; 3. A memory. Detailed Implementation

[0023] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.

[0024] Please refer to Figure 1 A method for implementing a serial port server, the serial port server comprising a main embedded processor and at least one auxiliary embedded processor, comprising the following steps:

[0025] S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as the serial port resources extended by the main embedded processor;

[0026] S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources;

[0027] S3. A mapping is established between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism.

[0028] As can be seen from the above description, the beneficial effects of the present invention are as follows: it provides a terminal for implementing a serial port server, which expands the limited serial port resources through communication between embedded processors, and establishes TCP services based on the serial port resources, mapping serial port communication to TCP communication one by one, thus simplifying the connection method between various serial port communication devices and EMS or other systems.

[0029] Furthermore, step S3 specifically includes:

[0030] After receiving data from the physical serial port, the serial port transceiver service saves it to the corresponding TCP send ring queue. At the same time, the TCP transceiver service monitors in real time whether there is data to be sent in all TCP send ring queues. If there is, the data to be sent is sent by the corresponding TCP port service.

[0031] After receiving data from the TCP port service, the TCP transceiver service saves it to the corresponding TCP receive circular queue. The serial port transceiver service detects in real time whether there is data to be received in all TCP receive circular queues. If so, the data to be received is sent to the corresponding physical serial port.

[0032] As described above, the collaborative work of the serial port transceiver service and the TCP transceiver service enables data transmission between the physical serial port and the TCP port, improving data transmission efficiency, ensuring data reliability, and enhancing the system's flexibility and scalability.

[0033] Furthermore, step S3 includes the following:

[0034] S4. Control the input and output of the IO port and read the status information of the dry node through network communication.

[0035] As described above, network communication enables remote input / output control of I / O ports, facilitating integration with other intelligent systems and meeting various scenarios. Simultaneously, it allows for real-time reading of node status information, enabling rapid decision-making and fault response.

[0036] Furthermore, step S4 specifically includes:

[0037] The Modbus-TCP client reads the real-time status of the dry node input of the serial port server through the Modbus protocol's read register, and controls the relay output of the serial port server through the Modbus protocol's read and write register.

[0038] The Modbus-TCP client configures the serial communication parameters of the serial server through the Modbus protocol's write register. These communication parameters include baud rate, parity bit, data bits, and stop bits.

[0039] As described above, the Modbus-TCP client uses the Modbus protocol to read the real-time status of the serial port server's trunk node input and control the relay output, realizing remote and efficient control and status monitoring, and improving the system's flexibility, convenience, and maintainability. At the same time, serial communication parameters can be configured according to specific communication needs to ensure compatibility and efficient communication with different devices.

[0040] Furthermore, the communication methods between embedded processors in step S1 include SPI communication and USB communication.

[0041] As described above, the use of SPI or USB communication between embedded processors offers advantages such as high-speed data transmission, simple hardware connections, full-duplex communication, flexible configuration, broad compatibility, plug-and-play functionality, and power supply capabilities, providing strong support for the design and application of embedded systems.

[0042] Please refer to Figure 2 A terminal for implementing a serial port server includes a main embedded processor and at least one auxiliary embedded processor, a memory, and an embedded program stored in the memory and executable on the processor. When the processor executes the embedded program, it performs the following steps:

[0043] S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as the serial port resources extended by the main embedded processor;

[0044] S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources;

[0045] S3. A mapping is established between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism.

[0046] As can be seen from the above description, the beneficial effects of the present invention are as follows: it provides a terminal for implementing a serial port server, which expands the limited serial port resources through communication between embedded processors, and establishes TCP services based on the serial port resources, mapping serial port communication to TCP communication one by one, thus simplifying the connection method between various serial port communication devices and EMS or other systems.

[0047] Furthermore, step S3 specifically includes:

[0048] After receiving data from the physical serial port, the serial port transceiver service saves it to the corresponding TCP send ring queue. At the same time, the TCP transceiver service monitors in real time whether there is data to be sent in all TCP send ring queues. If there is, the data to be sent is sent by the corresponding TCP port service.

[0049] After receiving data from the TCP port service, the TCP transceiver service saves it to the corresponding TCP receive circular queue. The serial port transceiver service detects in real time whether there is data to be received in all TCP receive circular queues. If so, the data to be received is sent to the corresponding physical serial port.

[0050] As described above, the collaborative work of the serial port transceiver service and the TCP transceiver service enables data transmission between the physical serial port and the TCP port, improving data transmission efficiency, ensuring data reliability, and enhancing the system's flexibility and scalability.

[0051] Furthermore, step S3 includes the following:

[0052] S4. Control the input and output of the IO port and read the status information of the dry node through network communication.

[0053] As described above, network communication enables remote input / output control of I / O ports, facilitating integration with other intelligent systems and meeting various scenarios. Simultaneously, it allows for real-time reading of node status information, enabling rapid decision-making and fault response.

[0054] Furthermore, step S4 specifically includes:

[0055] The Modbus-TCP client reads the real-time status of the dry node input of the serial port server through the Modbus protocol's read register, and controls the relay output of the serial port server through the Modbus protocol's read and write register.

[0056] The Modbus-TCP client configures the serial communication parameters of the serial server through the Modbus protocol's write register. These communication parameters include baud rate, parity bit, data bits, and stop bits.

[0057] As described above, the Modbus-TCP client uses the Modbus protocol to read the real-time status of the serial port server's trunk node input and control the relay output, realizing remote and efficient control and status monitoring, and improving the system's flexibility, convenience, and maintainability. At the same time, serial communication parameters can be configured according to specific communication needs to ensure compatibility and efficient communication with different devices.

[0058] Furthermore, the communication methods between embedded processors in step S1 include SPI communication and USB communication.

[0059] As described above, the use of SPI or USB communication between embedded processors offers advantages such as high-speed data transmission, simple hardware connections, full-duplex communication, flexible configuration, broad compatibility, plug-and-play functionality, and power supply capabilities, providing strong support for the design and application of embedded systems.

[0060] The present invention provides a method and terminal for implementing a serial port server, which is suitable for expanding chip peripheral resources and meeting the needs of multi-device integration into complex systems.

[0061] Please refer to Figure 1 and Figure 3 Embodiment 1 of the present invention is as follows:

[0062] A method for implementing a serial port server, the serial port server comprising a main embedded processor and at least one auxiliary embedded processor, comprising the following steps:

[0063] S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as the serial port resources extended by the main embedded processor.

[0064] In this embodiment, a Linux chip is used as the main embedded processor and an ARM chip is used as the auxiliary embedded processor. In other equivalent embodiments, the choice of Linux chip and ARM chip is not limited to these two types.

[0065] The ARM chip uses the Cortex-M7 core series to meet the high-performance communication requirements and has 9 serial port resources; the Linux chip mainly includes network port resources, 7 serial port resources, 32 GPIOs for input dry node resources, and 16 GPIOs for relay output resources.

[0066] In this embodiment, the ARM chip and the Linux chip communicate via SPI or USB, and the ARM chip is designed as part of the Linux chip's extended resources. For Linux users, it appears to have the same serial port attributes as the Linux chip's built-in resources.

[0067] The ARM chip's 9 serial port resources and the Linux chip's 7 serial port resources together form a unified 16-channel serial port resource for external use. These 16-channel serial port resources have the same communication performance requirements, meeting the connection requirements of various devices that use serial communication (such as devices using the Modbus-RTU protocol).

[0068] S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources;

[0069] S3. A mapping is established between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism.

[0070] Please refer to Figure 1 , Figure 3 and Figure 4 Embodiment two of the present invention is as follows:

[0071] A method for implementing a serial port server, based on Embodiment 1, specifically includes step S3 as follows:

[0072] After receiving data from the physical serial port, the serial port transceiver service saves it to the corresponding TCP send ring queue. At the same time, the TCP transceiver service monitors in real time whether there is data to be sent in all TCP send ring queues. If there is, the data to be sent is sent by the corresponding TCP port service.

[0073] After receiving data from the TCP port service, the TCP transceiver service saves it to the corresponding TCP receive circular queue. The serial port transceiver service detects in real time whether there is data to be received in all TCP receive circular queues. If so, the data to be received is sent to the corresponding physical serial port.

[0074] In this embodiment, the serial port server uses 16 TCP services (named TCP1~16), which are mapped to 16 serial ports (represented as one IP address and 16 port numbers). The serial port server acts as the TCP server, and the EMS system acts as the TCP client to connect to the serial port server. In other equivalent embodiments, different numbers of TCP services are selected according to different numbers of serial port resources, and are not limited to the number of TCP services used in this embodiment.

[0075] Among them, the 16 TCP services are 16 TCP Server services with different port numbers, which are network resources of the Linux chip; the 16 serial ports use the serial port resources of the Linux chip. Hardware-wise, the two do not interfere with each other. The TCP-serial port mapping is achieved through a software data transmission and reception mechanism, making it appear as a one-to-one TCP-serial port mapping to the outside world. The specific software mapping relationship is as follows: Figure 4After receiving data from a physical serial port, the serial port transceiver service saves it to the corresponding TCP send circular queue. The TCP transceiver service monitors the 16 TCP send circular queues in real time to see if there is data to be sent. If so, it sends the data out from the corresponding TCP port. After receiving data from a TCP port, the serial port transceiver service saves it to the corresponding TCP receive circular queue. The serial port transceiver service monitors the 16 TCP receive circular queues in real time to see if there is data. If so, it sends the data to the corresponding physical serial port.

[0076] Step S3 is followed by the following steps:

[0077] S4. Control the input and output of the IO port and read the status information of the dry node through network communication.

[0078] Step S4 is as follows:

[0079] The Modbus-TCP client reads the real-time status of the dry node input of the serial port server through the Modbus protocol's read register, and controls the relay output of the serial port server through the Modbus protocol's read and write register.

[0080] The Modbus-TCP client configures the serial communication parameters of the serial server through the Modbus protocol's write register. These communication parameters include baud rate, parity bit, data bits, and stop bits.

[0081] In this embodiment, the serial port server is a Modbus-TCP server, and the EMS or other systems are Modbus-TCP clients.

[0082] In this embodiment, the 16 serial ports are named UART1~16, the 16 relay outputs are named DO1~16, and the 32 input dry nodes are named DI1~32. The 16 relay outputs and 32 input dry nodes are provided by the Linux chip, and the 16 serial ports are composed of the 9 serial port resources of the ARM chip and the 7 serial port resources of the Linux chip.

[0083] As shown in Tables 1 and 2, the 32 DI inputs use 32 read-only registers. A value of 0 indicates that the DIx input is low, and a value of 1 indicates that the DIx input is high. The serial server reads the status information of the 32 input dry contacts in real time and writes it into the read-only registers. The 16 DO outputs use 16 read-write registers. Writing a value of 0 controls the DOx relay to open, and writing a value of 1 controls the DOx relay to close (x ranges from 1 to the number of registers). The 16 serial ports use 16 sets of read-write registers to configure serial port parameters. The 16 TCP services use 16 read-write registers to configure their port numbers, and the port numbers cannot be repeated. The Modbus-TCP communication port number can be modified through a single read-write register.

[0084] Table 1:

[0085]

[0086] Table 2:

[0087]

[0088] like Figure 5 As shown, in this embodiment, the configuration parameter generation configuration file exiocfg is stored in the Linux system. Alternatively, the configuration information can be directly modified by logging into the Linux system's configuration file. The configuration file content is as follows (the file content has no fixed format; it only needs to represent the configuration information):

[0089] The first line displays the software version number and file update time; the second line, "modbus-tcp-port=502", indicates that the Modbus-TCP connection port number is 502; the third line is the configuration information format; the fourth line, "UART1=[9600 N 8 16001]", displays the serial port configuration parameters, where UART1 is the serial port name with no value range; 9600 is the baud rate, with a value range of the baud rates supported by the protocol file; N is the parity bit, where N indicates no parity, 0 indicates odd parity, and E indicates even parity; 8 are the data bits, with a value range of {5, 6, 7, 8}; 1 is the stop bit, with a value range of {1, 2}; and 6001 is the port number mapped to TCP, with a value greater than 0 and no repetition across serial ports.

[0090] Please refer to Figure 2 Embodiment 3 of the present invention is as follows:

[0091] A serial port server implementation terminal 1 includes a main embedded processor 2 and at least one auxiliary embedded processor 2, a memory 3, and an embedded program stored in the memory 3 and executable on the processor 2. When the processor 2 executes the embedded program, it implements the steps in the serial port server implementation method described in Embodiment 1 or 2 above.

[0092] In summary, the serial port server implementation terminal provided by this invention expands the limited serial port resources through communication between embedded processors, and establishes TCP services based on the serial port resources, mapping serial communication to TCP communication one-to-one. This simplifies the connection method between various serial communication devices and EMS or other systems, and enables control of IO port input / output and reading of node status information through network communication.

[0093] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for implementing a serial port server, the serial port server comprising a main embedded processor and at least one auxiliary embedded processor, characterized in that, Including the following steps: S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as serial port resources extended by the main embedded processor, so that the serial port resources of the main embedded processor and the auxiliary embedded processor have the same serial port attributes and communication performance requirements, and are used externally in a unified manner; the communication methods between the embedded processors in step S1 include SPI communication and USB communication. The main embedded processor includes 7 serial port resources, and the auxiliary embedded processor includes 9 serial port resources; the main embedded processor and the auxiliary embedded processor together form 16 serial port resources for unified external use. These 16 serial port resources have the same communication performance requirements and meet the connection requirements of various devices that use serial communication. S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources; S3. Establish a mapping between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism. Step S3 is as follows: After receiving data from the physical serial port, the serial port transceiver service saves it to the corresponding TCP send ring queue. At the same time, the TCP transceiver service monitors in real time whether there is data to be sent in all TCP send ring queues. If there is, the data to be sent is sent by the corresponding TCP port service. After receiving data from the TCP port service, the TCP transceiver service saves it to the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether there is data to be received in all TCP receive ring queues. If there is, the data to be received is sent to the corresponding physical serial port. Each of the serial port resources corresponds to a TCP send ring queue and a TCP receive ring queue; S4. Control the reading of the input status information of the I / O port in the main embedded processor and control the output of the I / O port through network communication; Step S4 is as follows: The serial port server acts as a Modbus-TCP server. The Modbus-TCP client reads the real-time status of the dry node input of the serial port server through the Modbus protocol's read register, and controls the relay output of the serial port server through the Modbus protocol's read and write register. The Modbus-TCP client configures the serial communication parameters of the serial server through the Modbus protocol's write register. These communication parameters include baud rate, parity bit, data bits, and stop bits.

2. A terminal for implementing a serial port server, comprising a main embedded processor and at least one auxiliary embedded processor, a memory, and an embedded program stored in the memory and executable on the processor, characterized in that, When the processor executes the embedded program, it performs the following steps: S1. Through communication between embedded processors, the serial port resources of the auxiliary embedded processor are used as serial port resources extended by the main embedded processor, so that the serial port resources of the main embedded processor and the auxiliary embedded processor have the same serial port attributes and communication performance requirements, and are used externally in a unified manner; the communication methods between the embedded processors in step S1 include SPI communication and USB communication. The main embedded processor includes 7 serial port resources, and the auxiliary embedded processor includes 9 serial port resources; the main embedded processor and the auxiliary embedded processor together form 16 serial port resources for unified external use. These 16 serial port resources have the same communication performance requirements and meet the connection requirements of various devices that use serial communication. S2. Establish serial port transceiver service and TCP transceiver service for each of the serial port resources; S3. Establish a mapping between the serial port transceiver service and the TCP transceiver service for each serial port resource through a software data transceiver processing mechanism. Step S3 is as follows: After receiving data from the physical serial port, the serial port transceiver service saves it to the corresponding TCP send ring queue. At the same time, the TCP transceiver service monitors in real time whether there is data to be sent in all TCP send ring queues. If there is, the data to be sent is sent by the corresponding TCP port service. After receiving data from the TCP port service, the TCP transceiver service saves it to the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether there is data to be received in all TCP receive ring queues. If there is, the data to be received is sent to the corresponding physical serial port. Each of the serial port resources corresponds to a TCP send ring queue and a TCP receive ring queue; S4. Control the reading of the input status information of the I / O port in the main embedded processor and control the output of the I / O port through network communication; Step S4 is as follows: The serial port server acts as a Modbus-TCP server. The Modbus-TCP client reads the real-time status of the dry node input of the serial port server through the Modbus protocol's read register, and controls the relay output of the serial port server through the Modbus protocol's read and write register. The Modbus-TCP client configures the serial communication parameters of the serial server through the Modbus protocol's write register. These communication parameters include baud rate, parity bit, data bits, and stop bits.

Citation Information

Patent Citations

  • Serial port server and implementation method of serial port server

    CN113419983A

  • Communication method, terminal, device, equipment and computer readable storage medium

    CN118199812A

  • Field bus communication adapter with configurable characteristic

    CN1791103A

  • Flight control computer based on PowerPC + FPGA + ARM framework

    CN211956181U