Pluggable module-based LoRa multichannel communication extension method
Technical Field
The invention relates to the field of management of LoRa wireless communication equipment, in particular to a LoRa multichannel communication expansion method based on pluggable modules.
Background
In recent years, the LoRa wireless communication is widely concerned by the application field of the internet of things due to the characteristics of low power consumption, long transmission distance, simple and convenient erection and the like. The most basic LoRa communication system generally includes 3 parts of a base station, a relay, and a terminal. Within the allowable range of the communication distance, single-hop or multi-hop transmission can be realized between the base station and the terminal through the relay, and the protocol has strong customization and expansibility.
Most of the LoRa is currently applied in low-rate, low-data-volume situations, such as: and (5) remote meter reading and positioning. Along with the development of the application scene of the internet of things, the LoRa needs to be applied to the scene with high data information amount, all-weather work and certain real-time requirement, and for the requirements of data amount, workload and real-time property, the most direct processing method is to reduce communication conflict and carry out multi-channel communication expansion, thereby reducing the time of operations such as polling, conflict waiting and the like under one-to-many modes and improving the efficiency of channels. The LoRa multichannel expansion mode comprises the steps of increasing uplink and downlink communication nodes in the same channel or expanding links of a plurality of new channels, and the number of LoRa modules for parallel transceiving is increased on hardware.
At present, the communication application of the LoRa multichannel is not few, but related products in the aspect of channel instant dynamic expansion still lack in the LoRa technical field, and at present, no related technology is described that the LoRa expansion module can be expanded, managed and unloaded from a bus at any time under the condition that a mainboard works in a live state, so that multichannel dynamic configuration and dynamic expansion are realized, and a description about pluggable or plug and play of the LoRa multichannel expansion module is not found.
Disclosure of Invention
For the conditions of high data volume, all weather and real-time performance under working conditions, a base station, a relay or a terminal system cannot close a main board power supply for configuring multiple channels or maintaining a fault LoRa module. Under the condition that a system mainboard works in a charged mode, LoRa multiple channels can be expanded, managed and unloaded from a bus at any time, and the expansion and configuration modes are convenient and fast.
The invention discloses a pluggable module-based LoRa multichannel communication expansion method, which adopts a mainboard CPU to perform the functions of controlling and transmitting data of a plurality of pluggable module MCUs. The LoRa expansion card containing the MCU is convenient for customizing a software protocol, shortens development time and reduces development difficulty.
But plug module adopts the PCB expansion Card form that has the golden finger, contains embedded MCU, loRa communication chip and power management module, pilot lamp, and the expansion Card is passed the mode with the serial ports by mainboard power supply and adopt UART and mainboard UART to communicate, and the expansion Card has contained the plug that CD (Card Detect Card exists the detection) pin comes the detection Card, controls IO pin and MCU interaction customization control expansion Card function. Because the UART communication rate of the mainboard CPU and the LoRa expansion card is far higher than the LoRa transmission rate, the CPU ensures that the expansion card is in an idle state by inquiring the level of the IO port of the state of the expansion card and then carries out transparent transmission data interaction. The mainboard CPU monitors the state of the expansion card in real time through UART, CD pins and state IO.
LoRa extension card has hot plug protection circuit, ensures through the length design of design golden finger that power and signal are according to the order power-on, during the use disect insertion mainboard extension slot.
The intelligent multi-channel sensing and access protocol is adopted on software, after a main board CPU initializes each serial port and allocates and initializes a temporary buffer area, when a LoRa expansion card is inserted into a main board expansion slot and powered on, the automatic sensing and initializing process of the main board comprises the following steps:
step (1): when the CPU of the mainboard scans the GPIO state, the CD pin corresponding to the expansion slot is pulled down by the expansion card, so that the insertion of the card is detected; the LoRa expansion card comprises an MCU (microprogrammed control Unit), and can regularly send networking functions, ID numbers, channels, bit rates and card self-checking data frames through a serial port after being normally powered on, a CPU (central processing unit) starts a UART (universal asynchronous receiver/transmitter) port on a bus to be interrupted, stores and analyzes the data after stably reading a complete frame of data sent by the port, and determines that the serial port equipment type is the LoRa expansion card after judging that correct data information is received;
step (2): acquiring a configuration file, namely acquiring an expansion card configuration file from a local directory by a mainboard CPU (central processing unit), and if the expansion card configuration file cannot be detected, according to the networking function of the LoRa expansion card: when the expansion card is a base station expansion card, a request is sent to the cloud, a UDP (user datagram protocol) protocol is adopted to acquire a configuration file and store the configuration file locally, and when the expansion card is a relay or terminal expansion card, the configuration file is acquired in a configuration file packet mode through LoRa communication and is sent through an expansion card serial port and stored locally. The mainboard automatically resolves the local configuration file into a configuration command after acquiring the local configuration file;
and (3): the method comprises the steps that a LoRa expansion card is configured, a main board CPU issues a configuration command for an expansion card MCU through a serial port, a LoRa communication module on the expansion card acquires a new ID number, a channel and a bit rate, and the expansion card also acquires a routing table containing designated multi-hop transmission under the condition that a networking mode is a designated topological structure; after configuration is completed, the expansion card MCU sends a restart request, and the mainboard CPU controls the expansion card power supply to control IO to restart;
and (4): the restarted LoRa expansion card can automatically send data frames with updated networking functions, ID numbers, channels and bit rate information, and the configuration is successful if the data frames are compared and matched with the configuration files after being analyzed; if the comparison is not consistent, the configuration fails to be reconfigured; after configuration is successful, the operating system registers the expansion card device, and the mainboard CPU distributes cache resources and GPIO indicator lamps for the LoRa expansion card. Formally using the LoRa function of the channel;
and performing LoRa network updating after each expansion and unloading operation of the multiple channels, namely recording a log to update the channel state of the LoRa network, updating the network topology display, and reporting the northbound interface at regular time intervals of 5 min. The terminal and the relay send the device state to the base station through the LoRa network at regular time, and the base station device sends the device state to the internet cloud platform or the server, so that the visual management of the LoRa network is facilitated.
The uninstallation of loRa expansion card is very convenient, can be directly through the power management IO control with the power supply of expansion card cut off, also can direct physics dismantlement. When the expansion card is unloaded or fails to carry out UART communication, the CPU of the mainboard can remotely or locally detect, release resources and update the state of each expansion card in time. The process flow of manually unloading the forbidden LoRa certain channel comprises the steps of pulling down the power management IO, releasing the cache, keeping 1 path of indicator light and flashing, indicating that the module is normal but the channel is forbidden, and then updating the LoRa network.
There are two cases where multi-channel automatic offload over software and communication links occurs: 1) detecting that the CD pin of the expansion card is pulled high and the expansion port has equipment registration, and judging that the expansion card is directly and physically disassembled; 2) the CD pin is low, the power IO is pulled high, and when the UART cannot communicate for a long time and the restart frequency is more than three times, the card fault is judged. Case 1) the card is pulled out, the operation of the communication program of the expansion card is stopped, the cache and the LED resource are released, and the LoRa network is updated after the equipment is cancelled; case 2) card failure, stop expansion card communication program operation, release buffer memory and keep 1 way pilot lamp red light flashing, indicate that the card of this expansion card interface exists but is out of order, logout equipment then carries on LoRa network update.
The invention can realize hot plug and play of the LoRa multichannel expansion card, and greatly facilitates the channel expansion, management, unloading and maintenance of the LoRa communication system.
Drawings
FIG. 1 is a diagram of a multi-channel expansion hardware of a basic system motherboard and a LoRa expansion card according to the present invention;
fig. 2 is a flow of power-on sensing and initialization configuration for a motherboard CPU to perform multi-channel expansion on an LoRa expansion card according to an embodiment of the present invention;
fig. 3 is a flow chart of selecting a configuration mode of the LoRa expansion card according to the embodiment of the present invention;
fig. 4 is a flow of sensing and automatic operation of the main board CPU when the LoRa expansion card is pulled out according to the embodiment of the present invention.
Detailed Description
The following detailed description of the preferred embodiments of the present invention, taken in conjunction with the accompanying drawings, will make the advantages and features of the invention easier to understand by those skilled in the art, and thus will clearly and clearly define the scope of the invention.
Referring to fig. 1, the basic system of the present invention mainly comprises two components, namely, a system motherboard and an LoRa expansion card, wherein the system motherboard includes an embedded processor CPU1, a memory 2, an LED indicator light 3, a gigabit ethernet 4, other communication modules and interfaces 5, and an LoRa communication module expansion interface unit 6. The CPU is a processor with high performance, including MMU, and includes multiple peripheral interfaces and external memory 2 such as DDR, FLASH, e.mmc. The LED indicator 3 refers to a plurality of or multiple groups of indicator lamps for indicating networking status, when the extended LoRa multi-channel works, IO resources allocated to the extender card indicator lamps are correspondingly controlled by software, and the indicator lamps corresponding to the base station and the relay type extender cards indicate online and transceiving statuses of all nodes on their links by constantly lighting or flashing in addition to their own extender card statuses. The gigabit ethernet 4 is a debug interface, and can debug a system, transmit a configuration file, and the like through a network port, and the gigabit ethernet 4 under certain conditions can also be used as a communication mode in which a base station reports to a management server. Other communication modules and interfaces 5 are optional interfaces of the system, and can be LTE communication modules, USB and the like in a base station system mainboard; this module 5 may not be included in the repeater system motherboard; the terminal system mainboard can be used for indicating a GPS, an acquisition serial port and the like. The LoRa communication module expansion interface unit 6 is a hardware resource for inserting the LoRa expansion card, and includes a communication interface, an IO, an interrupt, a power supply wiring, and a PCB slot. The power module 7 is a power supply system of the main board, and after the direct-current power supply is connected, each power conversion chip is adopted to supply power to different modules, and the power conversion chips are provided with control IO (input/output) for power management. The mainboard is all the power supplies of loRa expansion card inserted, and power supply current has certain margin.
As shown in fig. 1, the LoRa expansion card includes an embedded MCU8, a power supply management module 9, an LoRa transceiver chip 10, and an antenna. The embedded MCU8 may be a low power chip without MMU, with simple peripherals and built-in small amounts of memory. The power supply management module 9 is a power conversion module for supplying power to the MCU, the transceiver chip and the antenna, and includes management IO for controlling power on and off of the expansion card through the motherboard. The LoRa transceiver chip 10 is a main device that performs communication transceiving functions and is mainly managed by the MCU 8.
Hardware resources required to be acquired from a mainboard by the LoRa expansion card comprise: and the power management resources comprise a power supply chip, a power control IO, an expansion card CD pin GPIO, a UART interface, a state IO and a control IO. The LoRa expansion card is provided with a hot plug protection circuit, and the power supply and the signals are ensured to be electrified in sequence by designing the length design of the gold finger. Besides, electrostatic protection measures are designed for signal lines and power lines involved in plugging and unplugging of the golden fingers of the PCB, and the direction of the standby GPIO of the expansion card is initialized to be Input to reduce current impact brought by plugging and unplugging.
Referring to fig. 2, fig. 2 illustrates a flow of power-on sensing and initialization configuration of a motherboard CPU for performing multi-channel expansion on an LoRa expansion card, where all processes are implemented in a form of middleware in a program of a motherboard, and plug-and-play and LoRa multi-channel communication expansion of the expansion card are implemented through the flow.
When the CPU operating system of the mainboard is initialized, the power supply of the expansion card is started, the detection of the GPIO corresponding to the CD pin of the expansion card is executed, and when the CD pin of a certain expansion card is detected to be pulled down, the expansion card is proved to be inserted. The variable setting of the restart times of the expansion card is set to be 0 in the plug-and-play program, the CPU reads the serial port corresponding to the CD pin and continuously monitors until a frame of complete data is obtained, and the frame of data is a data frame which is automatically sent to the UART port by the expansion card and contains networking function, ID number, channel, bit rate and card self-checking bit. If the receiving time is over, the CPU controls the expansion card to be powered off and restarted, if the complete data is still not correctly received after the expansion card is restarted for more than three times, the LoRa expansion card is judged to be abnormal, the IO of the power supply of the expansion card is pulled down, and the power supply is turned off. If the time is not over, the CPU analyzes and judges the data frame, firstly, the power-on self-test bit of the expansion card is checked, 0 is normal, 1 is abnormal, and when the self-test bit is judged to be 0, other information of the card is continuously analyzed to ensure that: when the expansion card is initialized, a special channel is configured, the bit rate is unified, and the ID can not conflict with the currently used network. And judging whether the module meets the configuration condition or not according to the information, and when the expansion card is judged to be abnormal, closing the power supply of the expansion card in time so as to avoid influencing the existing function work and waiting for further inspection. For an expansion interface with abnormal or damaged card, after the power supply of the expansion card is turned off, a mainboard CPU distributes 1-channel red card state indicator light, and the flash indicates that the expansion interface has the card but the card has the fault.
And when the expansion card is confirmed to meet the configuration conditions, configuring the LoRa expansion card, wherein the configuration items comprise LoRa communication module parameters (channel, bit rate, antenna transmission power) and network topology information (communication ID and communication routing table). And after the configuration is finished, the MCU of the expansion card sends a restart request, and the CPU restarts the power supply of the expansion card after receiving the information so as to enable the configuration to take effect. And after the system is restarted, the CPU receives new expansion card information to judge whether the configuration is successful, after the configuration is determined to be successful, the main board CPU registers the LoRa expansion card equipment in equipment management, remotely or locally updates a network topological graph, and meanwhile, the main board CPU distributes cache resources and indicator lamps IO for the LoRa expansion card. After the configuration is completed, the multichannel expansion of the LoRa is completed, and the LoRa communication program is started to run.
Referring to fig. 3, fig. 3 is a flowchart illustrating a selection of a configuration mode of an LoRa expansion card according to an embodiment of the present invention. In the configuration mode of the LoRa expansion card, the configuration management of the three expansion cards can be realized in a mode that a CPU locally acquires and analyzes configuration files and transmits configuration commands to an expansion card MCU by using a UART interface; when the expansion card is a base station, a configuration file can be remotely requested to a cloud or a server by adopting a UDP (user Datagram protocol); when the expansion card is in a relay or terminal form, the configuration file packet can be remotely issued through the LoRa base station module, the configuration file packet is transmitted to the mainboard CPU through the UART in a penetrating way to be unpacked, analyzed and converted into a configuration command, and then the configuration command is issued to the expansion card through the serial port. Configuration countermeasures are issued through a base station to some scenes: 1. remotely updating and configuring the existing relay and terminal expansion cards; 2. the multi-channel is expanded, and the terminal and the relay cannot obtain the configuration file from the local and the debugging is inconvenient; 3. and remotely starting relays and standby expansion cards of the terminals.
As shown in fig. 3, it can be seen that the flow of the expansion card configuration mode selection is that after the expansion card is determined to meet the configuration condition, the configuration file in the local directory is preferentially used, the configuration file is read, and the LoRa expansion card is configured and restarted. If the configuration file is not searched, whether the expansion card type belongs to the base station is judged, if the expansion card type belongs to the base station type, a data acquisition request is sent to a cloud end or a server, a UDP network protocol is adopted to transmit a configuration file data packet, the data packet is analyzed and then stored to the local, and the file configuration LoRa is read and restarted. When the expansion card is judged to belong to the relay or terminal type, the base station is required to initiate further configuration operation. Base station modules, devices or expansion cards are prepared to configure a dedicated channel, typically a free channel dedicated to the configuration and management device, which the dedicated base station must have a consistent dedicated channel and bit rate with the relay/terminal expansion card. The configuration special base station equipment packs the configuration file, initiates transmission, remotely issues an LoRa data packet to a relay or terminal equipment through LoRa communication, and a mainboard CPU obtains and analyzes the data packet in a serial port transparent transmission mode and stores the configuration file to the local. The MCU obtains and executes a corresponding configuration command from the UART, and the mainboard restarts the expansion card after configuration is completed.
Referring to fig. 4, fig. 4 is a flow of sensing and automatic operation of a main board CPU after a LoRa expansion card is pulled out according to an embodiment of the present invention, as shown in fig. 4, after a LoRa expansion card is pulled out, the CPU scans and finds that a CD pin of an original expansion card is at a high level, and the port has a device registration, determines that the expansion card has been pulled out, and at this time, to save system overhead, should stop a communication program related to the expansion card, and at the same time, log out the device and release cache and IO resources, update a network topology, delete the communication point, or display an offline. According to the embodiment, the equipment state and the multi-channel network state of the LoRa expansion card can be automatically updated without manual operation after the LoRa expansion card is pulled out from the mainboard.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.