Wiki source code of Got a raw LoRa packet from LoRaWAN gateway
Last modified by Kilight Cao on 2023/09/14 09:29
Hide last authors
author | version | line-number | content |
---|---|---|---|
11.3 | 1 | **Table of** **Contents:** | |
1.2 | 2 | ||
1.1 | 3 | {{toc/}} | |
4 | |||
5 | |||
9.1 | 6 | ||
11.4 | 7 | = 1. Below list the support products and Requirements: = | |
1.1 | 8 | ||
11.3 | 9 | ||
1.2 | 10 | 1. LoRaWAN Gateway model: [[LIG16>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/171-lig16.html]], [[LG308>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/140-lg308.html]], [[DLOS8>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/160-dlos8.html]] [[LPS8>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/148-lps8.html]] | |
11.5 | 11 | 1. Firmware version since : [[lgw~~-~~-build-v5.4.1644658774>>url:http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LIG16/Firmware/Release/]] | |
1.1 | 12 | ||
10.1 | 13 | ||
11.4 | 14 | = 2. Introduction = | |
11.3 | 15 | ||
1.1 | 16 | ||
2.1 | 17 | ((( | |
1.2 | 18 | By default, the LoRaWAN gateway cannot receive LoRa Packet, If the user needs to receive the raw LoRa Packet, the user can modify the file. | |
2.1 | 19 | ))) | |
1.1 | 20 | ||
2.1 | 21 | ((( | |
22 | Here are two ways to modify the received raw LoRa package. | ||
9.1 | 23 | ||
24 | |||
2.1 | 25 | ))) | |
1.1 | 26 | ||
11.4 | 27 | == 2.1 Method 1: == | |
1.1 | 28 | ||
11.4 | 29 | ||
2.3 | 30 | ((( | |
11.4 | 31 | (% style="color:blue" %)**root@dragino-1d178c:~~# vim /usr/bin/generate-config.sh** | |
2.3 | 32 | ))) | |
1.1 | 33 | ||
1.3 | 34 | (% class="box" %) | |
35 | ((( | ||
2.1 | 36 | ((( | |
2.2 | 37 | ((( | |
1.3 | 38 | gen_cus_cfg() { | |
1.2 | 39 | json_init | |
40 | json_add_object SX130x_conf | ||
41 | json_add_string "spidev_path" "/dev/spidev0.0" | ||
42 | json_add_boolean "full_duplex" 0 | ||
1.3 | 43 | json_add_boolean "lorawan_public" 0 ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--> "1" proves receive LoRaWAN Packet,"0" proves receive non-LoRaWan Packet | |
1.2 | 44 | json_add_int "clksrc" "1" | |
45 | json_add_string "clksrc_desc" "radio_1 provides clock to concentrator" | ||
46 | json_add_int "antenna_gain" "0" | ||
47 | json_add_string "antenna_gain_desc" "antenna gain, in dBi" | ||
1.3 | 48 | ))) | |
2.1 | 49 | ))) | |
2.2 | 50 | ))) | |
1.1 | 51 | ||
2.3 | 52 | ((( | |
11.4 | 53 | ||
54 | |||
55 | (% style="color:blue" %)**root@dragino-1d178c:~~# vim /etc/lora/global_conf.json** | ||
2.3 | 56 | ))) | |
1.1 | 57 | ||
1.3 | 58 | (% class="box" %) | |
59 | ((( | ||
2.1 | 60 | ((( | |
2.2 | 61 | ((( | |
1.3 | 62 | { | |
1.2 | 63 | "SX130x_conf": { | |
64 | "spidev_path": "/dev/spidev0.0", | ||
65 | "full_duplex": false, | ||
1.3 | 66 | "lorawan_public": false, ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--> "true" proves receive LoRaWAN Packet,"false" proves receive non-LoRaWan Packet | |
1.2 | 67 | "clksrc": 1, | |
68 | "clksrc_desc": "radio_1 provides clock to concentrator for most devices except MultiTech. For MultiTech set to 0.", | ||
69 | "antenna_gain": 0, | ||
70 | "antenna_gain_desc": "antenna gain, in dBi", | ||
71 | "radio_0": { | ||
1.3 | 72 | ))) | |
2.1 | 73 | ))) | |
2.2 | 74 | ))) | |
1.1 | 75 | ||
4.1 | 76 | ((( | |
9.1 | 77 | and run (% style="color:#037691" %)**root@dragino-1d178c:~~# fwd** | |
78 | |||
79 | |||
4.1 | 80 | ))) | |
1.1 | 81 | ||
12.3 | 82 | == 2.2 Method 2: == | |
1.2 | 83 | ||
11.4 | 84 | ||
2.1 | 85 | ((( | |
1.2 | 86 | Modify /etc/lora/cfg-$chip/"frequency"-global_conf.json | |
2.1 | 87 | ))) | |
1.2 | 88 | ||
2.1 | 89 | ((( | |
1.2 | 90 | view chip name : cat /tmp/iot/chip | |
2.1 | 91 | ))) | |
1.2 | 92 | ||
2.1 | 93 | ((( | |
1.2 | 94 | Restart the device after the modification | |
2.1 | 95 | ))) | |
1.2 | 96 | ||
2.2 | 97 | ((( | |
9.1 | 98 | [[image:image-20220527172224-1.png]] | |
2.2 | 99 | ))) | |
1.2 | 100 | ||
2.5 | 101 | ((( | |
1.2 | 102 | modify /etc/lora/cfg-$chip/"frequency"-global_conf.json | |
11.4 | 103 | ||
104 | |||
2.5 | 105 | ))) | |
1.2 | 106 | ||
2.5 | 107 | ((( | |
9.1 | 108 | (% style="color:red" %)**Note : User need to do that connect gateway command line via ssh.** | |
11.4 | 109 | ||
110 | |||
2.5 | 111 | ))) | |
1.2 | 112 | ||
2.1 | 113 | ((( | |
2.5 | 114 | ((( | |
9.1 | 115 | [[image:image-20220527172304-2.png]] | |
2.1 | 116 | ))) | |
2.5 | 117 | ))) | |
1.2 | 118 | ||
2.4 | 119 | ((( | |
1.2 | 120 | Checking LoRaWAN Gateway Log | |
9.1 | 121 | ||
122 | |||
2.4 | 123 | ))) | |
1.2 | 124 | ||
2.4 | 125 | ((( | |
1.3 | 126 | Command line input (% style="color:#037691" %) **logread -f** | |
2.4 | 127 | ))) | |
1.2 | 128 | ||
2.1 | 129 | ((( | |
2.5 | 130 | ((( | |
13.1 | 131 | ||
2.1 | 132 | ))) | |
2.5 | 133 | ))) | |
1.2 | 134 | ||
2.5 | 135 | ((( | |
11.4 | 136 | **Decoding verifies that the packet is correct** | |
12.2 | 137 | ||
138 | [[image:image-20220722161946-1.png]] | ||
2.5 | 139 | ))) | |
1.2 | 140 | ||
141 | |||
142 | Checking LoRa Packet | ||
11.4 | 143 | ||
144 |