Multi-protocol stack switching method for low-power-consumption remote wireless communication
By dynamically switching the protocol stack and peripheral circuits of wireless communication devices, the equipment consumption and cost problems caused by multi-module communication methods in the prior art are solved, and the effects of low power consumption, low complexity and high-efficiency communication are achieved.
Patent Information
- Application Number
- CN202411983274.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-18
AI Technical Summary
The use of multi-module communication methods in the prior art will result in excess consumption of the equipment in all aspects, increase hardware cost and complexity, and may still consume energy when not in use.
By detecting the current protocol stack of wireless communication devices and dynamically switching the protocol stack and corresponding peripheral circuits, the demand for multiple communication modules is reduced, and the software-level protocol stack switching and hardware-level RF circuit switching are realized.
It reduces the power consumption and hardware resource consumption of the equipment, simplifies the software development process, reduces maintenance costs and error rates, and improves the adaptability and communication efficiency of the equipment.
Smart Images

Figure CN119854389A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method for switching multiple protocol stacks in low-power long-distance wireless communication. Background Art
[0002] IoT communication technologies are used to realize data exchange and communication between various devices and systems. These technologies enable various smart devices to connect to each other, exchange data, and work together, thereby realizing intelligent management and control.
[0003] The existing IoT communication technology mostly adopts a multi-module communication method, that is, integrating multiple different types of communication modules in one system, such as Sigfox protocol stack module, LoRaWAN protocol stack / loRa module, to achieve more efficient and reliable data transmission and communication.
[0004] The defect of the prior art is that the communication method using multiple modules will generate unnecessary consumption in various aspects. When a device integrates multiple communication modules, each communication module needs to be controlled and managed by the main control chip, so the main control chip needs to process more data and instructions, increasing its workload. In order to support multiple modules, software developers need to write more code to handle different communication protocols and data formats. This not only increases the development workload, but also increases the possibility of code errors. At the same time, the integration of multiple communication modules will take up more motherboard space, including physical space and circuit layout. Excess consumption in various aspects means that more chips and peripherals are needed, which may lead to rising costs. Summary of the invention
[0005] In view of the above-mentioned defects of the prior art, the present invention provides a method for switching multiple protocol stacks for low-power long-distance wireless communication, which reduces the demand for multiple independent communication modules, has low power consumption of the device, and thus reduces hardware cost and complexity.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is: A method for switching multiple protocol stacks for low-power long-distance wireless communication includes the following steps: S1: Detect the current protocol stack A of the wireless communication device; the peripheral circuit switches to the first peripheral circuit a corresponding to the current protocol stack A; S2: Detecting uplink data under the current protocol stack A, and processing the uplink data through the first peripheral circuit a; S3: When an insertion task is generated, the micro control unit selects the insertion task protocol stack B, and transmits the downlink data through the second peripheral circuit b or the third peripheral circuit c corresponding to the insertion task protocol stack B.
[0007] Identify the protocol stack currently being used by the wireless communication device, that is, the current protocol stack A. Once the current protocol stack is determined, the peripheral circuit will switch to the first peripheral circuit a corresponding to the current protocol stack A. This means that the hardware configuration of the device will be adjusted to adapt to the requirements of the current protocol stack A. In step S2, the uplink data under the current protocol stack A is detected, and the uplink data is processed by the first peripheral circuit a. In this step, the device detects whether new uplink data has arrived. Once the uplink data is detected, the device uses the first peripheral circuit a corresponding to the protocol stack A to process the data. This includes receiving, decoding and possible response. Step S3: When an insertion task is generated, the micro control unit selects the insertion task protocol stack B, and transmits the downlink data through the second peripheral circuit b corresponding to the insertion task protocol stack B. When there is a new communication task to be processed, that is, an insertion task, the micro control unit (MCU) will select a new protocol stack according to the requirements of the task, that is, the insertion task protocol stack B. After selecting the insertion task protocol stack B, the device will switch to the second peripheral circuit b corresponding to the insertion task protocol stack B. By using the second peripheral circuit b, the downlink data related to the insertion task is transmitted.
[0008] Preferably, after the insertion task data transmission is completed, it is detected whether there is subsequent data to be sent; if there is no subsequent data to be sent, the protocol stack is switched to the current protocol stack A, and the peripheral circuit is switched to the first peripheral circuit a.
[0009] After executing an insertion task (such as urgent data transmission or specific instruction execution) and transmitting data through the insertion task protocol stack B, the device will perform the following operations: Detect the need for subsequent data transmission: The device will check whether there is more data that needs to be sent through the insertion task protocol stack B. When there is no subsequent data to be sent, the protocol stack is switched from the insertion task protocol stack B back to the original current protocol stack A. At the same time, the peripheral circuit is switched from the second radio frequency circuit b corresponding to the protocol stack B back to the first radio frequency circuit a corresponding to the protocol stack A. The advantage of doing this is that by detecting the need for subsequent data transmission, the device can avoid maintaining a high power consumption state when it is not needed, thereby saving energy and extending battery life. Switching the peripheral circuit back to the original configuration in time can reduce potential interference between different protocol stacks and improve communication quality. At the same time, by quickly switching back to the current protocol stack A, the device can maintain a continuous connection with the current network to ensure uninterrupted communication.
[0010] Preferably, the current protocol stack A includes a LoRa protocol stack and a LoRaWAN Class C protocol stack.
[0011] Preferably, the task protocol stack B includes a LoRaWAN Class A protocol stack, a LoRaWAN Class B protocol stack and a Sigfox protocol stack.
[0012] Among them, Sigfox can be understood as a short link with the public network. The public network cannot actively find Sigfox for data downlink. The Sigfox protocol stack needs to upload data first before there is a corresponding upload window. Class A in the LoRaWAN protocol stack is also similar to the upload method of the Sigfox protocol stack. Only after active uploading will there be a certain upload window. We define Class A and Class B of the Sigfox protocol stack and the LoRaWAN protocol stack as a way of active upload, which is executed as an insertion task. Class C of the LoRaWAN protocol stack and the ordinary LoRa mode belong to the communication mode that can be downlinked at any time. This mode is often used as the main working mode of wireless communication equipment, that is, the long link mode. Therefore, we will combine multiple communication modes, such as: LoRa (long link, can be awakened in time) + LoraWAN Class A / Class B + Sigfox protocol stack (event communication means, short-term occupation task); and LoRaWAN Class C (long link, common communication means) + Sigfox protocol stack.
[0013] Preferably, when the task protocol stack B is the Sigfox protocol stack, the step S3 comprises: calling an API of the Sigfox protocol stack to transmit the task data.
[0014] The MCU will call the application programming interface (API) provided by the Sigfox protocol stack. Through these APIs, the MCU encapsulates the task data into a format that the Sigfox protocol stack can recognize and process, and then sends this data through the Sigfox protocol stack network. The benefit of this is that by using the API of the Sigfox protocol stack, the compatibility of data transmission and compliance with the communication standards of the Sigfox protocol stack are ensured, ensuring that data can be correctly transmitted in the Sigfox protocol stack network. Using the API provided by the Sigfox protocol stack can simplify the development process because developers do not need to build communication protocols from the bottom up, but can directly use ready-made interfaces for development. Using standardized APIs can reduce development time and costs because APIs are usually optimized to efficiently handle communication tasks.
[0015] Preferably, the step S3 further comprises: receiving the task data within a window period; and switching the protocol stack to the current protocol stack A after the window period ends.
[0016] In step S3, a requirement is added to receive task data within a specific time window, which is called the "window period". Once this window period ends, the device switches the protocol stack from task protocol stack B back to current protocol stack A. The advantage of this is that the device receives data within the predetermined window period, which can reduce unnecessary energy consumption and delays and improve communication efficiency. By receiving data within the window period, the device can ensure that data from the Sigfox protocol stack network is received at the best time, thereby improving the integrity and reliability of data transmission. The device can dynamically switch protocol stacks according to the actual needs of the communication task and optimize the use of resources, especially in low-power and resource-constrained environments.
[0017] Preferably, when the current protocol stack A is the LoRa protocol stack, the step S2 includes: performing CAD detection of the LoRa protocol stack.
[0018] When the current protocol stack A is the LoRa protocol stack, the channel activity detection (CAD) of the LoRa protocol stack is performed. The benefits of this are: CAD detection can help the device determine whether the channel is idle, thereby reducing channel conflicts and interference and improving spectrum utilization. Through CAD detection, the device can confirm the channel status before sending data, reduce the risk of data collision, and improve communication reliability. In a dynamically changing wireless environment, CAD detection can help the device quickly adapt to changes in channel conditions and optimize communication strategies.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The present invention integrates the current protocol stack A and the inserted task protocol stack B, uses the protocol rules of the current protocol stack A and the corresponding first peripheral circuit a to transmit and process uplink data, and uses the protocol rules of the inserted task protocol stack B and the corresponding second peripheral circuit b to transmit and process downlink data. Compared with the technical solution of the prior art that requires multiple communication modules, the present invention reduces the demand for multiple communication modules by switching the protocol stack at the software level and switching the radio frequency circuit at the hardware level, thereby reducing the workload of the main control chip and reducing the consumption of hardware resources. By integrating multiple protocol stacks onto a single hardware platform, the amount of code is reduced, the software development process is simplified, the maintenance cost and error rate are reduced, and at the same time, the motherboard space is saved, and the demand for chips and peripherals is reduced, thereby reducing the overall cost.
[0020] 2. In the prior art, multiple communication modules may still consume energy when not in use. The present invention can dynamically switch protocol stacks as needed, so that the device can shut down the corresponding hardware when certain protocol stacks are not needed, thereby saving energy and extending the service life of the device.
[0021] 3. In the prior art, wireless communication devices may be limited to fixed communication modules. The present invention allows wireless communication devices to flexibly switch protocol stacks according to different communication requirements, thereby improving the adaptability and flexibility of the device.
[0022] 4. In the prior art, fixed communication modules may not be suitable for all communication environments. The present invention can optimize data transmission and improve communication efficiency and reliability, especially in a changing communication environment, by intelligently selecting the most suitable protocol stack. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of the method of the present invention. DETAILED DESCRIPTION
[0024] In order to make the technical means, creative features, objectives and effects of the invention easier to understand, the invention is further described with reference to specific diagrams. However, the invention is not limited to the following implementation cases.
[0025] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with this technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantive technical significance. Any structural modification, change in proportion or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical contents disclosed by the present invention.
[0026] Embodiment 1: like Figure 1 A method for switching multiple protocol stacks for low-power long-distance wireless communication is shown, comprising the following steps: S1: Detect the current protocol stack A of the wireless communication device; the peripheral circuit switches to the first peripheral circuit a corresponding to the current protocol stack A; S2: Detecting uplink data under the current protocol stack A, and processing the uplink data through the first peripheral circuit a; S3: When the insertion task is generated, the micro control unit selects the insertion task protocol stack B, and transmits the downlink data through the second peripheral circuit b or the third peripheral circuit c corresponding to the insertion task protocol stack B.
[0027] Currently, three protocol stacks are mainly used in the mainstream low-power long-distance wireless communication field: Sigfox protocol stack, LoRa protocol stack, and LoRaWAN protocol stack.
[0028] Among them, the Sigfox protocol stack uses UNB (Ultra-Narrow Band) ultra-narrow band technology, which transmits at a data rate of 100 or 600 bits per second in a 192kHz spectrum bandwidth, and the width of each message is 100Hz. UNB technology enables Sigfox protocol stack base stations to communicate over long distances and is not easily interfered with. The frequency band depends on the region, with Europe using 868-868.2MHz and the rest of the world using 902-928MHz. At the same time, the Sigfox protocol stack allows bidirectional transmission. After uplink transmission, if a frame with a downlink flag is allowed to downlink data within 25s after uplink.
[0029] LoRa protocol stack technology enables long-distance communication, with a wide coverage range, and the transmission distance can reach from several kilometers to tens of kilometers, which is particularly suitable for long-distance IoT applications. LoRa protocol stack devices and their communication protocols are designed to be low-power, so the devices can run for a long time, and even battery-powered devices can have a long service life. The deployment process of the LoRa protocol stack is simple. You only need to select a gateway deployment location and connect the network cable and power cable. It is suitable for IoT applications in various environments.
[0030] The LoRaWAN protocol stack supports long-distance communication with a coverage range of more than 15 kilometers, which is suitable for connecting devices in remote areas. The expected battery life of LoRaWAN protocol stack devices can reach 5-10 years, which is suitable for long-term operation of IoT devices. From terminal node sensors to initial infrastructure investment, the LoRaWAN protocol stack provides relatively low costs and is suitable for large-scale deployment. The LoRaWAN protocol stack standard ensures interoperability between different devices, facilitating large-scale deployment and maintenance.
[0031] The LoRaWAN protocol stack has three upload modes: Class A mode. Class A mode is the lowest power mode and is suitable for low-power, intermittent communication scenarios. After each uplink communication, the device will open two short downlink receiving windows to ensure that it can receive a response from the server. This mode is suitable for terminals that rely on battery power, such as environmental monitoring sensors and remote meter reading equipment.
[0032] Class B mode. Class B mode adds the function of periodic reception window based on Class A. The power consumption is slightly higher than Class A, but it has higher reception flexibility. The device opens the reception window by receiving a synchronization signal (beacon) from the gateway, so that the server can send data to the device within a predetermined time. This mode is suitable for scenarios with high latency requirements and the need to receive control information regularly, such as smart lighting and device control.
[0033] Class C mode. Class C mode consumes the most power but provides the lowest communication latency. The device's receive window is almost always open and is only closed briefly when sending data. This mode is suitable for applications that are not limited by power consumption and have high real-time requirements, such as industrial automation and real-time control systems.
[0034] Identify the protocol stack currently being used by the wireless communication device, that is, the current protocol stack A. Once the current protocol stack is determined, the peripheral circuit will switch to the first peripheral circuit a corresponding to the current protocol stack A. This means that the hardware configuration of the device will be adjusted to adapt to the requirements of the current protocol stack A. In step S2, the uplink data under the current protocol stack A is detected, and the uplink data is processed by the first peripheral circuit a. In this step, the device detects whether new uplink data has arrived. Once the uplink data is detected, the device uses the first peripheral circuit a corresponding to the protocol stack A to process the data. This includes receiving, decoding and possible response. Step S3: When an insertion task is generated, the micro control unit selects the insertion task protocol stack B and transmits the downlink data through the second peripheral circuit b corresponding to the insertion task protocol stack B. When there is a new communication task to be processed, that is, an insertion task, the micro control unit (MCU) will select a new protocol stack according to the requirements of the task, that is, the insertion task protocol stack B. After selecting the insertion task protocol stack B, the device will switch to the second peripheral circuit b corresponding to the insertion task protocol stack B. By using the second peripheral circuit b, the downlink data related to the insertion task is transmitted.
[0035] After the insertion task data transmission is completed, it is detected whether there is any subsequent data to be sent; if there is no subsequent data to be sent, the protocol stack is switched to the current protocol stack A, and the peripheral circuit is switched to the first peripheral circuit a. After executing the insertion task (such as urgent data transmission or specific instruction execution) and transmitting data through the insertion task protocol stack B, the device will perform the following operations: Detect the subsequent data transmission requirements: The device will check whether there is more data to be sent through the insertion task protocol stack B. When there is no subsequent data to be sent, the protocol stack is switched from the insertion task protocol stack B back to the original current protocol stack A. At the same time, the peripheral circuit is switched from the second radio frequency circuit b corresponding to the protocol stack B back to the first radio frequency circuit a corresponding to the protocol stack A. The advantage of doing this is that by detecting the subsequent data transmission requirements, the device can avoid maintaining a high power consumption state when it is not needed, thereby saving energy and extending battery life. Switching the peripheral circuit back to the original configuration in time can reduce potential interference between different protocol stacks and improve communication quality. At the same time, by quickly switching back to the current protocol stack A, the device can maintain a continuous connection with the current network to ensure uninterrupted communication.
[0036] The current protocol stack A includes the LoRa protocol stack and the LoRaWAN Class C protocol stack. The task protocol stack B includes the LoRaWAN Class A protocol stack, the LoRaWAN Class B protocol stack, and the Sigfox protocol stack. Among them, Sigfox can be understood as a short link with the public network. The public network cannot actively find Sigfox for data downlink. The Sigfox protocol stack needs to upload data first before there is a corresponding upload window. Class A in the LoRaWAN protocol stack is also similar to the upload method of the Sigfox protocol stack. There will be a certain upload window only after active uploading. We define Class A and Class B of the Sigfox protocol stack and the LoRaWAN protocol stack as an active upload method, which is executed as an inserted task. Class C of the LoRaWAN protocol stack and the ordinary LoRa mode belong to the communication mode where data can be downlinked at any time. This mode is often used as the main working mode of wireless communication equipment, that is, the long link mode. Therefore, we will combine multiple communication modes, such as: LoRa (long link, can be awakened in time) + LoraWAN Class A / Class B + Sigfox protocol stack (event communication method, short-term occupation task); and LoRaWAN Class C (long link, common communication method) + Sigfox protocol stack.
[0037] When the task protocol stack B is the Sigfox protocol stack, step S3 includes: calling the API of the Sigfox protocol stack to transmit the task data. The MCU will call the application programming interface (API) provided by the Sigfox protocol stack. Through these APIs, the MCU encapsulates the task data into a format that the Sigfox protocol stack can recognize and process, and then sends the data through the Sigfox protocol stack network. The advantage of this is that by using the API of the Sigfox protocol stack, the compatibility of data transmission and compliance with the communication standards of the Sigfox protocol stack are ensured, ensuring that the data can be correctly transmitted in the Sigfox protocol stack network. Using the API provided by the Sigfox protocol stack can simplify the development process, because developers do not need to build the communication protocol from the bottom up, but can directly use the ready-made interface for development. Using standardized APIs can reduce development time and cost, because APIs are usually optimized to efficiently handle communication tasks.
[0038] Step S3 also includes: receiving task data within the window period; switching the protocol stack to the current protocol stack A after the window period ends. In step S3, the requirement of receiving task data within a specific time window is added, and this time window is the "window period". Once this window period ends, the device switches the protocol stack from task protocol stack B back to the current protocol stack A. The advantage of this is that the device receives data within the predetermined window period, which can reduce unnecessary energy consumption and delays and improve communication efficiency. By receiving data within the window period, the device can ensure that data from the Sigfox protocol stack network is received at the best time, thereby improving the integrity and reliability of data transmission. The device can dynamically switch protocol stacks according to the actual needs of the communication task and optimize the use of resources, especially in low-power and resource-constrained environments.
[0039] When the current protocol stack A is the LoRa protocol stack, step S2 includes: performing CAD detection of the LoRa protocol stack. When the current protocol stack A is the LoRa protocol stack, a channel activity detection (CAD) of the LoRa protocol stack is performed. The advantage of this is that CAD detection can help the device determine whether the channel is idle, thereby reducing channel conflicts and interference and improving spectrum utilization. Through CAD detection, the device can confirm the channel status before sending data, reduce the risk of data collision, and improve communication reliability. In a dynamically changing wireless environment, CAD detection can help the device quickly adapt to changes in channel conditions and optimize communication strategies.
[0040] In this embodiment, under normal circumstances, the working state of the RF chip is the LoRa state, and the RF peripheral circuit is also switched by the MCU to the RF circuit corresponding to LoRa, and the CAD detection of LoRa is performed. When the access data of LoRa is detected, the data is received and processed, and the data is replied through the peripheral RF circuit of LoRa to achieve the communication of the private domain network. Since Class A and Class B of Sigfox and LoRaWAN are triggered by active upload, when the upload is scheduled or some alarms occur, the MCU determines and specifies the channel to be sent: If it is LoRa, keep the original channel unchanged; if you need to use LoRaWAN, switch to the corresponding RF circuit and protocol stack, send data to the LoRaWAN network through LoRaWAN (network access and data transmission or flag transmission), wait for data reception, check whether there is subsequent data to be sent after data reception is completed, if there is no data to be sent, switch the protocol stack to the LoRa protocol, and switch the RF circuit back to LoRa. If the corresponding channel is Sigfox, switch the peripheral circuit to the Sigfox communication circuit, call the official API of Sigfox to send data, receive data within the window period, and switch the protocol stack and circuit back to LoRA after the window period. When data exists in LoRa, LoRaWAN, and Sigfox at the same time and needs to be sent, wait for switching according to the order of LoRa WAN, Sigfox, and LoRa. Only one communication method can work at the same time. Except for LoRa, the other communication methods should maintain efficient processing and timely switching.
[0041] Embodiment 2: In this embodiment, under normal circumstances, the working state of the RF chip is the LoRaWAN Class C state, and the RF peripheral circuit is also switched by the MCU to the RF circuit corresponding to the LoRaWAN Class C to wait for and receive LoRaWAN Class C data. When the access data of LoRaWAN Class C is detected, the data is received and processed, and the data is replied through the peripheral RF circuit of LoRaWAN Class C to achieve communication in the private domain network.
[0042] Since Sigfox is triggered by active uploading, when scheduled uploading or some alarms occur, the MCU determines and specifies the channel to be sent. If it is LoRa, the original channel remains unchanged. If Sigfox is needed, switch to the corresponding RF circuit and protocol stack, send data to the Sigfox network through Sigfox (network access and data transmission or flag transmission), wait for data reception, and check whether there is subsequent data sending after data reception is completed. If no data is sent, switch the protocol stack to the LoRaWAN Class C protocol and switch the RF circuit back to LoRaWAN Class C.
Claims
1. A method for switching multiple protocol stacks for low-power long-distance wireless communication, characterized in that: The following steps are involved: S1: Detect the current protocol stack A of the wireless communication device; the peripheral circuit switches to the first peripheral circuit a corresponding to the current protocol stack A; S2: Detecting uplink data under the current protocol stack A, and processing the uplink data through the first peripheral circuit a; S3: When an insertion task is generated, the micro control unit selects the insertion task protocol stack B, and transmits the downlink data through the second peripheral circuit b or the third peripheral circuit c corresponding to the insertion task protocol stack B.
2. The method for switching multiple protocol stacks of low-power long-distance wireless communication according to claim 1, characterized in that: After the insertion task data transmission is completed, it is detected whether there is subsequent data to be sent; if there is no subsequent data to be sent, the protocol stack is switched to the current protocol stack A, and the peripheral circuit is switched to the first peripheral circuit a.
3. The method for switching multiple protocol stacks of low-power long-distance wireless communication according to claim 1, characterized in that: The current protocol stack A includes the LoRa protocol stack and the LoRaWAN Class C protocol stack.
4. The method for switching multiple protocol stacks for low-power long-distance wireless communication according to claim 3, characterized in that: The task protocol stack B includes the LoRaWAN Class A protocol stack, the LoRaWAN Class B protocol stack and the Sigfox protocol stack.
5. The method for switching multiple protocol stacks of low-power long-distance wireless communication according to claim 4, characterized in that: When the task protocol stack B is the Sigfox protocol stack, the step S3 includes: calling an API of the Sigfox protocol stack to transmit the task data.
6. The method for switching multiple protocol stacks of low-power long-distance wireless communication according to claim 1, characterized in that: The step S3 further includes: receiving the task data within a window period; and switching the protocol stack to the current protocol stack A after the window period ends.
7. The method for switching multiple protocol stacks for low-power long-distance wireless communication according to claim 4, characterized in that: When the current protocol stack A is the LoRa protocol stack, the step S2 includes: performing CAD detection of the LoRa protocol stack.