Method and system for MCU-based wi-sun border router module to access ipv4 single stack network

By using the IP64 module of the MCU to achieve protocol conversion between Wi-SUN network and IPv4 network, the compatibility problem between IPv6 and IPv4 is solved, and seamless data transmission from IPv6 network to IPv4 network is realized, expanding the application scenarios of Wi-SUN IoT.

CN121619284BActive Publication Date: 2026-05-12SHENZHEN FRIENDCOM TECH DEV +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN FRIENDCOM TECH DEV
Filing Date
2026-01-30
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Wi-SUN网络基于IPv6协议栈难以直接接入IPv4网络,导致协议兼容性问题,限制了其应用场景。

Method used

By connecting the Wi-SUN network and the IPv4 single-stack network through an MCU-based IP64 module, the conversion of IPv6 packets to IPv4 packets is realized, including address mapping, packet header conversion and protocol adaptation. The mapping list is established using NAT technology, which supports IPv6-only network access to IPv4 network.

Benefits of technology

It enables seamless data transmission between IPv6 and IPv4 networks, expands the application scenarios of Wi-SUN IoT, and allows resource-constrained IoT devices to access IPv4 resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121619284B_ABST
    Figure CN121619284B_ABST
Patent Text Reader

Abstract

The application discloses a method and system for MCU-based Wi-SUN boundary routing module to access IPv4 single-stack network. The method comprises the following steps: analyzing the destination address of a received data packet and obtaining a transport layer protocol type; when the data packet is determined as an IPv4 data packet according to the transport layer protocol type, the data packet is processed through a transport layer; when the data packet is determined as an IPv6 data packet, whether to forward the data packet is determined according to a static routing table; if yes, the IPv6 data packet is forwarded; otherwise, the data packet is processed through the transport layer; the transport layer directly sends an IPv4 data packet through an IPv4 interface; and when the destination address of the analyzed IPv6 data packet does not contain a Wi-SUN subnet device prefix, the IPv6 packet header is converted into an IPv4 packet header, and then the IPv6 data packet is forwarded through the IPv4 interface. The application realizes that resource-restricted IoT devices access IPv4 resources through an IPv6 network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) communication technology, and in particular to a method and system for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network. Background Technology

[0002] Wi-SUN, short for Wireless Utility Networks, is a collective term for a series of standard wireless communication networks based on the IEEE 802.15.4 protocol. The IEEE 802.15.4 standard lays the underlying foundation for Wi-SUN, defining physical layer and media access control layer specifications suitable for low-rate wireless personal area networks, helping to achieve low-power, low-cost wireless communication.

[0003] Wi-SUN primarily encompasses two core network specifications: Wi-SUN FAN (Field Area Network) and Wi-SUN HAN (Home Area Network). FAN supports the IEEE 802.15.4g physical layer, IEEE 802.15.4e MAC layer, 6LoWPAN, RPL, and IPv6, adapting to outdoor scenarios requiring multi-hop communication, such as smart streetlights and smart meters. HAN is used for scenarios like home energy management, supporting similar specifications such as the IEEE 802.15.4g physical layer. The collaboration between Wi-SUN FAN and HAN enhances broad coverage from home to city-level applications while ensuring communication stability and security. It supports multi-hop networking, flexibly adapting to complex deployment environments, reducing deployment costs and improving operational efficiency. Through the dynamic routing protocol RPL, it achieves efficient data forwarding and optimizes network resource utilization. Furthermore, the Wi-SUN Alliance promotes standardization, facilitating interoperability between devices from different manufacturers and accelerating the large-scale deployment of smart cities, smart grids, and other fields.

[0004] Wi-SUN is designed based on the IPv6 protocol stack, and its network nodes use IPv6 addresses for communication. However, the traditional Internet and many existing devices are still based on the IPv4 protocol. The two are fundamentally different in terms of address format and protocol mechanism. Therefore, there are compatibility issues when directly accessing IPv4 networks. As a result, there is an urgent need for a technology to solve the technical problem that Wi-SUN, based on IPv6, cannot directly access IPv4 networks. Summary of the Invention

