CN107846709B - Wireless communication device and wireless communication method based on LoRa - Google Patents
Wireless communication device and wireless communication method based on LoRa Download PDFInfo
- Publication number
- CN107846709B CN107846709B CN201710910568.0A CN201710910568A CN107846709B CN 107846709 B CN107846709 B CN 107846709B CN 201710910568 A CN201710910568 A CN 201710910568A CN 107846709 B CN107846709 B CN 107846709B
- Authority
- CN
- China
- Prior art keywords
- data
- radio frequency
- lora radio
- lora
- wireless communication
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/06—Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
- H04W28/065—Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information using assembly or disassembly of packets
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40052—High-speed IEEE 1394 serial bus
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/10—Flow control between communication endpoints
- H04W28/14—Flow control between communication endpoints using intermediate storage
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
- Communication Control (AREA)
Abstract
The invention provides a wireless communication device and a wireless communication method based on LoRa, and belongs to the field of communication. The wireless communication device comprises an MCU and more than two LoRa radio frequency chips, wherein the LoRa radio frequency chips are connected in parallel with a bus connected with the MCU, the LoRa radio frequency chips receive and transmit data in an interrupted mode, a receiving and transmitting interruption pin of each LoRa radio frequency chip is respectively connected with an external interruption pin of the MCU, and the MCU comprises a sub-packaging module, a LoRa radio frequency chip management module and a channel management module. The invention also provides a wireless communication method. The invention has the beneficial effects that: the problem of low data transmission rate of the LoRa radio frequency chip is effectively solved; packetization and packetization are fully optimized so that transmission rate and efficiency are greatly increased.
Description
Technical Field
The invention relates to the field of communication, in particular to a wireless communication device based on LoRa and a wireless communication method based on the wireless communication device.
Background
The single LoRa chip has the characteristics of long distance, low speed and low power consumption. The low data transmission rate (37.5kb/s) limits the application scenarios of LoRa, and many other scenarios in life require long distances, medium rates, and even high rates. Zigbee and wlan have higher transmission rate, but the distance is too close, so that certain life scenes cannot be better solved.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a wireless communication device based on LoRa and a wireless communication method based on the wireless communication device.
The wireless communication device comprises an MCU and more than two LoRa radio frequency chips, wherein the LoRa radio frequency chips are connected in parallel on a bus connected with the MCU, the receiving and sending of the LoRa radio frequency chips adopt an interrupt mode, the receiving and sending interrupt pin of each LoRa radio frequency chip is respectively connected with the external interrupt pin of the MCU,
the MCU comprises a packet packaging module which is used for splitting data into data pieces according to the length of the data, distributing corresponding LoRa radio frequency chips for parallel transmission, and assembling the received data pieces into data according to a data protocol;
the LoRa radio frequency chip management module is used for initializing each hardware and managing the receiving and sending data of the LoRa radio frequency chip; and the channel management module is used for setting the channel and the frequency of two wireless communication devices which are communicated with each other.
The invention is further improved, and the MCU is provided with an SPI interface and/or a USB interface.
The invention is further improved, and the LoRa radio frequency chip is connected in parallel with the SPI interface end of the MCU through the SPI bus.
The invention is further improved, and the LoRa radio frequency chips are respectively connected in parallel with the USB bus connected with the USB interface of the MCU through the USB to SPI chips.
The invention is further improved, and the LoRa radio frequency chip is an sx127x series radio frequency chip of Semtech company.
The invention also provides a wireless communication method based on the wireless communication device, which comprises the steps of data transmission and data reception, wherein,
the processing method of the data sending step comprises the following steps:
a1: starting, the LoRa radio frequency chip management module initializes external interrupt, SPI or USB bus related to the MCU and the LoRa radio frequency chip, and GPIO pin of the LoRa radio frequency chip;
a2: initializing all LoRa radio frequency chip related registers, configuring interruption, configuring a transceiving buffer and configuring fixed transceiving frequency by a channel management module;
a3: waiting for data to be sent;
a4: starting to send data, fragmenting the data according to the length of the data by a packet packaging module, and writing the data fragments into sending caches of different LoRa radio frequency chips respectively;
a5: configuring a LoRa radio frequency chip to send an interrupt, and after the data sheet is sent, the interrupt occurs;
a6: judging whether data need to be sent at this time, if so, executing the step A4, and if not, executing the step A3, wherein the processing method of the data receiving step comprises the following steps:
b1: starting, the LoRa radio frequency chip management module initializes external interrupt, SPI or USB bus related to the MCU and the LoRa radio frequency chip, and GPIO pin of the LoRa radio frequency chip;
b2: initializing all LoRa radio frequency chip related registers, configuring interruption, configuring a transceiving buffer and configuring fixed transceiving frequency by a channel management module;
b3: waiting for a data reception interrupt;
b4: receiving interruption occurs to the LoRa radio frequency chip, and data reception is started;
b5: clearing the receiving interrupt;
b6: and the packet packaging module is used for packaging the received data slices according to a data protocol.
The invention is further improved, in step a4, the method for processing the packets of the packet packaging module comprises: and starting, judging whether the total length of the data is greater than n × M, wherein n is the number of LoRa radio frequency chips, M is the sending buffer size of the LoRa radio frequency chips, if yes, dividing the data according to the maximum length of each packet of data as M, if not, dividing the length of each packet of data according to the total length divided by n, and ending.
The invention is further improved, in step B6, the group packaging processing method of the group packaging module includes:
b61: reading the data received and cached by the LoRa radio frequency chip in sequence according to the interrupt sequence;
b62: analyzing data according to a data protocol, and arranging the data according to a packet sequence;
b63: all the data pieces are received, and the process is finished.
In a further refinement of the present invention, the data protocol format includes a total number of packets, a packet order, a data length, data, and a CRC.
Compared with the prior art, the invention has the beneficial effects that: the problem of low data transmission rate of the LoRa radio frequency chip is effectively solved; the sub-package and the packet package are fully optimized, so that the sending rate and the sending efficiency are greatly increased; the long-distance characteristic of the LoRa radio frequency chip sx127x is fully utilized, and a novel long-distance and medium-speed wireless communication method is generated.
Drawings
FIG. 1 is a schematic structural diagram of an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of another embodiment of the present invention;
FIG. 3 is a flow chart of a method of data transmission;
FIG. 4 is a flow chart of a packetization method;
FIG. 5 is a flow chart of a data receiving method;
FIG. 6 is a flow chart of a packaging method;
FIG. 7 is a diagram of a data protocol format;
fig. 8 is a schematic diagram of a packetization scenario.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
As shown in fig. 1 and 2, the wireless communication device of the present invention includes an MCU (micro control unit) and more than two LoRa rf chips, wherein the LoRa rf chips are connected in parallel to a bus connected to the MCU, the LoRa rf chips receive and transmit data in an interrupted manner, and the interrupt pins of each LoRa rf chip are connected to the external interrupt pins of the MCU.
The MCU of this example is provided with an SPI (serial peripheral interface) interface and/or a USB interface. As an embodiment of the present invention, the LoRa rf chips are connected in parallel to the SPI interface of the MCU through the SPI bus, all the LoRa rf chips are mounted on the SPI bus of the MCU, and the transmit/receive interrupt pins of the LoRa rf chips are all connected to the external interrupt pins of the MCU.
As another embodiment, the LoRa rf chips of this example are respectively connected in parallel to the USB bus connected to the USB interface of the MCU through the USB to SPI chips, and all the LoRa rf chips first convert the SPI interface into the USB interface through the USB to SPI chip, and then mount the LoRa rf chips on the USB bus, and connect the transmit/receive interrupt pins of the LoRa rf chips to the external interrupt pins of the MCU.
The LoRa rf chip in this example is preferably an sx127x series rf chip provided by Semtech for terminal node communication, and has a long transmission distance.
In the embodiment, a wireless communication method based on long distance (3-30km) and medium speed of LoRa is constructed by mainly improving hardware and software and adopting a plurality of LoRa radio frequency chips for concurrence, so that data concurrence is realized, the problem of low data rate of the LoRa radio frequency chip sx127x is effectively solved, and the data sending speed and efficiency are greatly improved.
In terms of software, the MCU in this embodiment includes a packetization module, a LoRa rf chip management module, and a channel management module. The invention is described in detail by taking an sx127x radio frequency chip as an example.
The sub-packet packaging module is used for splitting the data into data pieces according to the length of the data, distributing corresponding LoRa radio frequency chips to send the data pieces in parallel, and assembling the received data pieces into the data according to a data protocol. The sub-packaging mainly considers that when the length of data is smaller than the sum of the sending buffers of all the LoRa radio frequency chips sx127x, the mode of uniform distribution sending is adopted, and some LoRa radio frequency chips sx127x are not sent, and other sending is not sent, so that the sending is faster.
The LoRa radio frequency chip management module is mainly used for initializing, receiving and sending data of the hardware of the sx127x radio frequency chip. The hardware initialization mainly includes the MCU related SPI or USB bus, the MCU and the related interrupts of sx127 x. Receiving and sending data is primarily the operation sx127x associated cache and interrupt tag registers.
A channel management module: for setting the channel and frequency of two wireless communication devices communicating with each other. If communication is required between two devices, the same channel and frequency are required to be set, for example, the channel and frequency of the first sx127x of the device a and the first sx127x of the device B are the same, and the remaining sx127x is similar.
The example also provides a wireless communication method based on the wireless communication device, which comprises the steps of data transmission and data reception.
As shown in fig. 3, the processing method of the data transmission step includes:
a1: starting, the LoRa radio frequency chip management module initializes the MCU, external interrupt, SPI or USB bus related to the LoRa radio frequency chip, and GPIO (general purpose input/output) pin of the LoRa radio frequency chip;
a2: initializing all LoRa radio frequency chip related registers, configuring interruption, configuring a transceiving buffer and configuring fixed transceiving frequency by a channel management module;
a3: waiting for data to be sent;
a4: starting to send data, fragmenting the data according to the length of the data by a packet packaging module, and writing the data fragments into sending caches of different LoRa radio frequency chips respectively;
a5: configuring a LoRa radio frequency chip to send an interrupt, and after the data sheet is sent, the interrupt occurs;
a6: and D, judging whether data need to be sent at the time, if so, executing the step A4, and if not, executing the step A3.
As shown in fig. 4, in step a4, the packetization processing method of the packetization module includes:
and starting, judging whether the total length of the data is greater than n × M, wherein n is the number of LoRa radio frequency chips, M is the sending buffer size of the LoRa radio frequency chips, if yes, dividing the data according to the maximum length of each packet of data as M, if not, dividing the length of each packet of data according to the total length divided by n, and ending.
As shown in fig. 5, the processing method of the data receiving step includes:
b1: starting, the LoRa radio frequency chip management module initializes external interrupt, SPI or USB bus related to the MCU and the LoRa radio frequency chip, and GPIO pin of the LoRa radio frequency chip;
b2: initializing all LoRa radio frequency chip related registers, configuring interruption, configuring a transceiving buffer and configuring fixed transceiving frequency by a channel management module;
b3: waiting for a data reception interrupt;
b4: receiving interruption occurs to the LoRa radio frequency chip, and data reception is started;
b5: clearing the receiving interrupt;
b6: and the packet packaging module is used for packaging the received data slices according to a data protocol.
As shown in fig. 6, in step B6, the group packaging method of the group packaging module includes:
b61: reading the data received and cached by the LoRa radio frequency chip in sequence according to the interrupt sequence;
b62: analyzing data according to a data protocol, and arranging the data according to a packet sequence;
b63: all the data pieces are received, and the process is finished.
As shown in fig. 7 and 8, the data protocol format includes a total number of packets, a packet order, a data length, data, and a CRC (Cyclic Redundancy Check).
When two or more wireless communication devices communicate, the wireless communication devices only need to be configured with the same channel and frequency and placed in the transmission distance range of LoRa, and medium-rate communication can be achieved. In this example, each wireless communication device includes 6 LoRa rf chips sx127x, and the theoretical transmission rate can reach 225kbs by using 6 LoRa rf chips sx127x for concurrence. This rate can be extended far beyond the application scenario of the previous single slice sx127x, and of course, if more slices sx127x are used, the transmission rate will be faster.
The MCU of the wireless communication device for transmitting data divides the data into n data pieces, then the data pieces are respectively distributed to 6 sx127x, the 6 sx127x are transmitted simultaneously, the wireless communication device for receiving the data also comprises 6 sx127x, the data are received in one-to-one correspondence with the 6 sx127x for transmitting the data, and after the data are received, the data are sequenced according to a packet sequence and assembled into original data.
The above-described embodiments are intended to be illustrative, and not restrictive, of the invention, and all changes that come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.
Claims (9)
1. A wireless communication device based on LoRa, characterized in that: comprises an MCU and more than two LoRa radio frequency chips, wherein the LoRa radio frequency chips are connected in parallel on a bus connected with the MCU, the receiving and sending of the LoRa radio frequency chips adopt an interrupt mode, the receiving and sending interrupt pin of each LoRa radio frequency chip is respectively connected with the external interrupt pin of the MCU,
the MCU comprises a packet packaging module which is used for splitting data into data pieces according to the length of the data, distributing corresponding LoRa radio frequency chips for parallel transmission, and assembling the received data pieces into data according to a data protocol;
the LoRa radio frequency chip management module is used for initializing each hardware and managing the receiving and sending data of the LoRa radio frequency chip;
and the channel management module is used for setting the channel and the frequency of two wireless communication devices which are communicated with each other.
2. The wireless communication apparatus of claim 1, wherein: the MCU is provided with an SPI interface and/or a USB interface.
3. The wireless communication apparatus of claim 2, wherein: the LoRa radio frequency chip is connected in parallel with the SPI interface end of the MCU through the SPI bus.
4. The wireless communication apparatus of claim 2, wherein: and the LoRa radio frequency chip is respectively connected with the USB bus connected with the USB interface of the MCU in parallel through a USB-to-SPI chip.
5. The wireless communication device according to any of claims 1-4, wherein: the LoRa radio frequency chip is an sx127x series radio frequency chip of Semtech company.
6. A wireless communication method based on the LoRa wireless communication apparatus of any one of claims 1-5, wherein: comprising a data transmission step and a data reception step, wherein,
the processing method of the data sending step comprises the following steps:
a1: starting, the LoRa radio frequency chip management module initializes external interrupt, SPI or USB bus related to the MCU and the LoRa radio frequency chip, and GPIO pin of the LoRa radio frequency chip;
a2: initializing all LoRa radio frequency chip related registers, configuring interruption, configuring a transceiving buffer and configuring fixed transceiving frequency by a channel management module;
a3: waiting for data to be sent;
a4: starting to send data, fragmenting the data according to the length of the data by a packet packaging module, and writing the data fragments into sending caches of different LoRa radio frequency chips respectively;
a5: configuring a LoRa radio frequency chip to send an interrupt, and after the data sheet is sent, the interrupt occurs;
a6: judging whether data need to be sent at the time, if so, executing the step A4, if not, executing the step A3,
the processing method of the data receiving step comprises the following steps:
b1: starting, the LoRa radio frequency chip management module initializes external interrupt, SPI or USB bus related to the MCU and the LoRa radio frequency chip, and GPIO pin of the LoRa radio frequency chip;
b2: initializing all LoRa radio frequency chip related registers, configuring interruption, configuring a transceiving buffer and configuring fixed transceiving frequency by a channel management module;
b3: waiting for a data reception interrupt;
b4: receiving interruption occurs to the LoRa radio frequency chip, and data reception is started;
b5: clearing the receiving interrupt;
b6: and the packet packaging module is used for packaging the received data slices according to a data protocol.
7. The wireless communication method according to claim 6, wherein: in step a4, the packetization processing method of the packetization module is:
firstly, judging whether the total length of the data is greater than n M, wherein n is the number of LoRa radio frequency chips, M is the size of a sending buffer of the LoRa radio frequency chips,
if yes, dividing the data according to the maximum length of each packet of data being M, if not, dividing the data length of each packet of data according to the total length by n, and ending.
8. The wireless communication method according to claim 6, wherein: in step B6, the group packaging processing method of the group packaging module is as follows:
b61: reading the data received and cached by the LoRa radio frequency chip in sequence according to the interrupt sequence;
b62: analyzing data according to a data protocol, and arranging the data according to a packet sequence;
b63: all the data pieces are received, and the process is finished.
9. The wireless communication method according to claim 7 or 8, wherein: the data protocol format includes a total number of packets, a packet order, a data length, data, and a CRC.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710910568.0A CN107846709B (en) | 2017-09-29 | 2017-09-29 | Wireless communication device and wireless communication method based on LoRa |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710910568.0A CN107846709B (en) | 2017-09-29 | 2017-09-29 | Wireless communication device and wireless communication method based on LoRa |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107846709A CN107846709A (en) | 2018-03-27 |
CN107846709B true CN107846709B (en) | 2021-08-24 |
Family
ID=61662178
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710910568.0A Active CN107846709B (en) | 2017-09-29 | 2017-09-29 | Wireless communication device and wireless communication method based on LoRa |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107846709B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110944310A (en) * | 2019-12-16 | 2020-03-31 | 众邦同力(武汉)技术有限公司 | Based on LoRaTMMulti-channel point-to-point communication apparatus and method of technology |
CN111093227B (en) * | 2019-12-30 | 2022-09-13 | 武汉阿迪克电子股份有限公司 | LoRaWAN-based wireless transmission data acquisition method and system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103049421A (en) * | 2012-12-11 | 2013-04-17 | 百度在线网络技术(北京)有限公司 | Method and device for data transmission between central processing unit (CPU) and co-processors |
CN105813099A (en) * | 2016-04-20 | 2016-07-27 | 西安电子科技大学 | Outdoor wireless communication system based on LoRa ad-hoc network |
CN107038854A (en) * | 2017-05-04 | 2017-08-11 | 甘肃中天华地自动化技术开发有限公司 | One-to-many long-distance remote control data collector and data receiving-transmitting method |
CN107071869A (en) * | 2016-11-15 | 2017-08-18 | 国动物联网技术(上海)有限公司 | Compatible LoRaWAN Class A, Class B and write by hand pattern multimode terminal and multimode compatibility method |
CN107172654A (en) * | 2017-06-14 | 2017-09-15 | 深圳市亿兆互联技术有限公司 | A kind of Lora data analyzers and data analysing method |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100461673C (en) * | 2005-12-02 | 2009-02-11 | 华为技术有限公司 | Data-bag interacting method and personal field network communication apparatus |
TWI593255B (en) * | 2016-03-09 | 2017-07-21 | 正文科技股份有限公司 | Method for controlling long range wide area network apparatus |
-
2017
- 2017-09-29 CN CN201710910568.0A patent/CN107846709B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103049421A (en) * | 2012-12-11 | 2013-04-17 | 百度在线网络技术(北京)有限公司 | Method and device for data transmission between central processing unit (CPU) and co-processors |
CN105813099A (en) * | 2016-04-20 | 2016-07-27 | 西安电子科技大学 | Outdoor wireless communication system based on LoRa ad-hoc network |
CN107071869A (en) * | 2016-11-15 | 2017-08-18 | 国动物联网技术(上海)有限公司 | Compatible LoRaWAN Class A, Class B and write by hand pattern multimode terminal and multimode compatibility method |
CN107038854A (en) * | 2017-05-04 | 2017-08-11 | 甘肃中天华地自动化技术开发有限公司 | One-to-many long-distance remote control data collector and data receiving-transmitting method |
CN107172654A (en) * | 2017-06-14 | 2017-09-15 | 深圳市亿兆互联技术有限公司 | A kind of Lora data analyzers and data analysing method |
Also Published As
Publication number | Publication date |
---|---|
CN107846709A (en) | 2018-03-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101971594B (en) | Methods and apparatus for formatting headers in a communication frame | |
RU2436147C2 (en) | Improved wireless usb protocol and usb hub | |
JP5474963B2 (en) | System and method for parallel communication with legacy WLAN receivers | |
US8601145B2 (en) | Inter-processor communication link with manageability port | |
CN111277988B (en) | Method for improving Bluetooth transmission speed of WeChat applet | |
CN107846709B (en) | Wireless communication device and wireless communication method based on LoRa | |
CN103581257A (en) | Data distribution method and device based on internet protocol | |
WO2022143536A1 (en) | Apsoc-based state cipher calculation method, system, device, and medium | |
EP2865163A1 (en) | Providing a serial protocol for a bidirectional serial interconnect | |
WO2014134947A1 (en) | Device for transmitting and receiving control information and method thereof | |
US11252043B2 (en) | Link group configuration method and apparatus | |
CN103842979A (en) | System and method for performing isochronous data buffering | |
CN102780618B (en) | Method and device for data message transmission | |
CN111065084A (en) | Method for improving low-power-consumption Bluetooth transmission speed | |
CN103701717A (en) | Method, device and system for processing user data in cloud base station | |
CN104918314B (en) | A kind of AP power consumption method of adjustment and device | |
CN218850770U (en) | One-to-many UART communication device | |
CN104202124A (en) | Erp (enterprise resource planning) data package communication method | |
CN108614786B (en) | Channel management circuit based on message service type | |
US11678224B2 (en) | Aggregating multiple data streams on a communication link | |
CN114844607B (en) | Beacon frame transmitting method, device, storage medium and AP | |
CN214125284U (en) | FPGA + DSP baseband | |
CN102695284B (en) | Processing method, equipment and system of downlink block data | |
CN217932696U (en) | Wireless WIFI communication device | |
CN106888173B (en) | Universal efficient message communication system and its method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |