FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Paper is getting angry, perceived this matter - Lorawan Development Kit Node Development Shallow

     

    "Click buy to view > > In the last evaluation (evaluation of lorawan industrial evaluation development kit), we tested the hardware part of lorawan industrial evaluation development kit of Xueli technology. This time, we want to try the software development of lorawan node module. Before starting the software section, solve a problem left over from the end of the previous article. In the hardware test in the previous article, we found that the transmission power index of the gateway was lower than the manual standard. After communicating with the manufacturer, the manufacturer said that there was a problem with the filter, and a modified gateway module was retested, After receiving the module sent by the manufacturer, it can be seen by comparison that the manufacturer removed the sound meter filter that may have problems mentioned by the author at the end of the previous article. In the following figure, the left figure shows the new module and the right figure shows the old module: Replace the new module and retest the transmission power index of the gateway. The transmission power can reach 23.5dbm. After passing through the filter and testing the cable line loss, it is basically close to 25dbm in the specification. The spectrum diagram test is as follows: Lorawan information The development kit is equipped with rich documentation and development routines for everyone to use and learn. At the same time, it is equipped with various software required by the development environment. See the directory tree structure for document information and routine code: Node source code analysis In the attached materials, the integrated development environment of node uses IAR, so the IAR for arm integrated development environment needs to be installed in advance. Before analyzing the code, review lorawan's network structure and node device types. Lorawan adopts a star topology. The gateway in the network forwards messages between nodes and servers, and the gateway accesses the network server through IP. Lora's node devices are divided into three types: classA, ClassB and ClassC. Their respective characteristics are as follows: ClassA: Class A equipment allows two-way communication, but the receiving opportunity of class a equipment is to wait two times to receive the data from the gateway after class a equipment actively uploads the data. If no data is sent to it within these two times, it will close the RF module to reduce energy consumption. The characteristic of class a equipment is that it can stay dormant and reduce energy consumption, Only when there is data to be uploaded can the RF unit be activated for data transmission. However, the obvious disadvantage of class a equipment is that the downlink delay is uncertain. The node must have uplink data before the downlink data can be distributed to the node. ClassB: in addition to the characteristics of class a equipment, class B equipment also has a receiving time window that is opened periodically to periodically check whether the gateway has data to send to itself. Therefore, on the basis of class a equipment, class B equipment needs to synchronize the time with the gateway, and the server also needs to know when class B equipment will open the receiver, so as to send the data to the node through the gateway at the appropriate time. Through the adjustment of time cycle, the delay of downlink data and energy consumption can be adjusted to a reasonable position. ClassC: Class C devices have longer receiving time. Except for sending, class C devices always open the receiving window. Class C devices also have the highest energy consumption, but they have the lowest communication delay. These three types of node devices have three different behavior modes. The lorawan node library provided by Semtech contains the code to realize these three modes. The structure of the code is as follows: RF development board recommendations: Usb-kw41z: USB dongle is used as a wireless packet sniffer to monitor wireless communication Mrf24j40mc-i / RM: surface mount module conforming to 2.4GHz IEEE 802.15.4 standard X-nucleus-nfc02a1: a dynamic NFC / RFID tag IC with dual interface EEPROM The following uses the lpmd002 model test code in the kit, and the file path is as follows: Unzip the file lpmd002-sdk-v2.00. Find the loranode.eww file in the IAR directory of the extracted directory. Open it with IAR and compile it first. First, check the development environment and second, let the IDE generate a symbol table to facilitate the jump when reading the code. The structure and function of the source code are described as follows: App: the top-level behavior description of the sensor node. The behavior logic of sensor class A, class B or class C is also in this file. In the source directory, there are three folders under the app directory, namely classA, ClassB and ClassC. Each folder has a main. C file and commissioning. H file. Commissioning. H stores the configuration parameter macros related to the application layer. Broads: the files related to the hardware board are stored in the broads directory, including the two subdirectories of MCU and sensornode. The entry of system interrupt program is configured in MCU, and the driver related to the hardware of sensor node is stored in sensornode. Mac: the MAC directory is the implementation code of lorawan MAC layer, which generally does not need to be modified. Radio: the radio directory is the driver of RF chip sx1278, which encapsulates the basic operation method of the chip and data transceiver. System: the directory mainly contains the implementation methods of some intermediate components, such as encryption algorithm, FIFO queue, GPIO operation encapsulation, timer, serial port transceiver, etc. Output: compile the output file. Key parameters and macro definitions As mentioned earlier, some application layer parameters and configuration macros are saved in commissioning. H under the app directory. Now let's take a look at the contents. #define OVER_ THE_ AIR_ ACTIVATION Define the network access mode of the node. The lorawan node has two network access modes, one is OTAA and the other is ABP. The encryption key and address of ABP are pre allocated. The node can send data directly without network access action, while OTAA is dynamically allocated during network access, which has higher security, but the cost is complex implementation and more interaction times required for network access. #define LORAWAN_ PUBLIC_ NETWORK Define whether the network of lorawan is public or private. #define LORAWAN_ DEVICE_ EUI Defines the unique identification code of the device. #define LORAWAN_ APPLICATION_ EUI The unique identification code of the application is defined. There may be multiple applications on a server, which is used by the server to distinguish which application the node belongs to. #define LORAWAN_ APPLICATION_ KEY Applied encryption key #define LORAWAN_ NETWORK_ ID Defines the ID of the network to join #define LORAWAN_ DEVICE_ ADDRESS Define the network address of the device. If it is OTAA network access, the network address is automatically obtained by the gateway allocation node. If it is ABP mode, because there is no network access action, the node needs to configure the address information. #define LORAWAN_ NWKSKEY Define the encryption key of lorawan network data. If it is OTAA mode, the password will be negotiated when accessing the network. If it is ABP mode, it needs to be configured. #define LORAWAN_ APPSKEY Define the encryption key of lorawan application data. If it is OTAA mode, the password will be negotiated when accessing the network. If it is ABP mode, it needs to be configured. The above are application related parameters. Another noteworthy parameter is the underlying parameters of lorwan. These parameters are in loramac-definitions. H and loramac. H. because there are too many parameters, here are only a few important ones: #define RECEIVE_ DELAY1 #define RECEIVE_ DELAY2 These two delay times are the two receiving time lengths of class A and B devices mentioned earlier. RF development board recommendations: Usb-kw41z: USB dongle is used as a wireless packet sniffer to monitor wireless communication Mrf24j40mc-i / RM: surface mount module conforming to 2.4GHz IEEE 802.15.4 standard X-nucleus-nfc02a1: a dynamic NFC / RFID tag IC with dual interface EEPROM Program mainstream analysis Next, analyze the main process of the code, open the source code main. C, find the main function, and you can see the following structure: while( 1 ) { switch( DeviceState ) { case DEVICE_ STATE_ INIT: { //Perform initialization, configure Lora related parameters, and then set the state machine state to device_ STATE_ JOIN break; } case DEVICE_ STATE_ JOIN: { // Execute the join operation, and set the status to device after success_ STATE_ SEND break; } case DEVICE_ STATE_ SEND: { // After sending, set the status to device_ STATE_ CYCLE break; } case DEVICE_ STATE_ CYCLE: { //Set the timer wake-up time and set the status to device_ STATE_ Sleep, device sleep break; } case DEVICE_ STATE_ SLEEP: { //The device is set to sleep above. When it is executed here, it indicates that sleep is awakened, execute the wake-up process, and initialize the peripherals reset during sleep. break; } default: { //Abnormal state, reset break; } } } According to the simplified code snippet extracted above, we can see that the state machine is used in the main loop of the node program, in which the devicestate variable records the state of the device and the initialization state is device_ STATE_ Init is executed in the while (1) cycle, and the initialization code will be executed. After initialization, it will enter the sending state to check whether data is to be sent. If there is no data, it will enter the standby mode. The device sets the wake-up timer and then sleeps to reduce power consumption. After the device wakes up, it will collect sensor data, and then change the state to the sending state, so as to keep the cycle, It realizes the standby wake-up sending data standby behavior of the device. In the previous test, we used APB to communicate with the gateway, that is, without network access negotiation. This time, we used oatt to access the network: 1. Modify the configuration file commissioning. H to over_ THE_ AIR_ Set the activation macro to 1 and use oatt mode; 2. Modify lorawan_ NETWORK_ ID macro, set the network ID to 0x123456, which corresponds to the network ID set on the gateway; 3. In the main cycle of the state machine mentioned above in main. C, set the timer wake-up time to 5 seconds, that is, wake up every 5 seconds to send data; 4. Record the deveui, appeui and appkey set in the configuration file, which are the unique ID number of the node, the ID number of the application corresponding to the device and the encryption password of the application. The network encryption password is not set here because it uses the automatic negotiation method and will be negotiated by itself when accessing the network; 5. Compile and confirm that there is no error. First open the serial port tool, select the USB serial port number corresponding to the test board, and then connect the downloader to download the program. After downloading, you can see the "test lorawa" string output when the serial port initialization is completed on the serial port, and there is the debugging information "+ join: starting..." output by the lorawan program below, which indicates that the program has been running normally. The node attempts to join the network, but does not return success, because we have not added the deveui of this device in the gateway, The gateway considers this to be an illegal device and does not respond to its join request. RF development board recommendations: Usb-kw41z: USB dongle is used as a wireless packet sniffer to monitor wireless communication Mrf24j40mc-i / RM: surface mount module conforming to 2.4GHz IEEE 802.15.4 standard X-nucleus-nfc02a1: a dynamic NFC / RFID tag IC with dual interface EEPROM Next, add a node device in the gateway and enter it in the browser http://10.10.1.105:8080 Here, 10.10.1.105 is the IP address of the gateway in the author's network environment. You can enter the router to view it if you need to modify it according to your own environment. After entering the address, type the user name admin password admin to enter the gateway management page, click devices in the side menu, and then click create in the upper left corner to start creating a device. Input deveui, appeui and appkey defined in commissioning. H, and select the frequency band to be used as 470-510mhz. Restart the module. It can be seen that "+ join: starting..." will be displayed a little after the module displays "+ join: done...". At this time, it means that the module has successfully accessed the network through OTAA. Five seconds after the successful join, the module sends a data packet and receives the ACK packet from the gateway. Here, the data has passed. Click the devices tab of the gateway to see that the node field of the device we just added is filled with ad922104. At the same time, in the node tab, we can see that in addition to the node with the address of 88888888 added in the last test, there is another ad922104. This address is the device address obtained by the device we just added through automatic negotiation through OTAA. In the received frames tab, we can see the data record received by the gateway. We can see that the gateway has received the data packet sent by the device with node address ad922104. The data is 31323334353638930616263646566, which is hex 0x31 0x32 0x33 0x 34 0x35 0x36 0x37 0x38 0x3

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us