[0005] The purpose of this invention is to provide a method and system for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network, thereby solving the protocol compatibility problem of Wi-SUN's inability to directly access IPv4 networks based on IPv6, and expanding the application scenarios of Wi-SUN IoT. The various technical effects of the preferred solutions among the many technical solutions provided by this invention are detailed below.

[0006] To achieve the above objectives, the present invention provides the following technical solution:

[0007] This invention provides a method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network. The method connects the Wi-SUN network and the IPv4 single-stack network via an IP64 module based on an MCU. The IP64 module has both IPv4 and IPv6 addresses. The method includes the following steps:

[0008] Parse the destination address of the received data packet and obtain the transport layer protocol type based on the IP header of the data packet;

[0009] According to the transport layer protocol type, if the data packet is determined to be an IPv4 data packet, it is processed by the transport layer; if the data packet is determined to be an IPv6 data packet, it is determined whether to forward it according to the static routing table. If so, the IPv6 data packet is forwarded; otherwise, it is processed by the transport layer.

[0010] When the transport layer receives the data packet, it sends the IPv4 data packet directly through the IPv4 interface; for the IPv6 data packet, when the resolved destination address does not contain the Wi-SUN subnet device prefix, it converts the IPv6 header into an IPv4 header, and forwards the converted data packet through the IPv4 interface.

[0011] In one or more embodiments, the method further includes, before parsing the destination address of the received data packet, establishing a mapping between the IPv6 addresses of all node devices within the IPv6 subnetwork and the IPv4 address of the WAN port of the IPv6 subnetwork, thereby obtaining a mapping linked list.

[0012] In one or more embodiments, the structure member variables of the mapping list include a list pointer, a timer, a Wi-SUN node IPv6 address, a WAN port IPv4 address, the number of protocol conversions, the bound port number, the Wi-SUN network IPv6 port number, the WAN port IPv4 port number, and the converted protocol.

[0013] In one or more embodiments, the conversion of the IPv6 header to an IPv4 header includes the following steps:

[0014] Use the IPv4 address of the IP64 module as the source address;

[0015] Extract the IPv4 address that is pre-configured after the IP64 prefix of the data packet and use it as the destination address;

[0016] Adjust the IPv6 checksum to the IPv4 checksum;

[0017] Convert the ICMPv6 header associated with the IPv6 protocol to the ICMPv4 header associated with the IPv4 protocol.

[0018] In one or more embodiments, when parsing the destination address of the received data packet, a temporary port mapping is created for the source device corresponding to the IPv6 protocol that initiated the request.

[0019] In one or more embodiments, the IPv4 packet or the IPv6 packet is also sent via the SLIP protocol, the process of which includes:

[0020] After receiving the data packet via the serial port, the data packet is parsed.

[0021] Determine whether the parsed data packet contains a first string; if so, perform identifier escaping processing on the first string, and then determine whether the parsed data packet contains a second string; otherwise, determine whether the parsed data packet contains the second string.

[0022] If the parsed data packet contains the second string, the second string is identified and escaped. Then, the data packet is added to the receive buffer. If the length of the data packet exceeds the maximum allowed length, the data packet is discarded and the serial port receive data status is reset. If the data packet reception is complete, the data packet is passed to the upper layer protocol for processing.

[0023] If the parsed data packet does not contain the second string, the data packet is added to the receive buffer. If the length of the data packet exceeds the maximum allowed length, the data packet is discarded and the serial port receive data status is reset. If the data packet reception is complete, the data packet is passed to the upper layer protocol for processing.

[0024] In one or more embodiments, the IPv4 packet or the IPv6 packet is received using the SLIP protocol, the process of which includes:

[0025] The data packets received via the serial port are parsed;

[0026] Determine whether the parsed data packet contains the first string. If so, escape the first string into the third string, and then determine whether the parsed data packet contains the second string; otherwise, determine whether the parsed data packet contains the second string.

[0027] If the parsed data packet contains the second string, the second string is escaped into the fourth string. After the data reading is complete, the data packet is sent via the serial port.

[0028] If the parsed data packet does not contain the second string, the data reading is complete, and the data packet is sent via the serial port.

[0029] In one or more embodiments, the method further includes converting the header of IPv4 packets received from the IPv4 single-stack network into an IPv6 header before transmitting them to the Wi-SUN border routing module, including:

[0030] Extract the high 6 bits of the Service Type field of the IPv4 protocol as DSCP, and the low 2 bits as ECN. Then shift the DSCP left by 2 bits and combine it with the ECN to form the Traffic Category field of the IPv6 protocol.

[0031] According to another aspect of the present invention, a system for accessing an IPv4 single-stack network using a Wi-SUN border routing module based on an MCU is also provided, comprising: an end device, a tail module communicatively connected to the end device, a gateway communicatively connected to the tail module, and a field device communicatively connected to the gateway;

[0032] The gateway includes a headend module and a WAN port. The headend module, tailend module, and end device all include an MCU. The MCU of the end device is connected to the MCU of the tailend module via a serial port. The MCU of the tailend module is connected to the MCU of the headend module via radio frequency communication. The headend module is connected to the WAN port via a serial port, and the serial communication protocol is SLIP. The gateway is connected to a router through the WAN port and to the internet through the router.

[0033] The MCU can implement the method described above for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network.

[0034] According to another aspect of the present invention, a system for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network is also provided, comprising: an end device, a tail module communicatively connected to the end device, a gateway communicatively connected to the tail module, and a field device communicatively connected to the gateway;

[0035] The gateway includes a headend module and a communication module. The headend module, tailend module, and end device all include an MCU. The MCU of the end device is connected to the MCU of the tailend module via a serial port. The MCU of the tailend module is connected to the MCU of the headend module via radio frequency communication. The headend module is connected to the communication module via a serial port using the SLIP protocol. The gateway connects to a base station through the communication module and to the internet network through the base station.

[0036] The MCU can implement the method described above for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network.

[0037] Implementing one of the above-described technical solutions of the present invention has the following advantages or beneficial effects:

[0038] This invention utilizes Network Address Translation (NAT) technology, employing an MCU-based IP64 module, which acts as a network translation layer, to connect IPv6-only networks to IPv4 networks. This allows resource-constrained IoT devices to access IPv4 resources via IPv6 networks. Furthermore, it overcomes the protocol compatibility barriers between IPv6 and IPv4, and the developed method for accessing IPv4 bridges the protocol gap, enabling seamless data flow between the two types of networks. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:

[0040] Figure 1 This is a flowchart of a method for a MCU-based Wi-SUN border routing module to access an IPv4 single-stack network according to an embodiment of the present invention.

[0041] Figure 2 This is a structural block diagram of a gateway access router based on MUC according to an embodiment of the present invention;

[0042] Figure 3 This is a block diagram of a gateway based on MUC using a 4G module to access a base station, according to an embodiment of the present invention. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of the present invention clearer, various exemplary embodiments described below will be referenced to the accompanying drawings, which form part of the exemplary embodiments, illustrating various exemplary embodiments that may be used to implement the present invention. Unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. It should be understood that they are merely examples of processes, methods, and apparatuses consistent with some aspects of the present invention disclosed as detailed in the appended claims, and other embodiments may be used, or structural and functional modifications may be made to the embodiments listed herein without departing from the scope and spirit of the present invention.

[0044] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," etc., indicate the orientation or positional relationship based on the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the referred element must have a specific orientation, or be constructed and operated in a specific orientation. The terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. The term "multiple" means two or more. The terms "connected" and "linked" should be interpreted broadly, for example, they can be fixed connections, detachable connections, integral connections, mechanical connections, electrical connections, communication connections, direct connections, indirect connections through an intermediate medium, and can be the internal connection of two elements or the interaction relationship between two elements. The term "and / or" includes any and all combinations of one or more of the related listed items. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0045] To illustrate the technical solution described in this invention, specific embodiments are described below, showing only the parts related to the embodiments of this invention.

[0046] During the process of Wi-SUN network accessing IPv4, due to the fundamental differences between the two in protocol design, network characteristics, and application scenarios, a series of technical challenges will be faced, mainly in the following aspects:

[0047] 1. Conversion complexity caused by protocol stack differences

[0048] Wi-SUN is designed based on the IPv6 protocol stack, but IPv4 and IPv6 have fundamental differences in their core mechanisms, which creates a natural obstacle to protocol conversion.

[0049] 2. Incompatible address formats

[0050] IPv6 uses 128-bit addresses (providing a massive address space), while IPv4 uses only 32-bit addresses (with limited address resources). Their address spaces do not overlap and cannot be directly mapped. For example, when a Wi-SUN node (with an IPv6 address) needs to communicate with an IPv4 server, address translation must be performed through a gateway such as NAT64. However, large-scale Wi-SUN networks (potentially containing tens of thousands of nodes) can lead to insufficient IPv4 address pools, requiring dynamic management of address mapping tables and increasing the complexity of the translation logic.

[0051] 3. Differences between header and protocol mechanisms

[0052] IPv6 simplifies the IPv4 header structure (e.g., removing the checksum field and optimizing the options field) and adds unique mechanisms such as Neighbor Discovery Protocol (NDP) and Stateless Address Autoconfiguration (SLAAC), while IPv4 relies on Address Resolution Protocol (ARP) and DHCPv4. During the conversion process, header fields need to be adapted (e.g., the IPv6 flow label field has no corresponding entry in IPv4), which may lead to the loss of some functions or data parsing errors.

[0053] 4. Incompatible routing protocols

[0054] Wi-SUN networks typically use RPL (Random Low Power Lossy Network Routing Protocol) for mesh networking routing, while IPv4 networks mostly use routing protocols such as OSPF and RIP. The two have different routing algorithms and metric design logics (e.g., RPL focuses more on energy consumption and link stability, while IPv4 routing focuses more on bandwidth and latency). The switching gateway needs to maintain two types of routing tables at the same time, which increases the difficulty of route synchronization.

[0055] Based on the above facts, one method implemented by this invention is a converter between IPv6 and IPv4 packets. IPv6 packets originate from an IPv6 network and are converted into data from a single IPv4 host. IPv6 networks are typically low-power radio frequency networks, such as Wi-SUN FAN1.0 subnet data, while IPv4 networks are typically Ethernet.

[0056] Example 1: As Figure 1 As shown, this invention provides a method for an MCU-based Wi-SUN border routing module to access an IPv4 single-stack network. It connects the Wi-SUN network and the IPv4 single-stack network via an MCU-based IP64 module. The IP64 module has both IPv4 and IPv6 addresses, thereby connecting the IPv6-only network to the IPv4 network, allowing resource-constrained IoT devices to access IPv4 resources through the IPv6 network. The method includes the following steps:

[0057] S1. Parse the destination address of the received data packet and obtain the transport layer protocol type based on the IP header of the data packet.

[0058] Based on the above embodiments, when the MCU-based IP64 module is enabled, the gateway receives an IPv6 data packet from its low-power wireless interface, such as IEEE 802.15.4.

[0059] Before parsing the destination address of the received data packet, a mapping is established between the IPv6 addresses of all node devices within the IPv6 subnet and the IPv4 address of the WAN port of the IPv6 subnet. This involves mapping the IPv6 addresses of all node devices within the IPv6 subnet to the IPv4 addresses of the WAN port of the IPv6 subnet, resulting in a mapping linked list. The IPv4 addresses are obtained from the IPv4 network via DHCP (Dynamic Host Configuration Protocol), and these dynamically obtained IPv4 addresses are provided to the MCU-based IP64 module through interface functions.

[0060] Furthermore, the structure member variables of the mapping linked list include the linked list pointer, timer, Wi-SUN node IPv6 address, WAN port IPv4 address, number of protocol conversions, bound port number, Wi-SUN network IPv6 port number, WAN port IPv4 port number, and the converted protocol.

[0061] It is understandable that the mapping list is used to implement the mapping process between IPv6 address ports and IPv4 address ports, thereby managing the mapping relationship between IPv6 and IPv4 addresses.

[0062] In a specific implementation, a linked list of struct ip_addrmap (address mapping table) is created, and the main structure member variables are defined as follows:

