Implementation method of serial server and terminal

The serial port server method addresses limited embedded device resources by expanding serial port resources through processor communication, ensuring efficient data transmission and flexible system integration.

CN119201823AActive Publication Date: 2024-12-27CONTEMPORARY NEBULA TECH ENERGY CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Embedded devices in industrial systems face limited peripheral resources, hindering the integration of multiple devices into complex systems, and existing solutions compromise system reliability and management flexibility.

Method used

A serial port server implementation method utilizing a main embedded processor and auxiliary processors to expand resources through communication, establishing serial port and TCP transceiver services with a software data transceiver mechanism, enabling efficient data transmission and remote control.

Benefits of technology

Enhances data transmission efficiency, guarantees reliability, and improves system flexibility and scalability by expanding serial port resources and simplifying connections with external systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201823A_ABST
    Figure CN119201823A_ABST
Patent Text Reader

Abstract

The invention discloses an implementation method of a serial server and a terminal, the serial server comprises a main embedded processor and at least one auxiliary embedded processor, and serial port resources of the auxiliary embedded processors are used as extended serial port resources of the main embedded processor through communication between the embedded processors; establishing a serial port transceiving service and a TCP transceiving service for each serial port resource; establishing mapping between the serial port transceiving service and the TCP transceiving service for each serial port resource through a software data transceiving processing mechanism; according to the invention, expansion of limited serial port resources is realized through communication between embedded processors, TCP services are established according to the serial port resources, serial port communication and TCP communication are mapped one by one, and the connection mode between various serial port communication devices and an EMS or other systems is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication transmission technology, and in particular to an implementation method and a terminal of a serial port server. Background Art

[0002] With the rapid development of the Internet of Things, embedded devices have been widely used in industrial production, especially in the field of energy storage systems, which require the connection of a large number of devices to integrate into complex systems. The integration requirements for embedded devices are getting higher and higher. The resources of a single embedded device are limited and cannot meet the needs of more devices to form a system at the same time.

[0003] The existing solutions use resource reuse solutions that reduce system reliability. At the same time, EMS or other systems and hardware devices need to be connected through various middleware, which is not conducive to unified management. Therefore, how to solve the problem that the peripheral resources of embedded chips are limited and cannot meet the needs of integrating a large number of devices to form a complex system and improve the convenience and flexibility of system management are the current problems to be solved. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method for realizing a serial port server, solve the problem of limited peripheral resources of embedded chips, and simplify the connection mode and control mode of serial port communication equipment and external systems.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is: A method for implementing a serial port server, wherein the serial port server includes a main embedded processor and at least one auxiliary embedded processor, comprising the steps of: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors; S2, respectively establish a serial port transceiver service and a 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.

[0006] In order to solve the above technical problems, another technical solution adopted by the present invention is: A serial port server implementation terminal 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, the following steps are implemented: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors; S2, respectively establish a serial port transceiver service and a 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.

[0007] The beneficial effects of the present invention are: providing an implementation terminal of a serial port server, expanding limited serial port resources through communication between embedded processors, establishing TCP services based on serial port resources, mapping serial port communication to TCP communication one by one, and simplifying the connection method between various serial port communication devices and EMS or other systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] Figure 1 A flowchart of a method for implementing a serial port server according to an embodiment of the present invention; Figure 2 A structural diagram of a terminal for implementing a serial port server according to an embodiment of the present invention; Figure 3 A schematic diagram of a system framework of a serial port server according to an embodiment of the present invention; Figure 4 A communication mapping schematic diagram of a method for implementing a serial port server according to an embodiment of the present invention; Figure 5 A schematic diagram of configuration information of serial port parameters of a method for implementing a serial port server according to an embodiment of the present invention; Description of labels: 1. A serial port server implementation terminal; 2. A processor; 3. A memory. DETAILED DESCRIPTION

[0009] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0010] 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 steps of: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors; S2, respectively establish a serial port transceiver service and a 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.

[0011] From the above description, it can be seen that the beneficial effects of the present invention are: providing an implementation terminal of a serial port server, expanding limited serial port resources through communication between embedded processors, establishing TCP services based on serial port resources, mapping serial port communication and TCP communication one by one, and simplifying the connection method between various serial port communication devices and EMS or other systems.

[0012] Furthermore, step S3 is specifically as follows: After receiving the data from the physical serial port, the serial port transceiver service saves it into the corresponding TCP sending ring queue. At the same time, the TCP transceiver service detects in real time whether there is data to be sent in all TCP sending ring queues. If so, the data to be sent is sent by the corresponding TCP port service. After receiving the data from the TCP port service, the TCP transceiver service saves it into the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether all TCP receive ring queues have data to be received. If so, the data to be received is sent to the corresponding physical serial port.

