A method and device for bridging a WIFI module to a wired Ethernet via an MCU
The wired Ethernet is bridged through MCU, and the use of MCU with RMII interface to replace the hardware TCP/IP protocol stack chip, solving the high cost and complexity of the WIFI module and Ethernet bridge in the existing technology, achieving more convenient and economical bridge plan.
Patent Information
- Application Number
- CN202410275375.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-03-12
AI Technical Summary
The prior art requires the development of Socket compatibility layer when bridging WIFI modules with Ethernet, and the built-in hardware TCP/IP PHY chip is costly and the number of Sockets created is small.
Wired Ethernet is bridged through MCU, and a MCU with RMII interface is used to replace the hardware TCP/IP protocol stack chip. Only ordinary PHY chip is needed to bridge the WIFI module with Ethernet, avoiding the development of Socket compatibility layer.
Reduces costs, improves the convenience of WIFI modules and Ethernet bridges, and avoids the high hardware costs and the complexity of protocol stack adaptation.
Smart Images

Figure CN117880004B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method and device for bridging a wired Ethernet via an MCU using a WIFI module. Background Art
[0002] With the development of the Internet of Things and big data in recent years, more and more industrial control equipment needs to upload data to the Internet of Things cloud platform through WIFI or wired Ethernet. The Internet of Things cloud platform uses big data or machine learning methods to analyze and process the collected data to generate optimized control parameters and send them to the equipment, or store and display the data.
[0003] Since industrial control has high reliability requirements, network communication functions are usually developed directly on the WIFI module, while important process control functions are developed on the main MCU. This prevents the TCP / IP protocol stack from occupying too much RAM of the main MCU, resulting in insufficient RAM, and also prevents system abnormalities caused by memory leaks in the TCP / IP protocol stack.
[0004] Please refer to Figure 1 In the current existing solutions, most WIFI modules do not have a MAC controller, so the WIFI module is generally equipped with a PHY chip with an SPI interface and a built-in hardware TCP / IP protocol stack, such as W5500. The disadvantage of this solution is that it requires the development of a Socket compatibility layer, and the number of Sockets that can be created by chips such as W5500 is generally limited to only a few, and the cost of such PHY chips with built-in TCP / IP protocol stack is higher than that of ordinary PHY chips.
[0005] That is, the prior art has the following problems:
[0006] (1) It is necessary to develop a socket compatibility layer that is compatible with the hardware TCP / IP protocol stack and the Lwip protocol stack;
[0007] (2) The cost of PHY chips with built-in hardware TCP / IP is relatively high;
[0008] (3) The PHY chip with built-in hardware TCP / IP can create a small number of sockets. Summary of the invention
[0009] The technical problem to be solved by the present invention is to provide a method and a device for bridging a WIFI module to a wired Ethernet through an MCU, so as to more easily realize the bridging of the WIFI module and the Ethernet while reducing the cost.
[0010] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0011] A method for bridging a wired Ethernet with a WIFI module via an MCU, comprising the steps of:
[0012] S1, the main control MCU sends the collected data to the WIFI module;
[0013] S2. The WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the main control MCU, which then forwards it to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
[0014] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0015] A device in which a WIFI module is bridged to a wired Ethernet through an MCU, comprising a main control MCU, a WIFI module and a PHY physical layer component, and the following steps are implemented through the main control MCU, the WIFI module and the PHY physical layer component:
[0016] S1, the main control MCU sends the collected data to the WIFI module;
[0017] S2. The WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the main control MCU, which then forwards it to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
[0018] The beneficial effects of the present invention are as follows: a method and device for bridging a wired Ethernet through an MCU using a WIFI module of the present invention adopts an MCU with an RMII interface to replace a hardware TCP / IP protocol stack chip such as W5500, and only needs to use an ordinary PHY chip, thereby effectively reducing costs. At the same time, there is no need to develop a Socket compatibility layer to adapt the hardware TCP / IP protocol stack and the Lwip protocol stack, thereby improving the convenience of bridging the WIFI module and the Ethernet. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic diagram of a solution of articulating an Ethernet to an existing WIFI module according to the background technology of the present invention;
[0020] Figure 2 This is a flow chart of a method for bridging a wired Ethernet via an MCU using a WIFI module according to an embodiment of the present invention;
[0021] Figure 3 The present invention is a schematic diagram of the architecture of a device in which a WIFI module is bridged to a wired Ethernet through an MCU according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] 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.
[0023] Glossary:
[0024] MCU (Microcontroller Unit): MCU is a single-chip microcontroller that integrates a processor core, memory, IO functions, and various peripheral interfaces. It is often used in embedded systems, has a small size and low power consumption, and can complete various control tasks.
[0025] SPI (Serial Peripheral Interface): SPI is a synchronous serial communication interface standard for full-duplex serial data transmission between digital devices. It is often used to communicate with external devices (such as memory, sensors, displays, etc.), providing high-speed data transmission and simple communication protocols.
[0026] PHY (Physical Layer): PHY is the physical layer component in the Ethernet standard, responsible for converting data from the logical layer of the network card into electrical signals at the physical layer and transmitting them on the physical medium. PHY is commonly used in Ethernet systems and provides signal modulation, demodulation, encoding, decoding and other functions at the physical layer.
[0027] MAC (Media Access Control): MAC is a data link layer protocol in network communications that defines how to access the media and transmit data.
[0028] RMII (Reduced Media Independent Interface): RMII is an interface standard that simplifies the original MII (Media Independent Interface).
[0029] 802.3: 802.3 is an Ethernet standard developed by the IEEE (Institute of Electrical and Electronics Engineers). It defines a set of rules and protocols for data transmission in a Local Area Network (LAN).
[0030] Please refer to Figure 2 and Figure 3 , a method for bridging a WIFI module to a wired Ethernet via an MCU, comprising the steps of:
[0031] S1, the main control MCU sends the collected data to the WIFI module;
[0032] S2. The WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the main control MCU, which then forwards it to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
[0033] From the above description, it can be seen that the beneficial effects of the present invention are: a method for bridging a wired Ethernet through an MCU using a WIFI module of the present invention uses an MCU with an RMII interface to replace a hardware TCP / IP protocol stack chip such as W5500, and only needs to use an ordinary PHY chip, which effectively reduces the cost. At the same time, there is no need to develop a Socket compatibility layer to adapt the hardware TCP / IP protocol stack and the Lwip protocol stack, thereby improving the convenience of bridging the WIFI module and the Ethernet.
[0034] Furthermore, step S2 is specifically as follows:
[0035] The WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the MAC data link layer protocol of the main control MCU, and the MAC data link layer protocol is forwarded to the PHY physical layer component through the RMII interface to be sent to the wired Ethernet network.
[0036] From the above description, we can see that the MAC protocol is responsible for the transmission control of data frames to ensure that data on the shared media can be transmitted smoothly to avoid conflicts and collisions. At the same time, the MAC protocol will perform error detection on the received data frames, such as using the CRC (cyclic redundancy check) algorithm to ensure data integrity. If an error is detected, the MAC protocol may correct the error through retransmission or correction algorithms to ensure data accuracy.
[0037] Furthermore, the Ethernet data frame is an 802.3 Ethernet data frame.
[0038] As can be seen from the above description, 802.3 Ethernet supports different transmission rates, including 10 Mbps, 100 Mbps, 1Gbps, 10 Gbps, etc. It can meet the needs of bandwidth and transmission rate in different network environments, as well as support large-scale data transmission and high-speed Internet access.
[0039] Furthermore, the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU through the SPI interface.
[0040] The WIFI module generates an Ethernet data frame based on the received data, and the LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU.
[0041] From the above description, it can be seen that the LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU through the SPI interface.
[0042] Furthermore, in step S1, the main control MCU specifically sends the collected data to the WIFI module via the SPI interface;
[0043] In step S2, the WIFI module specifically transparently transmits the Ethernet data frame to the main control MCU through the SPI interface.
[0044] From the above description, we can know that the WIFI module and MCU communicate through the SPI interface, which can communicate at a higher data transmission rate. This means that the MCU can quickly read and write the WIFI module through the SPI interface to achieve efficient data transmission.
[0045] Please refer to Figure 3 A device in which a WIFI module is bridged to a wired Ethernet through an MCU, comprising a main control MCU, a WIFI module and a PHY physical layer component, and the following steps are implemented through the main control MCU, the WIFI module and the PHY physical layer component:
[0046] S1, the main control MCU sends the collected data to the WIFI module;
[0047] S2. The WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the main control MCU, which then forwards it to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
[0048] From the above description, it can be seen that the beneficial effects of the present invention are: a method for bridging a wired Ethernet through an MCU using a WIFI module of the present invention uses an MCU with an RMII interface to replace a hardware TCP / IP protocol stack chip such as W5500, and only needs to use an ordinary PHY chip, which effectively reduces the cost. At the same time, there is no need to develop a Socket compatibility layer to adapt the hardware TCP / IP protocol stack and the Lwip protocol stack, thereby improving the convenience of bridging the WIFI module and the Ethernet.
[0049] Furthermore, step S2 is specifically as follows:
[0050] The WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the MAC data link layer protocol of the main control MCU, and the MAC data link layer protocol is forwarded to the PHY physical layer component through the RMII interface to be sent to the wired Ethernet network.
[0051] From the above description, we can see that the MAC protocol is responsible for the transmission control of data frames to ensure that data on the shared media can be transmitted smoothly to avoid conflicts and collisions. At the same time, the MAC protocol will perform error detection on the received data frames, such as using the CRC (cyclic redundancy check) algorithm to ensure data integrity. If an error is detected, the MAC protocol may correct the error through retransmission or correction algorithms to ensure data accuracy.
[0052] Furthermore, the Ethernet data frame is an 802.3 Ethernet data frame.
[0053] As can be seen from the above description, 802.3 Ethernet supports different transmission rates, including 10 Mbps, 100 Mbps, 1Gbps, 10 Gbps, etc. It can meet the needs of bandwidth and transmission rate in different network environments, as well as support large-scale data transmission and high-speed Internet access.
[0054] Furthermore, the WIFI module generates an Ethernet data frame based on the received data and transparently transmits it to the MAC data link layer protocol of the main control MCU as follows:
[0055] The WIFI module generates an Ethernet data frame based on the received data, and the LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU.
[0056] From the above description, it can be seen that the WIFI module generates an Ethernet data frame according to the received data, and the LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU.
[0057] Furthermore, in step S1, the main control MCU specifically sends the collected data to the WIFI module via the SPI interface;
[0058] In step S2, the WIFI module specifically transparently transmits the Ethernet data frame to the main control MCU through the SPI interface.
[0059] From the above description, we can know that the WIFI module and MCU communicate through the SPI interface, which can communicate at a higher data transmission rate. This means that the MCU can quickly read and write the WIFI module through the SPI interface to achieve efficient data transmission.
[0060] The present invention discloses a method and a device for bridging a WIFI module with a wired Ethernet through an MCU, which is suitable for bridging a WIFI module with a wired Ethernet, and is particularly suitable for bridging a WIFI module with a wired Ethernet of an Internet of Things industrial control device.
[0061] Please refer to Figure 2 and Figure 3 , Embodiment 1 of the present invention is:
[0062] A method for bridging a wired Ethernet with a WIFI module via an MCU, comprising the steps of:
[0063] S1. The main control MCU sends the collected data to the WIFI module through the SPI interface.
[0064] In this embodiment, the SPI interface of the WIFI module includes communication channels SPI-1 and SPI2. The main control MCU transmits the collected data to the WIFI module through SPI-1, and the WIFI module creates a network connection to send the data to the cloud platform.
[0065] S2. The WIFI module generates an Ethernet data frame based on the received data. The LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the main control MCU through the SPI interface, and the main control MCU forwards it to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
[0066] In this embodiment, the Lwip protocol stack of the WIFI module transparently transmits the Ethernet 802.3 frame to the main control MCU through SPI-2, forwards it to the PHY and sends it to the wired Ethernet network. The improved solution WIFI module transparently transmits 802.3 frames between the SPI bus and the MAC of the main control MCU, simplifies the network model within the WIFI module, and effectively utilizes the MAC controller resources of the main control MCU.
[0067] Please refer to Figure 3 , Embodiment 2 of the present invention is:
[0068] A device for bridging a wired Ethernet with a WIFI module through an MCU comprises a main control MCU, a WIFI module and a PHY physical layer component, and the steps in the method for bridging a wired Ethernet with a WIFI module through an MCU in the above embodiment 1 are implemented through the main control MCU, the WIFI module and the PHY physical layer component.
[0069] In summary, the present invention provides a method and device for bridging a wired Ethernet through an MCU using a WIFI module, and uses an MCU with an RMII interface to replace a hardware TCP / IP protocol stack chip such as W5500. Only an ordinary PHY chip is needed, which effectively reduces the cost. At the same time, there is no need to develop a Socket compatibility layer to adapt the hardware TCP / IP protocol stack and the Lwip protocol stack, thereby improving the convenience of bridging the WIFI module and the Ethernet.
[0070] 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 bridging a WIFI module to a wired Ethernet via an MCU, characterized in that: Applied to an architecture including a main control MCU, a WIFI module and physical layer components; The main control MCU and the WIFI module include an SPI interface connection, and the SPI interface includes communication channels SPI-1 and SPI-2; The MCU does not belong to a hardware TCP / IP protocol stack chip; The WIFI module does not have a MAC data link layer protocol; The main control MCU has an RMII interface, and the main control MCU and the physical layer component include an RMII interface connection; The implementation includes the following steps: S1, the main control MCU sends the collected data to the WIFI module through the SPI interface; Specifically, the main control MCU transmits the collected data to the WIFI module via SPI-1; S2. The WIFI module generates an Ethernet data frame according to the received data. The LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU through the SPI-2 communication channel. The MAC data link layer protocol performs error detection on the received data frame, including using a cyclic redundancy check algorithm, and after detecting an error, performs error correction through a retransmission or correction algorithm to ensure data integrity. The MAC data link layer protocol forwards the data to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
2. The method of bridging a WIFI module to a wired Ethernet via an MCU according to claim 1, characterized in that: The Ethernet data frame is an 802.3 Ethernet data frame.
3. A device in which a WIFI module is bridged to a wired Ethernet through an MCU, characterized in that: It includes a main control MCU, a WIFI module and a PHY physical layer component. The main control MCU and the WIFI module are connected by an SPI interface, and the SPI interface includes communication channels SPI-1 and SPI-2; The MCU does not belong to a hardware TCP / IP protocol stack chip; The main control MCU has an RMII interface, and the main control MCU and the physical layer component include an RMII interface connection; The following steps are implemented by the main control MCU, WIFI module and PHY physical layer components: S1, the main control MCU sends the collected data to the WIFI module through the SPI interface; Specifically, the main control MCU transmits the collected data to the WIFI module via SPI-1; S2. The WIFI module generates an Ethernet data frame based on the received data. The LwIP protocol stack of the WIFI module transparently transmits the received Ethernet data frame to the MAC data link layer protocol of the main control MCU through the SPI-2 communication channel. The MAC protocol performs error detection on the received data frame, including using a cyclic redundancy check algorithm to ensure data integrity. The MAC data link layer protocol forwards the frame to the PHY physical layer component through the RMII interface to send it to the wired Ethernet network.
4. The device of claim 3 wherein the WIFI module is bridged to the wired Ethernet through the MCU, characterized in that: The Ethernet data frame is an 802.3 Ethernet data frame.