[0063] {struct addrmap_entry next(linked list pointer);

[0064] struct timer timer(timer);

[0065] Ipv6Addr ip6addr (Wi-SUN node IPv6 address);

[0066] IPv4Addr ip4addr (WAN port IPv4 address);

[0067] uint32_t 6to4, 4to6 (number of protocol conversions);

[0068] uint16_t port(bound port number);

[0069] uint16_t ipv6port (Wi-SUN network IPv6 port number);

[0070] uint16_t ipv4port (WAN port IPv4 port number);

[0071] uint8_t protocol (converted protocol);

[0072] uint8_t flags}.

[0073] Based on the above embodiments, the transport layer protocol types are defined as follows:

[0074] #define IP_PROTO_ICMPV4 1;

[0075] #define IP_PROTO_TCP 6;

[0076] #define IP_PROTO_UDP 17;

[0077] #define IP_PROTO_ICMPV6 58;

[0078] The transport layer protocol determines the protocol type of a data packet based on the "Protocol" field (IPv4) or the "Next Header" field (IPv6) in the IP packet header. Specifically,

[0079] If the value of this field is 1, it means that the IP packet carries ICMP protocol data;

[0080] If the value of this field is 6, it means that the IP packet carries TCP protocol data;

[0081] If the value of this field is 17, it means that the IP packet carries UDP protocol data;

[0082] If the value of this field is 58, it means that the IPv6 packet carries ICMPv6 protocol data.

[0083] According to the IP header of the data packet, if its transport layer protocol type identifier is 1, it indicates that the received data packet is based on the IPv4 protocol, and is referred to as an IPv4 data packet. If its transport layer protocol type identifier is 58, it indicates that the received data packet is based on the IPv6 protocol, and is referred to as an IPv6 data packet.

[0084] Furthermore, when parsing the destination address of the received data packet, a temporary port mapping (NAT) is created for the source device corresponding to the IPv6 protocol that initiated the request, so that the data packet replied by the IPv4 server is correctly translated and sent back to the source device corresponding to the IPv6 protocol.

[0085] S2. Based on the transport layer protocol type, if the data packet is determined to be an IPv4 data packet, it is processed by the transport layer; if the data packet is determined to be an IPv6 data packet, it is determined whether to forward it based on the static routing table. If so, the IPv6 data packet is forwarded; otherwise, it is processed by the transport layer.

[0086] S3. When the transport layer receives a data packet, it sends the IPv4 data packet directly through the IPv4 interface. For IPv6 data packets, when the resolved destination address does not contain the Wi-SUN subnet device prefix, it converts the IPv6 header into an IPv4 header, and forwards the converted data packet through the IPv4 interface.

[0087] In this step, the Wi-SUN subnet device prefix can be 64:ff9b. When the resolved destination address contains the Wi-SUN subnet device prefix, it indicates that the data packet's target is a Wi-SUN subnet device, and its corresponding protocol is IPv6, so no conversion is needed. Furthermore, when the resolved destination address contains the Wi-SUN subnet device prefix, it is processed through the normal IPv6 routing procedure, for example, forwarded to another IPv6 network.

[0088] Based on the above embodiments, converting an IPv6 packet header into an IPv4 packet header includes the following steps:

[0089] Use the IPv4 address of the IP64 module as the source address;

[0090] Extract the IPv4 address that is pre-configured after the IP64 prefix in the data packet and use it as the destination address;

[0091] Adjust the IPv6 checksum to the IPv4 checksum;

[0092] Convert the ICMPv6 header associated with the IPv6 protocol to the ICMPv4 header associated with the IPv4 protocol.

[0093] The IP64 prefix mentioned above can be 64:ff9b:: / 96. The MCU-based IP64 module resolves IPv6 destination addresses by extracting the IPv4 address embedded after the IP64 prefix in the IPv6 packet header. For example, the destination address 64:ff9b::c000:202 (i.e., 64:ff9b::192.0.2.2) will be resolved to the IPv4 address 192.0.2.2.

[0094] The conversion between ICMPv6 and ICMPv4 headers includes: the Type / Code fields in both headers; IPv4 and IPv6 values ​​are interchangeable. However, the checksum calculation methods differ between IPv6 and IPv4; IPv6 requires calculation of Options, while IPv4 does not. Therefore, adjustments are needed to adapt the IPv6 checksum calculation method to match that of IPv4. The checksum is then used to determine the integrity of IPv4 and IPv6 data packets.

