Ethernet switch and data transmission method
By integrating the central processing unit, switching processing module, and data processing module of the Ethernet switch, direct data transmission between Ethernet and serial interfaces is supported, solving the problems of numerous device types and high maintenance costs, and realizing long-distance transmission of serial data in Ethernet.
Patent Information
- Application Number
- CN202211126716.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-09-16
AI Technical Summary
In existing technologies, remote data acquisition in the industrial, mining, and transportation sectors requires uploading data via RS-485/RS232 serial interfaces, which presents problems such as a large variety and number of devices, high maintenance costs, and the need to use port conversion devices for Ethernet transmission.
Design an Ethernet switch that integrates a central processing unit, a switching processing module, and a data processing module. It supports Ethernet and serial interfaces, enables direct data transmission over Ethernet, and facilitates data interaction and conversion through internal interfaces.
It simplifies equipment layout, reduces maintenance costs, and enables long-distance transmission of serial data over Ethernet, meeting the needs of remote data transmission.
Smart Images

Figure CN116112453B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, in particular to an Ethernet switch and a data transmission method. BACKGROUND
[0002] In the field of industry, mining or transportation, remote data acquisition is needed, and the data acquisition terminal interface mostly adopts RS-485 / RS232 serial interface, and in order to upload the collected data to the computer room computer or server, an Ethernet network is needed to solve the problem of limited transmission distance of the serial interface, such as Figure 1 As shown, a port conversion device 10 is usually needed between the Ethernet switch and the terminal. This data transmission mode has the following disadvantages:
[0003] 1. The types and quantities of devices are numerous, which is not conducive to the placement and layout of the devices, and a larger installation rack and space are needed;
[0004] 2. The port converter and the Ethernet switch may come from different manufacturers, and the maintenance cost is high. SUMMARY
[0005] The embodiments of the present application provide an Ethernet switch and a data transmission method, which can conveniently realize Ethernet transmission of serial data.
[0006] Therefore, the present application provides the following technical solutions:
[0007] On the one hand, the embodiments of the present application provide an Ethernet switch, which comprises a central processor, a switching processing module and a data processing module; the switching processing module has an Ethernet port, and the data processing module has a serial interface; the switching processing module and the data processing module have the same type of internal interface, and the switching processing module and the data processing module realize data interaction through the internal interface.
[0008] The central processor is connected with the switching processing module, and is used for managing and controlling the switching processing module.
[0009] The serial interface is used for connecting terminal devices through a serial bus.
[0010] The Ethernet port is used for connecting an Ethernet network.
[0011] The data processing module is configured to receive serial data from the terminal device through the serial interface, encapsulate the serial data into Ethernet packets, and transmit the Ethernet packets to the switching processing module through an internal interface; and is further configured to receive Ethernet packets from the switching processing module through the internal interface, decapsulate the Ethernet packets into serial data, and send the serial data to the terminal device through the serial interface.
[0012] The switching processing module is configured to receive Ethernet packets from the data processing module through the internal interface, and forward the Ethernet packets to a target network device through the Ethernet port; and is further configured to receive Ethernet packets from the Ethernet port, and transmit the Ethernet packets to the data processing module through the internal interface when it is determined that the Ethernet packets need to be sent to a serial interface.
[0013] Optionally, the switching processing module is further configured to forward the Ethernet packets through the Ethernet port when it is determined that the Ethernet packets do not need to be sent to a serial interface.
[0014] Optionally, the switching processing module determines whether the Ethernet packets need to be sent to a serial interface according to a service type in the Ethernet packets from the network device.
[0015] Optionally, the serial interface has a plurality of serial interfaces.
[0016] Optionally, the data processing module determines a serial interface corresponding to the serial data according to a port ID in the decapsulated serial data.
[0017] Optionally, the central processing unit is configured to receive the Ethernet packets sent by the switching processing module, determine a target forwarding interface of the Ethernet packets by analyzing user data content of the Ethernet packets, and send the target forwarding interface to the switching processing module, so that the switching processing module forwards the Ethernet packets through the target forwarding interface; wherein the target forwarding interface includes a serial interface and an Ethernet port.
[0018] In another aspect, the embodiments of the present application further provide a data transmission method based on the above Ethernet switch, and the method comprises:
[0019] receiving serial data sent by a terminal device, encapsulating the serial data into Ethernet packets, and sending the Ethernet packets to a target network device;
[0020] receiving Ethernet packets, and determining a service type in the Ethernet packets;
[0021] If the service type corresponds to serial interface service, the Ethernet message is unpacked to obtain serial data, and the serial data is sent to the terminal device.
[0022] Optionally, the method further comprises: if the service type does not correspond to serial interface service, forwarding the Ethernet message through the Ethernet port.
[0023] In another aspect, the embodiment of the present application further provides a data transmission method, which is applied to the data processing module of the Ethernet switch as described above, and the method comprises:
[0024] receiving serial data from the terminal device through the serial interface, packing the serial data into an Ethernet message, and transmitting the Ethernet message to the switching processing module through an internal interface; and / or
[0025] receiving an Ethernet message from the switching processing module through an internal interface, unpacking the Ethernet message into serial data, and sending the serial data to the terminal device through the serial interface.
[0026] In another aspect, the embodiment of the present application further provides a data transmission method, which is applied to the switching processing module of the Ethernet switch as described above, and the method comprises:
[0027] receiving an Ethernet message from the data processing module through an internal interface, and forwarding the Ethernet message to a target network device through the Ethernet port; and / or
[0028] receiving an Ethernet message from the Ethernet port, and transmitting the Ethernet message to the data processing module through the internal interface if the Ethernet message needs to be sent to a serial interface.
[0029] The Ethernet switch provided by the embodiment of the present application supports a serial communication interface, such as a serial communication interface RS485 or RS232, through an extension interface, combines port conversion and Ethernet data switching, and can realize the forwarding of serial data without the aid of a port conversion device, thereby realizing the transmission of serial data in an Ethernet. By using the present application, the problem that the transmission distance of serial data is limited is solved simply and conveniently, and the construction and installation are facilitated, and the cost is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0030] Figure 1 is a schematic diagram of a system architecture for realizing the communication between a terminal and a remote server by using an Ethernet network;
[0031] Figure 2 is a principle block diagram of the Ethernet switch provided by the embodiment of the present application;
[0032] Figure 3 is a hardware structure schematic diagram of an Ethernet switch provided by an embodiment of the present application;
[0033] Figure 4 is a schematic diagram of long-distance data acquisition and transmission by a multi-interface Ethernet switch provided by the present application;
[0034] Figure 5 is an example of a packaging format of serial data in an embodiment of the present application;
[0035] Figure 6 is an initialization flow of software in an Ethernet switch provided by an embodiment of the present application;
[0036] Figure 7 is a flowchart of a data transmission method provided by an embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the persons skilled in the art better understand the scheme of the embodiments of the present application, the embodiments of the present application are further described in detail below in combination with the drawings and embodiments.
[0038] An Ethernet switch is a network device based on MAC (Media Access Control) address recognition and completing Ethernet data frame forwarding. The sockets on the switch for connecting computers or other devices are called ports. The traditional Ethernet switch only supports Ethernet ports and is used for processing Ethernet message switching and routing. In view of the application requirement that the existing terminal device based on a serial interface needs to transmit data to a remote server and other devices through an Ethernet, the serial data can be transmitted through the Ethernet only by means of a port converter. The present application provides an Ethernet switch which has both Ethernet ports and serial interfaces, can directly receive serial data sent by a terminal device, encapsulates the serial data into Ethernet messages for forwarding, and obtains serial data by decapsulating the received Ethernet messages which need to be sent to the serial interface, and sends the serial data to the terminal device through the serial interface, thereby simply and conveniently realizing the transmission of serial data in the Ethernet.
[0039] The Ethernet switch provided by an embodiment of the present application is described in detail below in combination with Figure 2 and Figure 3 Among them, Figure 2 is a principle block diagram of an Ethernet switch provided by an embodiment of the present application, Figure 3 is a hardware structure schematic diagram of an Ethernet switch provided by an embodiment of the present application.
[0040] As Figure 2As shown, the Ethernet switch 200 provided by the embodiment of the present application comprises a central processor 201, a switching processing module 202 and a data processing module 203. The switching processing module 202 has an Ethernet port 221, and the data processing module 203 has a serial interface 231. The switching processing module 202 and the data processing module 203 have the same type of internal interface 23, and the switching processing module 202 and the data processing module 203 realize data interaction through the internal interface 23.
[0041] It should be noted that, in specific applications, one or more serial interfaces 231 of the same or different types, such as RS485, RS232, etc., can be arranged in the data processing module 203 according to actual application needs, so as to adapt to different use scenarios, and the embodiment of the present application does not make any limitation thereon. In addition, the internal interface 23 can be determined according to the chips and supported protocols adopted by the switching processing module 202 and the data processing module 203, and the embodiment of the present application does not make any limitation thereon.
[0042] In the Ethernet switch 200, the central processor 201 is connected with the switching processing module 202, and is used for managing and controlling the switching processing module 202. Specifically, the central processor 201 receives an Ethernet message sent by the switching processing module 202, determines a target forwarding interface of the Ethernet message by analyzing user data content of the Ethernet message, and issues the target forwarding interface to the switching processing module 202, so that the switching processing module 202 forwards the Ethernet message through the target forwarding interface. The target forwarding interface comprises a serial interface and an Ethernet port.
[0043] The serial interface 231 is used for connecting a terminal device through a serial bus, that is, the Ethernet switch 200 can be connected with the terminal device through the serial interface 231, and realizes serial port communication with the terminal device. The Ethernet port 221 is used for connecting an Ethernet network, and the Ethernet switch 200 can realize forwarding of Ethernet messages between different network devices through the Ethernet port 221. Of course, for IP messages, encapsulation into Ethernet messages is needed for transmission.
[0044] The Ethernet switch 200 provided by the embodiment of the present application can transmit serial data sent by the terminal device to a remote server or the like through the Ethernet network by means of the serial interface 231 and the Ethernet port 221, realizes long-distance transmission of serial data, and meets the application requirement of remote data transmission, such as transmission of field data collected by the terminal device to a remote data processing center.
[0045] It should be noted that the server can be a device accessing Ethernet through an Ethernet port, or a device accessing Ethernet through a serial interface and the same Ethernet switch as described above, and the embodiments of the present application do not limit this.
[0046] When transmitting the serial data received by the serial interface 231 through Ethernet, the serial data needs to be encapsulated, and the encapsulation of the data is completed by the data processing module 203. Specifically, the data processing module 203 encapsulates the serial data into an Ethernet message, and transmits the Ethernet message to the switching processing module 202 through the internal interface 23. Correspondingly, the switching processing module 202 receives the Ethernet message from the data processing module 203 through the internal interface 23, and forwards the Ethernet message to the target network device through the Ethernet port.
[0047] Correspondingly, after the Ethernet switch 200 receives the Ethernet message through the Ethernet port 221, the switching processing module 202 determines whether the Ethernet message needs to be sent to the serial interface, and if so, the Ethernet message is transmitted to the data processing module 203 through the internal interface 23. After the data processing module 203 receives the Ethernet message, it is decapsulated into serial data, and the serial data is sent to the corresponding terminal device through the serial interface 231.
[0048] It should be noted that in specific applications, the switching processing module 202 can determine whether the Ethernet message received from the Ethernet port 221 needs to be sent to the serial interface according to the service type in the Ethernet message from the network device. Specifically, a custom TCP (Transmission Control Protocol) / UDP (User Datagram Protocol) port number can be used to represent the service type.
[0049] In addition, as mentioned earlier, the serial interface 231 can have one or more, and in the case of multiple serial interfaces, the data processing module 203 can determine the serial interface corresponding to the serial data according to the port ID in the decapsulated serial data.
[0050] As Figure 3 shown is a hardware structure schematic diagram of an Ethernet switch provided by an embodiment of the present application.
[0051] In the embodiment, the data processing module can adopt an STM32 single-chip microcomputer, and the exchange processing module can adopt a corresponding exchange chip. Of course, other types of chips can also be adopted, and the embodiment of the application does not limit this. The Ethernet switch of the embodiment can realize three different types of interface combinations of Ethernet+RS485+RS232. The STM32 chip adopted in the example supports 4 USART (Universal Synchronous / Asynchronous Receiver / Transmitter, universal synchronous / asynchronous serial receiver / transmitter) and 2 UART (Universal Asynchronous Receiver / Transmitter, universal asynchronous receiver / transmitter) interfaces, and thus can realize a maximum of 6 RS485+RS232 interfaces.
[0052] The STM32 single-chip microcomputer is connected with the exchange processing module through an MII (Medium Independent Interface, medium independent interface) interface, to realize communication with the exchange processing module and Ethernet message transmission. The MII bus is a general bus used to connect different types of physical layers (PHY) with the same MAC (Media Access Control, medium access controller). The MII interface includes a data interface and a management interface between the MAC and the PHY. The data interface includes two independent channels for the transmitter and the receiver respectively. Each channel has its own data, clock and control signals. The management interface is a double signal interface: one is a clock signal, and the other is a data signal. Through the management interface, the upper layer can monitor and control the physical layer. Correspondingly, in the embodiment, as shown in Figure 3 The Ethernet switch also includes a power module and a clock module.
[0053] In the embodiment, the exchange processing module and the physical layer of the Ethernet port can be connected through a SERDES (Serializer and Deserializer) interface, a QSGMII (Quad Serial Gigabit Media Independent Interface) / SMI (Serial Management Interface) or the like. The SERDES interface includes a serializer and a deserializer. The serializer is composed of a parallel-to-serial conversion circuit and a transmitter, and has a relatively simple structure. The deserializer is composed of a receiver, a serial-to-parallel conversion circuit and a CDR (Clock and Data Recovery) circuit. The function of the serializer is to convert a low-speed parallel signal into a high-speed LVDS (Low Voltage Differential Signaling) signal, and then serialize and send out the signal. The function of the deserializer is to receive a high-speed serial LVDS signal and convert the signal into a low-speed parallel signal. The SMI is a serial interface, and the interface includes two signal lines, MDC and MDIO. Through the SMI interface, a MAC layer chip (or other control chip) can access the registers of a physical layer chip.
[0054] In the embodiment, a memory and a logic device, such as a DDR (Double Data Rate SDRAM), a Flash (EEPROM Memory) and a CPLD (Complex Programmable Logic Device), connected with the central processing module can also be included. The specific setting can be made according to the application requirement.
[0055] Figure 4 is a schematic diagram of long-distance data acquisition and transmission by using the multi-interface Ethernet switch provided by the embodiment of the application.
[0056] The process of long-distance serial data transmission by using the Ethernet switch provided by the embodiment of the application will be described in detail below. Figure 3 and Figure 4 The process of long-distance serial data transmission by using the Ethernet switch provided by the embodiment of the application will be described in detail below.
[0057] As shown in Figure 4 , the Ethernet switch 40 has three serial interfaces, two RS485 interfaces and one RS232 interface. One of the RS485 interfaces is connected with the RS485 interface of the terminal device 411, the other RS485 interface is connected with the RS485 interface of the terminal device 412, and the RS232 interface is connected with the RS232 interface of the terminal device 413.
[0058] The terminal devices 411, 412 and 413 respectively perform data collection services, and upload the collected data to the server 42 in the Ethernet through respective serial interfaces, and in addition, the server 42 also issues corresponding instructions to the terminal devices 411, 412 and 413.
[0059] For the uplink data stream, when the RS485 / RS232 serial interface collects data from the terminal device hung thereunder, the RS485 / RS232 serial interface sends the data to the STM32 chip in the Ethernet switch 40 for processing, and the STM32 chip encapsulates the collected data into an Ethernet message according to a defined format. The STM32 chip transmits the encapsulated Ethernet message to the switching processing module through a network port (such as an MII interface) connected to the switching processing module, and then the switching processing module forwards the Ethernet message to the server 42.
[0060] For the downlink data stream, after the switching processing module receives the message sent from the remote end, it determines whether the message needs to be sent to the STM32 chip for processing according to the specific service type. After the STM32 chip receives the Ethernet message sent from the switching processing module, it decapsulates the Ethernet message and transmits the data to the serial interface (RS485 interface or RS232 interface) corresponding to the port ID carried in the Ethernet message, and then sends the data to the corresponding terminal device through the serial interface.
[0061] It should be noted that the encapsulation format of the serial data described above can be customized as needed, and the embodiments of the present application do not limit this. For example, the message format definition is as shown in Figure 5
[0062] Referring to Figure 5 , the meanings of the fields in the message are as follows:
[0063] DATA, x bytes of user data;
[0064] CMD, 1 byte, used to identify the type of DATA;
[0065] ETH TYPE, 2 bytes, Ethernet message type, in this embodiment, a custom value 0xFEFE is used to identify that DATA is serial data;
[0066] VLAN TAG, 4 bytes, VLAN (Virtual Local Area Network) tag;
[0067] SMAC, 6 bytes, source MAC address;
[0068] DMAC, 6 bytes, destination MAC address.
[0069] In the embodiment of the present application, the Ethernet message transmitted by the STM32 chip to the switching processing module is actually uploaded to the CPU (central processing module) in the Ethernet switch 40.
[0070] After the CPU receives the Ethernet message, it determines according to the user data content whether the Ethernet message needs to be forwarded to other serial interfaces or transmitted to the Ethernet network through the Ethernet port.
[0071] It should be noted that for the Ethernet message that needs to be forwarded to other serial interfaces, the CPU mainly performs format conversion and other operations on the user data; for the Ethernet message that needs to be transmitted to the Ethernet network through the Ethernet port, the CPU mainly encapsulates it into a three-layer message (such as an IP message). The CPU inserts the processed message back into the switching processing module for forwarding.
[0072] The CPU runs a main program for device management and a two-layer switching protocol. A separate subprogram runs on the STM32 chip, which needs to achieve simple communication with the CPU and complete conversion of Ethernet messages and RS485 / RS232 interface data in addition to initializing the STM32 chip itself.
[0073] With reference to the hardware structure shown in Figure 3 , the initialization process of the software in the Ethernet switch provided by the embodiment of the present application is shown in Figure 5 .
[0074] First, the CPU software is loaded to the CPU and the STM32 software is loaded to the STM32 chip; then, the CPU software loaded is used to initialize the CPU peripheral devices and the switching chip respectively, and the STM32 software loaded is used to initialize the serial interfaces RS485 and RS232 respectively, and initialize the MII interface. After the STM32 software is initialized, the CPU is informed that the initialization is completed.
[0075] After the CPU software is initialized to the corresponding devices, if the notification of the completion of the STM32 initialization is received, the initialization process is ended; if the notification is not received, the initialization process is continued until the corresponding notification is received.
[0076] The above embodiment takes the STM32 chip as an example for description, and in actual application, other types of single-chip microcomputers can also be used as the data processing module, which is not limited in the present application.
[0077] The application embeds a serial interface processing chip, such as the STM32 chip mentioned above, in a switch, supports Ethernet switching functions, and can support one or more serial interfaces, such as one or more RS485 interfaces, or one or more RS232 interfaces, or a mixture of one or more RS485 and RS232 interfaces, to adapt to different use scenarios. At the same time, the data collected by the serial interface can be directly transmitted remotely after being encapsulated by Ethernet, or the instructions issued by the remote device (which can be instructions issued through a network port or a serial interface) can be transmitted to the terminal device connected to the multi-interface switch provided by the embodiment of the application through the serial interface.
[0078] Correspondingly, the application also provides a data transmission method based on the above Ethernet switch, which mainly includes transmission of uplink data flow and transmission of downlink data flow, and specifically includes the following steps:
[0079] For the uplink data flow, the serial data sent by the terminal device is received, the serial data is encapsulated into an Ethernet message, and the Ethernet message is sent to a target network device.
[0080] For the downlink data flow, an Ethernet message is received, and the service type in the Ethernet message is determined; if the service type corresponds to a serial interface service, the Ethernet message is unpacked to obtain serial data, and the serial data is sent to the terminal device. Further, if the service type does not correspond to a serial interface service, the Ethernet message is forwarded through the Ethernet port.
[0081] Figure 7 An example of the above data transmission method is shown, and specifically includes the following steps:
[0082] For the uplink data flow, the data processing module receives the serial data sent by the terminal device, encapsulates the serial data into an Ethernet message, the Ethernet message carrying user data (i.e., the serial data), and sends the Ethernet message to the switching processing module through an internal interface; the switching processing module uploads the Ethernet message to the central processor, the central processor determines the target forwarding interface and issues it to the switching processing module, and the switching processing module forwards the Ethernet message to the target network device according to the target forwarding interface.
[0083] For the downlink data flow, an Ethernet message is received, and the service type in the Ethernet message is determined; if the service type corresponds to a serial interface service, the Ethernet message is sent to the data processing module through an internal interface, the data processing module unpacks the Ethernet message to obtain serial data, and the serial data is sent to the terminal device. Further, if the service type does not correspond to a serial interface service, the Ethernet message is forwarded through the Ethernet port.
[0084] Accordingly, the embodiment of the present application also provides a data transmission method applied to the data processing module of the Ethernet switch, the method comprising: receiving serial data from the terminal device through the serial interface, encapsulating the serial data into Ethernet packets, and transmitting the Ethernet packets to the switch processing module through the internal interface; and / or receiving Ethernet packets from the switch processing module through the internal interface, decapsulating the Ethernet packets into serial data, and sending the serial data to the terminal device through the serial interface.
[0085] Accordingly, the embodiment of the present application also provides a data transmission method applied to the data processing module of the Ethernet switch, the method comprising: receiving serial data from the terminal device through the serial interface, encapsulating the serial data into Ethernet packets, and transmitting the Ethernet packets to the switch processing module through the internal interface; and / or receiving Ethernet packets from the switch processing module through the internal interface, decapsulating the Ethernet packets into serial data, and sending the serial data to the terminal device through the serial interface.
[0086] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification and claims and above mentioned figures are intended to cover not exclusive inclusions, for example, a process, method, system, product or device containing a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0087] Each of the embodiments in the specification is described in a progressive manner, and the same and similar parts between each of the embodiments can be referred to each other, and each of the embodiments focuses on the difference from other embodiments. Moreover, the above described system embodiments are only illustrative, and the modules and units described as separate components can be or can not be physically separated, that is, can be located on one network unit, or can be distributed to multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0088] The above has carried out the detailed introduction to the embodiment of the application, the application has carried on the elaboration to the application in this article, the above example explanation is only for helping understanding the method and device of the application, it is only a part of the embodiment of the application, and is not all the embodiment. Based on the embodiment in the application, all other embodiments obtained by the ordinary skilled person in the art without making creative labor should belong to the protection scope of the application, and the content of the description should not be understood as limiting the application. Therefore, any modification, equivalent replacement, improvement, etc. within the spirit and principles of the application should be included in the protection scope of the application.
Claims
1. An Ethernet switch, characterized in that, The Ethernet switch includes: a central processing unit, a switching processing module, and a data processing module; the switching processing module has an Ethernet port, and the data processing module has a serial interface. The exchange processing module and the data processing module have the same type of internal interface, and the exchange processing module and the data processing module realize data interaction through the internal interface; The central processing unit is connected to the switching processing module and is used to manage and control the switching processing module; The serial interface is used to connect to terminal devices via a serial bus; The Ethernet port is used to connect to an Ethernet network; The data processing module is configured to receive serial data from the terminal device through the serial interface, encapsulate the serial data into Ethernet packets, and transmit the Ethernet packets to the switching processing module through an internal interface. The Ethernet packets encapsulated with the serial data include: source MAC address, destination MAC address, Ethernet packet type, data type, and data. When the Ethernet packet type is 0xFEFE, the data is identified as serial data. The module is also configured to receive Ethernet packets from the switching processing module through an internal interface, decapsulate the Ethernet packets into serial data, and send the serial data to the terminal device through the serial interface. The switching processing module is configured to receive Ethernet packets from the data processing module through an internal interface, and forward the Ethernet packets to the target network device through the Ethernet port; it is also configured to receive Ethernet packets from the Ethernet port, and determine whether the Ethernet packets need to be sent to the serial interface based on the service type in the Ethernet packets from the network device; if the Ethernet packets need to be sent to the serial interface, it transmits the Ethernet packets to the data processing module through the internal interface, wherein the service type is obtained based on the port number of the TCP / UDP layer; The switching processing module is also used to send Ethernet packets received from the data processing module through the internal interface to the central processing unit; The central processing unit is also used to parse the user data content of the Ethernet packets received from the switching processing module to determine the target forwarding interface of the Ethernet packets, and to send the target forwarding interface to the switching processing module. The target forwarding interface includes a serial interface and an Ethernet port. When the target forwarding interface is a serial interface, the user data is also converted into the format corresponding to the target serial port. When the target forwarding interface is an Ethernet port, the user data is also encapsulated into a three-layer format and backfilled.
2. The Ethernet switch according to claim 1, characterized in that, The switching processing module is also used to forward the Ethernet packet through the Ethernet port if it determines that the Ethernet packet does not need to be sent to the serial interface.
3. The Ethernet switch according to claim 1, characterized in that, There are multiple serial interfaces.
4. The Ethernet switch according to claim 3, characterized in that, The data processing module determines the serial interface corresponding to the serial data based on the port ID in the decapsulated serial data.
5. The Ethernet switch according to any one of claims 1 to 4, characterized in that, The data processing module is an STM32 chip, and the internal interface is an MII interface.
6. A data transmission method based on an Ethernet switch according to any one of claims 1 to 5, characterized in that, The method includes: Receive serial data sent by a terminal device, encapsulate the serial data into an Ethernet packet, and send the Ethernet packet to the target network device; Receive Ethernet packets and determine the service type in the Ethernet packets; If the service type corresponds to a serial interface service, the Ethernet packet is decapsulated to obtain serial data, and the serial data is sent to the terminal device.
7. The method according to claim 6, characterized in that, The method further includes: If the service type does not correspond to a serial interface service, the Ethernet packet is forwarded through the Ethernet port.
8. A data transmission method, characterized in that, The method, applied to a data processing module of an Ethernet switch according to any one of claims 1 to 5, comprises: Receive serial data from the terminal device through the serial interface, encapsulate the serial data into Ethernet packets, and transmit the Ethernet packets to the switching processing module through the internal interface; and / or The system receives Ethernet packets from the switching processing module via an internal interface, decapsulates the Ethernet packets into serial data, and sends the serial data to the terminal device via the serial interface.
9. A data transmission method, characterized in that, The method, applied to a switching processing module of an Ethernet switch according to any one of claims 1 to 5, comprises: Receive Ethernet packets from the data processing module via the internal interface, and forward the Ethernet packets to the target network device through the Ethernet port; and / or If an Ethernet packet is received from the Ethernet port and it is determined that the Ethernet packet needs to be sent to the serial interface, the Ethernet packet is transmitted to the data processing module through the internal interface.
Citation Information
Patent Citations
Ethernet switch
CN207530850U