[0013] From the above description, it can be seen that through the collaborative work of the serial port transceiver service and the TCP transceiver service, data transmission between the physical serial port and the TCP port is realized, the data transmission efficiency is improved, the data reliability is guaranteed, and the flexibility and scalability of the system are enhanced.

[0014] Furthermore, after step S3, the following steps are further included: S4. Control the IO port input and output through network communication and read the dry node status information.

[0015] From the above description, it can be seen that the input and output of the IO port can be remotely controlled through network communication, which is convenient for integration with other intelligent systems to meet various scenarios; at the same time, the dry node status information can be read in real time to make quick decisions and respond to faults.

[0016] Furthermore, step S4 is specifically as follows: The Modbus-TCP client reads the real-time status of the serial port server's dry node input through the Modbus protocol's read register, and controls the serial port server's relay output through the Modbus protocol's read and write register; The Modbus-TCP client configures the serial port communication parameters of the serial port server through the write register of the Modbus protocol. The communication parameters include baud rate, check bit, data bit and stop bit.

[0017] From the above description, we can see that the Modbus-TCP client uses the Modbus protocol to read the real-time status of the serial port server dry node input and control the relay output, realizing remote and efficient control and status monitoring, and improving the flexibility, convenience and maintainability of the system; at the same time, the serial port communication parameters can be configured according to specific communication requirements to ensure compatibility and efficient communication with different devices.

[0018] Furthermore, the communication method between the embedded processors in step S1 includes SPI communication and USB communication.

[0019] From the above description, it can be seen that the use of SPI communication or USB communication between embedded processors has the beneficial effects of high-speed data transmission, simple hardware connection, full-duplex communication, flexible configuration, wide compatibility, plug and play, high-speed data transmission and power supply functions, etc., which provides strong support for the design and application of embedded systems.

[0020] Please refer to Figure 2 , a serial port server implementation terminal, 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, wherein the processor implements the following steps when executing the embedded program: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors; S2, respectively establish a serial port transceiver service and a 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.

[0021] From the above description, it can be seen that the beneficial effects of the present invention are: providing an implementation terminal of a serial port server, expanding limited serial port resources through communication between embedded processors, establishing TCP services based on serial port resources, mapping serial port communication and TCP communication one by one, and simplifying the connection method between various serial port communication devices and EMS or other systems.

[0022] Furthermore, step S3 is specifically as follows: After receiving the data from the physical serial port, the serial port transceiver service saves it into the corresponding TCP sending ring queue. At the same time, the TCP transceiver service detects in real time whether there is data to be sent in all TCP sending ring queues. If so, the data to be sent is sent by the corresponding TCP port service. After receiving the data from the TCP port service, the TCP transceiver service saves it into the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether all TCP receive ring queues have data to be received. If so, the data to be received is sent to the corresponding physical serial port.

[0023] From the above description, it can be seen that through the collaborative work of the serial port transceiver service and the TCP transceiver service, data transmission between the physical serial port and the TCP port is realized, the data transmission efficiency is improved, the data reliability is guaranteed, and the flexibility and scalability of the system are enhanced.

[0024] Furthermore, after step S3, the following steps are further included: S4. Control the IO port input and output through network communication and read the dry node status information.

[0025] From the above description, it can be seen that the input and output of the IO port can be remotely controlled through network communication, which is convenient for integration with other intelligent systems to meet various scenarios; at the same time, the dry node status information can be read in real time to make quick decisions and respond to faults.

[0026] Furthermore, step S4 is specifically as follows: The Modbus-TCP client reads the real-time status of the serial port server's dry node input through the Modbus protocol's read register, and controls the serial port server's relay output through the Modbus protocol's read and write register; The Modbus-TCP client configures the serial port communication parameters of the serial port server through the write register of the Modbus protocol. The communication parameters include baud rate, check bit, data bit and stop bit.

[0027] From the above description, we can see that the Modbus-TCP client uses the Modbus protocol to read the real-time status of the serial port server dry node input and control the relay output, realizing remote and efficient control and status monitoring, and improving the flexibility, convenience and maintainability of the system; at the same time, the serial port communication parameters can be configured according to specific communication requirements to ensure compatibility and efficient communication with different devices.

[0028] Furthermore, the communication method between the embedded processors in step S1 includes SPI communication and USB communication.