[0095] Understandably, the payload data usually remains unchanged during the process of converting the IPv6 header to the IPv4 header.

[0096] Furthermore, converting the IPv6 header to the IPv4 header also includes:

[0097] The version number has been changed to 0x45;

[0098] In IPv4, the ToS (Type of Service) is set to 0;

[0099] In IPv4, the identifier is 0, the flag is 0, and the slice offset is 0;

[0100] The IPv6 limit on the number of entries is equal to the IPv4 TTL (Time to Live).

[0101] In this embodiment, the IPv4 data packet or the IPv6 data packet is also sent via the SLIP protocol, and the process includes:

[0102] After receiving data packets via the serial port, the data packets are parsed.

[0103] Determine if the parsed data packet contains the first string; if so, perform an escape sequence on the first string, that is, convert the first string (0xC0) to ESC (0xDB) + ESC_END (0xDC), and then determine if the parsed data packet contains the second string; otherwise, determine if the parsed data packet contains the second string.

[0104] If the parsed data packet contains a second string, the second string is identified and escaped. Then, the second string (0xDB) of the data packet is converted to ESC (0xDB) + ESC_END (0xDD). After that, the data packet is added to the receive buffer. If the data packet length exceeds the maximum allowed length, the data packet is discarded and the serial port receive data status is reset. If the data packet reception is complete, the data packet is passed to the upper layer protocol for processing.

[0105] If the parsed data packet does not contain the second string, the data packet is added to the receive buffer. If the data packet length exceeds the maximum allowed length, the data packet is discarded and the serial port receive data status is reset. If the data packet reception is complete, the data packet is passed to the upper layer protocol for processing.

[0106] For ease of understanding, in the SLIP (Serial Line IP) protocol, the above ESC(0xdb) + ESC_END (0xDC) and ESC (0xDB) + ESC_END (0xDD) are used as escape markers to ensure transparent data transmission.

[0107] It should be noted that before the serial port receives data packets, it also includes the initialization of the SLIP module, the serial port, and the processing task.

[0108] Furthermore, it also includes receiving IPv4 packets or IPv6 packets using the SLIP protocol, the process of which includes:

[0109] Parse the data packets received from the serial port;

[0110] Determine if the parsed data packet contains the first string. If so, escape the first string to the third string. Then, determine if the parsed data packet contains the second string. Otherwise, determine if the parsed data packet contains the second string.

[0111] If the parsed data packet contains a second string, escape the second string into a fourth string. Once the data reading is complete, call the serial port to send the data.

[0112] If the parsed data packet does not contain the second string, the data reading is complete, and the serial port is called to send the data.

[0113] The first string above is the frame escape character 0xC0, the second string is the frame escape character 0xDB, both defined by the SLIP link layer protocol. The third escaped string is 0xDC, 0xDB. The fourth escaped string is 0xDD, 0xDB.

[0114] It should be noted that before the serial port receives data packets, it also includes sending application data from the protocol stack and reading data from the send buffer.

[0115] Furthermore, it also includes converting the header of IPv4 packets received from the IPv4 single-stack network into the corresponding IPv6 header before transmitting them to the Wi-SUN border routing module, including:

[0116] Extract the high 6 bits of the Service Type field of the IPv4 protocol as DSCP (Differential Code Point of Service), and the low 2 bits for ECN (Explicit Congestion Notification). Then, shift the DSCP left by 2 bits and combine it with the ECN to form the Traffic Category field of the IPv6 protocol.

[0117] Furthermore, converting the IPv4 packet header to the corresponding IPv6 header also includes: the IPv4 ToS (Type of Service) field contains a 3-bit field to identify the message priority (Precedence), 4 TOS bits, and 1 reserved bit.

[0118] In summary, this embodiment implements a network conversion layer whose core function is to perform bidirectional conversion between IPv6 networks (e.g., 6LoWPAN) and IPv4 networks (e.g., the traditional Internet), enabling pure IPv6 devices to communicate with IPv4 servers or hosts.

[0119] Example 2: Figure 2 As shown, this embodiment provides a system for an MCU-based Wi-SUN border routing module to access an IPv4 single-stack network, which is applied to the method described in Embodiment 1 for an MCU-based Wi-SUN border routing module to access an IPv4 single-stack network. The system includes: an end device, a tail module that communicates with the end device, a gateway that communicates with the tail module, and a field device that communicates with the gateway.

[0120] The gateway includes a headend module and a WAN port. The headend module, tailend module, and end devices all include an MCU. The MCU of the end device is connected to the MCU of the tailend module via a serial port. The MCU of the tailend module is connected to the MCU of the headend module via radio frequency communication. The headend module is connected to the WAN port via a serial port using the SLIP protocol. The gateway is connected to a router via the WAN port and then connected to the internet via the router. The field device is equipped with an RJ45 port, which is connected to the LAN port of the gateway.

[0121] Furthermore, the aforementioned MCU enables the implementation of the method described in Embodiment 1 for a MCU-based Wi-SUN border routing module to access an IPv4 single-stack network.

[0122] It is understandable that terminal devices refer to terminal devices that directly provide network services or data interaction to users, such as personal computers, tablets, smartphones, smart wearable devices, network cameras, etc.; field devices refer to dedicated networks for specific scenarios (such as power distribution networks), whose core equipment is similar to that of local area networks.

[0123] Example 3: Figure 3As shown, this embodiment provides a system for an MCU-based Wi-SUN border routing module to access an IPv4 single-stack network, which is applied to the method described in Embodiment 1 for an MCU-based Wi-SUN border routing module to access an IPv4 single-stack network. The system includes: an end device, a tail module that communicates with the end device, a gateway that communicates with the tail module, and a field device that communicates with the gateway.

[0124] The gateway includes a headend module and a communication module. The headend module, tailend module, and end devices all include an MCU. The MCU of the end device is connected to the MCU of the tailend module via a serial port. The MCU of the tailend module is connected to the MCU of the headend module via radio frequency communication. The headend module is connected to the communication module via a serial port using the SLIP protocol. The gateway is connected to the base station via the communication module and to the internet via the base station. The field device is equipped with an RJ45 port, which is connected to the LAN port of the gateway.

[0125] Furthermore, the aforementioned MCU enables the implementation of the method described in Embodiment 1 for a MCU-based Wi-SUN border routing module to access an IPv4 single-stack network.

[0126] It is understandable that terminal devices refer to terminal devices that directly provide network services or data interaction to users, such as personal computers, tablets, smartphones, smart wearable devices, network cameras, etc.; field devices refer to dedicated networks for specific scenarios (such as power distribution networks), whose core equipment is similar to that of local area networks.

[0127] The above description is merely a preferred embodiment of the present invention. Those skilled in the art will understand that various changes or equivalent substitutions can be made to these features and embodiments without departing from the spirit and scope of the present invention. Furthermore, under the teachings of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the protection scope of the present invention.

Claims

1. A method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network, characterized in that, Connecting a Wi-SUN network to an IPv4 single-stack network via an MCU-based IP64 module, wherein the IP64 module has both IPv4 and IPv6 addresses, includes the following steps: Parse the destination address of the received data packet and obtain the transport layer protocol type based on the IP header of the data packet; According to the transport layer protocol type, if the data packet is determined to be an IPv4 data packet, it is processed by the transport layer; if the data packet is determined to be an IPv6 data packet, it is determined whether to forward it according to the static routing table. If so, the IPv6 data packet is forwarded; otherwise, it is processed by the transport layer. When the transport layer receives the data packet, it sends the IPv4 data packet directly through the IPv4 interface; for the IPv6 data packet, when the resolved destination address does not contain the Wi-SUN subnet device prefix, it converts the IPv6 header into an IPv4 header, and forwards the converted data packet through the IPv4 interface. It also includes the transmission of the IPv4 packets or the IPv6 packets via the SLIP protocol, the process of which includes: After receiving the data packet via the serial port, the data packet is parsed. Determine whether the parsed data packet contains a first string; if so, perform identifier escaping processing on the first string, and then determine whether the parsed data packet contains a second string; otherwise, determine whether the parsed data packet contains the second string. If the parsed data packet contains the second string, the second string is identified and escaped. Then, the data packet is added to the receive buffer. If the length of the data packet exceeds the maximum allowed length, the data packet is discarded and the serial port receive data status is reset. If the data packet reception is complete, the data packet is passed to the upper layer protocol for processing. If the parsed data packet does not contain the second string, the data packet is added to the receive buffer. If the length of the data packet exceeds the maximum allowed length, the data packet is discarded and the serial port receive data status is reset. If the data packet reception is complete, the data packet is passed to the upper layer protocol for processing.