[0029] From the above description, it can be seen that the use of SPI communication or USB communication between embedded processors has the beneficial effects of high-speed data transmission, simple hardware connection, full-duplex communication, flexible configuration, wide compatibility, plug and play, high-speed data transmission and power supply functions, etc., which provides strong support for the design and application of embedded systems.

[0030] The present invention provides a method for implementing a serial port server and a terminal, which are suitable for expanding chip peripheral resources and satisfying the needs of integrating multiple devices to form a complex system.

[0031] Please refer to Figure 1 and Figure 3 , Embodiment 1 of the present invention is: A method for implementing a serial port server, wherein the serial port server includes a main embedded processor and at least one auxiliary embedded processor, comprising the steps of: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors.

[0032] 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 two chips are not limited to Linux chips and ARM chips.

[0033] Among them, the ARM chip uses the Cortex-M7 core series chip 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.

[0034] In this embodiment, SPI communication or USB communication is adopted between the ARM chip and the Linux chip, and the ARM chip is designed as a part of the Linux chip expansion resources. For Linux users, it presents the same serial port properties as the Linux chip's own resources.

[0035] Among them, the 9-channel serial port resources of the ARM chip and the 7-channel serial port resources of the Linux chip constitute 16-channel serial port resources for unified external use. The 16-channel serial port resources have the same communication performance requirements and meet the connection requirements of various devices using serial port communication (such as devices using Modbus-RTU protocol).

[0036] S2, respectively establish a serial port transceiver service and a 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.

[0037] Please refer to Figure 1 , Figure 3 and Figure 4 , Embodiment 2 of the present invention is: A method for implementing a serial port server, based on the first embodiment, step S3 is specifically: After receiving the data from the physical serial port, the serial port transceiver service saves it into the corresponding TCP sending ring queue. At the same time, the TCP transceiver service detects in real time whether there is data to be sent in all TCP sending ring queues. If so, the data to be sent is sent by the corresponding TCP port service. After receiving the data from the TCP port service, the TCP transceiver service saves it into the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether all TCP receive ring queues have data to be received. If so, the data to be received is sent to the corresponding physical serial port.

[0038] In this embodiment, the serial port server uses 16 TCP services (named TCP1~16), which are mapped to 16 serial ports (expressed as one IP address and 16 port numbers). The serial port server serves as a TCP server, and the EMS system serves as a 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.

[0039] Among them, 16 TCP services are TCP Server services with 16 different port numbers, which are network resources of Linux chips; 16 serial ports are serial port resources of Linux chips. The two do not interfere with each other in hardware. TCP and serial port mapping is through the software data receiving and sending processing mechanism, which makes it appear as TCP-serial port one-to-one mapping to the outside world; the specific software mapping relationship is as follows: Figure 4 After the serial port transceiver service receives data from a physical serial port, it saves it to the corresponding TCP send ring queue. The TCP transceiver service detects in real time whether there is data to be sent in the 16 TCP send ring queues. If so, the data is sent out from the corresponding TCP port service. After the TCP transceiver service receives data from a TCP port service, it saves it to the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether there is data in the 16 TCP receive ring queues. If so, the data is sent to the corresponding physical serial port.

[0040] Step S3 further includes the following steps: S4. Control the IO port input and output through network communication and read the dry node status information.

[0041] Step S4 is specifically as follows: The Modbus-TCP client reads the real-time status of the serial port server's dry node input through the Modbus protocol's read register, and controls the serial port server's relay output through the Modbus protocol's read and write register; The Modbus-TCP client configures the serial port communication parameters of the serial port server through the write register of the Modbus protocol. The communication parameters include baud rate, check bit, data bit and stop bit.

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

[0043] 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; among them, the 16 relay outputs and 32 input dry nodes are provided by the Linux chip, and the 16 serial ports are composed of 9 serial port resources of the ARM chip and 7 serial port resources of the Linux chip.

[0044] As shown in Table 1 and Table 2, 32 DI input states use 32 read-only registers. A value of 0 indicates that the DIx input is at a low level, and a value of 1 indicates that the DIx input is at a high level. The serial port server reads the 32 input dry contact status information in real time and writes it into the read-only registers. 16 DO outputs use 16 read-write registers. Writing a value of 0 controls the DOx relay to be disconnected, and writing a value of 1 controls the DOx relay to be closed (the value range of x is 1 to the number of registers). 16 serial ports use 16 groups of read-write registers to configure serial port parameters. 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 read-write register.

[0045] Table 1:

[0046] Table 2:

[0047] like Figure 5 As shown, in this embodiment, the configuration parameter generates a configuration file exiocfg and is stored in the Linux system. You can also log in to the configuration file of the Linux system to directly modify the configuration information. The content of the configuration file is as follows (the file content has no fixed format, and it can represent the configuration information): The first line shows the software version number and file update time; the second line "modbus-tcp-port=502" shows that the port number of the Modbus-TCP connection is 502; the third line is the configuration information format; the fourth line "UART1=[9600 N 8 16001]" shows the serial port configuration parameters, where UART1 is the serial port name and has no value range; 9600 is the baud rate and the value range is the baud rate supported by the protocol file; N is the parity bit, N means no parity, 0 means odd parity, and E means even parity; 8 is the data bit and the value range is {5,6,7,8}; 1 is the stop bit and the value range is {1,2}; 6001 is the port number mapped to TCP and the value is greater than 0 and is not repeated for each serial port.

[0048] Please refer to Figure 2 , Embodiment 3 of the present invention is: 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, the steps in the implementation method of a serial port server described in the first or second embodiment above are implemented.

[0049] In summary, the implementation terminal of a serial port server provided by the present invention expands limited serial port resources through communication between embedded processors, establishes TCP services according to serial port resources, maps serial port communication to TCP communication one by one, simplifies the connection method between various serial port communication devices and EMS or other systems, and achieves the control of IO port input and output and reading of dry node status information through network communication.

[0050] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in 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: Includes steps: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors; S2, respectively establish a serial port transceiver service and a TCP transceiver service for each of the serial port resources; S3, establishing 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 specifically as follows: After receiving the data from the physical serial port, the serial port transceiver service saves it into the corresponding TCP sending ring queue. At the same time, the TCP transceiver service detects in real time whether there is data to be sent in all TCP sending ring queues. If so, the data to be sent is sent by the corresponding TCP port service. After receiving the data from the TCP port service, the TCP transceiver service saves it into the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether all TCP receive ring queues have data to be received. If so, the data to be received is sent to the corresponding physical serial port.

2. The implementation method of a serial port server according to claim 1, characterized in that: After step S3, the method further includes: S4. Control the IO port input and output through network communication and read the dry node status information.

3. The implementation method of a serial port server according to claim 2, characterized in that: Step S4 is specifically as follows: The Modbus-TCP client reads the real-time status of the serial port server's dry node input through the Modbus protocol's read register, and controls the serial port server's relay output through the Modbus protocol's read and write register; The Modbus-TCP client configures the serial port communication parameters of the serial port server through the write register of the Modbus protocol. The communication parameters include baud rate, check bit, data bit and stop bit.

4. The implementation method of a serial port server according to claim 1, characterized in that: The communication method between the embedded processors in step S1 includes SPI communication and USB communication.

5. A serial port server implementation terminal, 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, the following steps are implemented: S1. Using the serial port resources of the auxiliary embedded processor as the extended serial port resources of the main embedded processor through communication between embedded processors; S2, respectively establish a serial port transceiver service and a TCP transceiver service for each of the serial port resources; S3, establishing 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 specifically as follows: After receiving the data from the physical serial port, the serial port transceiver service saves it into the corresponding TCP sending ring queue. At the same time, the TCP transceiver service detects in real time whether there is data to be sent in all TCP sending ring queues. If so, the data to be sent is sent by the corresponding TCP port service. After receiving the data from the TCP port service, the TCP transceiver service saves it into the corresponding TCP receive ring queue. The serial port transceiver service detects in real time whether all TCP receive ring queues have data to be received. If so, the data to be received is sent to the corresponding physical serial port.

6. The implementation terminal of a serial port server according to claim 5, characterized in that: After step S3, the method further includes: S4. Control the IO port input and output through network communication and read the dry node status information.

7. A serial port server implementation terminal according to claim 6, characterized in that: Step S4 is specifically as follows: The Modbus-TCP client reads the real-time status of the serial port server's dry node input through the Modbus protocol's read register, and controls the serial port server's relay output through the Modbus protocol's read and write register; The Modbus-TCP client configures the serial port communication parameters of the serial port server through the write register of the Modbus protocol. The communication parameters include baud rate, check bit, data bit and stop bit.

8. The implementation terminal of a serial port server according to claim 5, characterized in that: The communication between the embedded processors in step S1 includes SPI communication and USB communication.

Citation Information

Patent Citations

  • Information real-time interaction terminal based on embedded system

    CN110196830A

  • Multi-serial-port server system with redundancy main / standby and load balancing functions

    CN113347280A

  • Serial port server and implementation method of serial port server

    CN113419983A

  • Communication method for mixed connection of different serial port protocols

    CN115913825A

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

    CN118199812A