2. The method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network according to claim 1, characterized in that, It also includes, before parsing the destination address of the received data packet, establishing a mapping between the IPv6 addresses of all node devices within the IPv6 subnetwork and the IPv4 addresses of the WAN port of the IPv6 subnetwork, thus obtaining a mapping linked list.

3. A method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network according to claim 2, characterized in that, The structure member variables of the mapping linked list include a linked list pointer, a timer, the Wi-SUN node IPv6 address, the WAN port IPv4 address, the number of protocol conversions, the bound port number, the Wi-SUN network IPv6 port number, the WAN port IPv4 port number, and the converted protocol.

4. A method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network according to claim 1, characterized in that, The process of converting the IPv6 packet header into an IPv4 packet header includes the following steps: Use the IPv4 address of the IP64 module as the source address; Extract the IPv4 address that is pre-configured after the IP64 prefix of the data packet and use it as the destination address; Adjust the IPv6 checksum to the IPv4 checksum; Convert the ICMPv6 header associated with the IPv6 protocol to the ICMPv4 header associated with the IPv4 protocol.

5. A method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network according to claim 1, characterized in that, When parsing the destination address of the received data packet, a temporary port mapping is created for the source device corresponding to the IPv6 protocol that initiated the request.

6. A method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network according to claim 1, characterized in that, It also includes receiving the IPv4 packets or the IPv6 packets using the SLIP protocol, the process of which includes: The data packets received via the serial port are parsed; Determine whether the parsed data packet contains the first string. If so, escape the first string into the third string, and then determine whether the parsed data packet contains the second string; otherwise, determine whether the parsed data packet contains the second string. If the parsed data packet contains the second string, the second string is escaped into the fourth string. After the data reading is complete, the data packet is sent via the serial port. If the parsed data packet does not contain the second string, the data reading is complete, and the data packet is sent via the serial port.

7. A method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network according to claim 1, characterized in that, This also includes converting the header of IPv4 packets received from an IPv4 single-stack network into the corresponding IPv6 header before transmission to the Wi-SUN border routing module, including: Extract the high 6 bits of the Service Type field of the IPv4 protocol as DSCP, and the low 2 bits as ECN. Then shift the DSCP left by 2 bits and combine it with the ECN to form the Traffic Category field of the IPv6 protocol.

8. A system for accessing an IPv4 single-stack network using a Wi-SUN border routing module based on an MCU, characterized in that, include: End device, tail module communicatively connected to the end device, gateway communicatively connected to the tail module, and field device communicatively connected to the gateway; The gateway includes a headend module and a WAN port. The headend module, tailend module, and end device all include an MCU. The MCU of the end device is connected to the MCU of the tailend module via a serial port. The MCU of the tailend module is connected to the MCU of the headend module via radio frequency communication. The headend module is connected to the WAN port via a serial port, and the serial communication protocol is SLIP. The gateway is connected to a router through the WAN port and to the internet through the router. The MCU is capable of implementing the method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network as described in any one of claims 1-7.

9. A system for accessing an IPv4 single-stack network using a Wi-SUN border routing module based on an MCU, characterized in that, include: End device, tail module communicatively connected to the end device, gateway communicatively connected to the tail module, and field device communicatively connected to the gateway; The gateway includes a headend module and a communication module. The headend module, tailend module, and end device all include an MCU. The MCU of the end device is connected to the MCU of the tailend module via a serial port. The MCU of the tailend module is connected to the MCU of the headend module via radio frequency communication. The headend module is connected to the communication module via a serial port using the SLIP protocol. The gateway connects to a base station through the communication module and to the internet network through the base station. The MCU is capable of implementing the method for a Wi-SUN border routing module based on an MCU to access an IPv4 single-stack network as described in any one of claims 1-7.