<
From version < 1.3 >
edited by Xiaoling
on 2022/05/16 11:21
To version < 1.7 >
edited by Xiaoling
on 2022/05/17 11:35
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,4 +1,4 @@
1 -**Contents:**
1 +**~ Contents:**
2 2  
3 3  {{toc/}}
4 4  
... ... @@ -6,7 +6,9 @@
6 6  
7 7  The ChirpStack open-source LoRaWAN Network Server stack provides open-source components for LoRaWAN networks And the Chirpstack supports the users in building a private LoRaWAN Server. For more info please refer to this [[link>>url:https://www.chirpstack.io/]]
8 8  
9 +(((
9 9  The dragino gateway can connect the ChirpStack server via Semtech UDP or Semtech Basic Station.
11 +)))
10 10  
11 11  **Prerequisite**
12 12  
... ... @@ -20,10 +20,12 @@
20 20  
21 21  (% class="box" %)
22 22  (((
25 +(((
23 23  Semtech UDP : **All Model**
24 24  Basic Station : , , 
25 25  **Note** : the firmware needs >  if use the Bais station
26 26  )))
30 +)))
27 27  
28 28  = 2. Semtech UDP =
29 29  
... ... @@ -57,7 +57,7 @@
57 57  
58 58  In Step 3. Create Service-profiles, the above parameters can be set. If necessary, you can set them by yourself. This is only an example.
59 59  
60 -Note : Before add the gateway, the user needs to complete the preceding three steps.
64 +(% style="color:red" %)**Note : Before add the gateway, the user needs to complete the preceding three steps.**
61 61  
62 62  If the user has completed the preceding steps, proceed to the next step.
63 63  
... ... @@ -65,7 +65,9 @@
65 65  
66 66  The example gateway id is: a840411e96744150
67 67  
68 -Note : The Gateway EUI and server addresses must match the ChirpStack configuration.
72 +(((
73 +(% style="color:red" %)**Note : The Gateway EUI and server addresses must match the ChirpStack configuration.**
74 +)))
69 69  
70 70  [[image:https://wiki.dragino.com/images/thumb/c/c6/Add_the_gateway.png/600px-Add_the_gateway.png||height="363" width="600"]]
71 71  
... ... @@ -107,37 +107,51 @@
107 107  
108 108  User can use MQTT to send downlink payload to ChirpStack to perform downstream to LoRaWAN End
109 109  
116 +(((
110 110  Below is examples:
118 +)))
111 111  
112 -{{{Connect to your server via MQTT:
113 -MQTT Client ID: Any
114 -Protocol:mqtt/tcp Server IP:loraserver_ip:1883
120 +(% class="box" %)
121 +(((
122 +Connect to your server via MQTT:
123 +MQTT Client ID: Any   
124 +Protocol:mqtt/tcp   Server IP:loraserver_ip:1883
115 115  User name: User name Password: password
116 -}}}
126 +)))
117 117  
118 118  [[image:https://wiki.dragino.com/images/thumb/0/06/ChirpStack_Down_1.png/600px-ChirpStack_Down_1.png||height="578" width="600"]]
119 119  
130 +(((
120 120  MQTT Connect to ChirpStack
132 +)))
121 121  
134 +(((
122 122  After connect
136 +)))
123 123  
124 -{{{Subscribe : Format:application/ID/device/ Device EUI/rx
138 +(% class="box" %)
139 +(((
140 +Subscribe : Format:application/ID/device/ Device EUI/rx
125 125  Example: application/7/device/00aedb3da649cb23/rx
142 +)))
126 126  
127 -Publish:
144 +(% class="box" %)
145 +(((
146 +Publish:
128 128  Format: Top: application/ID/device/ Device EUI/tx
129 129  Payload: {"confirmed":true or false,"fPort":XX,"data":"xxxx"}
130 130  Example: Top: application/7/device/00aedb3da649cb23/tx
131 131  Payload: {"confirmed":true,"fPort":2,"data":"AwEB"}
132 -}}}
151 +)))
133 133  
134 134  [[image:https://wiki.dragino.com/images/thumb/c/c8/ChirpStack_Down_2.png/600px-ChirpStack_Down_2.png||height="342" width="600"]]
135 135  
136 136  MQTT Connect to ChirpStack
137 137  
157 +(((
158 +(% style="color:red" %)Note: Chirpstack use base64 to downlink, so need to convert the downlink payload from HEX to base64 [[https:~~/~~/base64.us/>>url:https://base64.us/]]
159 +)))
138 138  
139 -Note: Chirpstack use base64 to downlink, so need to convert the downlink payload from HEX to base64 [[https:~~/~~/base64.us/>>url:https://base64.us/]]
140 -
141 141  [[image:https://wiki.dragino.com/images/thumb/f/f8/ChirpStack_Down_3.png/600px-ChirpStack_Down_3.png||height="309" width="600"]]
142 142  
143 143  Choose to Use Hex for Encode
... ... @@ -146,9 +146,13 @@
146 146  
147 147  [[image:https://wiki.dragino.com/images/thumb/d/d2/ChirpStack_Down_4.png/600px-ChirpStack_Down_4.png||alt="ChirpStack Down 4.png" height="344" width="600"]]
148 148  
169 +(((
149 149  Downlink payload encode javescript code: 可以在网站上运行以下Javsscript代码:
171 +)))
150 150  
151 -{{{function sha1_to_base64(sha1)
173 +(% class="box" %)
174 +(((
175 +function sha1_to_base64(sha1)
152 152  {
153 153   var digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
154 154   var base64_rep = "";
... ... @@ -155,8 +155,7 @@
155 155   var cnt = 0;
156 156   var bit_arr = 0;
157 157   var bit_num = 0;
158
159 - for(var n = 0; n < sha1.length; ++n)
182 +\\ for(var n = 0; n < sha1.length; ++n)
160 160   {
161 161   if(sha1[n] >= 'A' && sha1[n] <= 'Z')
162 162   {
... ... @@ -170,26 +170,22 @@
170 170   {
171 171   ascv = sha1.charCodeAt(n) - 48;
172 172   }
173
174 - bit_arr = (bit_arr << 4) | ascv;
196 +\\ bit_arr = (bit_arr << 4) | ascv;
175 175   bit_num += 4;
176 176   if(bit_num >= 6)
177 177   {
178 - bit_num -= 6;
200 + bit_num -= 6;        
179 179   base64_rep += digits[bit_arr >>> bit_num];
180 - bit_arr &= ~(-1 << bit_num);
202 + bit_arr &= ~~(-1 << bit_num);
181 181   }
182 182   }
183
184 - if(bit_num > 0)
205 +\\ if(bit_num > 0)
185 185   {
186 186   bit_arr <<= 6 - bit_num;
187 187   base64_rep += digits[bit_arr];
188 188   }
189
190 - var padding = base64_rep.length % 4;
191
192 - if(padding > 0)
210 +\\ var padding = base64_rep.length % 4;   
211 +\\ if(padding > 0)
193 193   {
194 194   for(var n = 0; n < 4 - padding; ++n)
195 195   {
... ... @@ -198,17 +198,15 @@
198 198   }
199 199   return base64_rep;
200 200  }
201
202 -console.log(sha1_to_base64("data"));
203
204 -data is downlink payload required by end node.
205 - e.g console.log(sha1_to_base64("030101"));
206 - ​result: AwEB
220 +\\console.log(sha1_to_base64("data"));
221 +\\data is downlink payload required by end node.
222 +e.g console.log(sha1_to_base64("030101"));
223 + ​result: AwEB     
207 207   AwEB is the 0x030101's base 64 Encode.
208 - 
209 - ​e.g console.log(sha1_to_base64("030000"));
210 - ​result: AwAA
211 - AwAA is 0x030000's base 64 Encode.}}}
225 +\\​e.g console.log(sha1_to_base64("030000"));
226 + result: AwAA     
227 + AwAA is 0x030000's base 64 Encode.
228 +)))
212 212  
213 213  == 4.3 Add the decode function in Chirpstack for the payload ==
214 214  
... ... @@ -224,21 +224,29 @@
224 224  
225 225  = 5. Multiply Uplink in ChirpStack =
226 226  
244 +(((
227 227  nbtrans field is the value to determine the re-transmission time for unconfirmed uplink data.
246 +)))
228 228  
229 -
248 +(((
230 230  ChirpStack will auto adjust nbtrans according to uplink rssi. [[link to source>>url:https://github.com/brocaar/chirpstack-network-server/blob/master/internal/adr/adr.go]]
250 +)))
231 231  
232 232  [[image:https://wiki.dragino.com/images/thumb/6/63/Nbtrans_1.png/600px-Nbtrans_1.png||alt="Nbtrans 1.png" height="103" width="600"]]
233 233  
254 +(((
234 234  nbtrans is a field of ADR message, in unconfirm mode, it tells end node how many time it needs to transmit for every frame.
256 +)))
235 235  
236 236  [[image:https://wiki.dragino.com/images/thumb/1/17/Nbtrans_2.png/300px-Nbtrans_2.png||alt="Nbtrans 2.png" height="462" width="300"]]
237 237  
238 -
260 +(((
239 239  Above behaviour will cause the platform shows below two cases of error:
262 +)))
240 240  
264 +(((
241 241  Error of duplicate Frame Counter
266 +)))
242 242  
243 243  [[image:https://wiki.dragino.com/images/7/7e/Nbtrans_3.png||alt="Nbtrans 3.png" height="677" width="600"]]
244 244  
... ... @@ -250,7 +250,9 @@
250 250  
251 251  This example uses the Windows version as a template, other versions can refer to this. Similiar reference: [[https:~~/~~/confluence.alitecs.de/plugins/servlet/mobile?contentId=79790102#content/view/79790102>>url:https://confluence.alitecs.de/plugins/servlet/mobile?contentId=79790102#content/view/79790102]]
252 252  
278 +(((
253 253  ~1. Install the GO compilation environment: Download the corresponding version of the Go compiler at [[https:~~/~~/go.dev/dl/>>url:https://go.dev/dl/]] and install it.
280 +)))
254 254  
255 255  [[image:https://wiki.dragino.com/images/3/37/Chirpstacksolution-1.png||alt="Chirpstacksolution-1.png" height="199" width="554"]]
256 256  
... ... @@ -258,11 +258,17 @@
258 258  
259 259  [[image:https://wiki.dragino.com/images/c/ca/Chirpstacksolution-2.png||alt="Chirpstacksolution-2.png" height="283" width="361"]]
260 260  
288 +(((
261 261  2. Environment variable settings:.
290 +)))
262 262  
292 +(((
263 263  1) Open Computer -> Properties -> Advanced System Settings -> Environment Variables and add a "new" system variable:
294 +)))
264 264  
296 +(((
265 265  2)Set the variable name GOROOT and the variable value C:\Go\ (installation directory)
298 +)))
266 266  
267 267  [[image:https://wiki.dragino.com/images/f/f9/Chirpstacksolution-3.png||alt="Chirpstacksolution-3.png" height="152" width="554"]]
268 268  
... ... @@ -310,17 +310,35 @@
310 310  
311 311  5. Add the plugin and run the plugin.
312 312  
346 +(((
313 313  The exe file generated in the previous step is placed in the same root directory as chirpstack-network-server.toml, and the ADR plugin is added to the toml file. The location of the addition is as follows:
348 +)))
314 314  
315 315  [[image:https://wiki.dragino.com/images/8/82/Chirpstacksolution-9.png||alt="Chirpstacksolution-9.png" height="73" width="554"]]
316 316  
352 +(((
353 +(((
317 317  For example: adr_plugins=[“adr-setting”]
355 +)))
356 +)))
318 318  
319 -* Adding a single plugin format is adr_plugins=["filename"]
358 +* (((
359 +(((
360 +Adding a single plugin format is adr_plugins=["filename"]
361 +)))
362 +)))
320 320  
321 -* Adding multiple plugins The format is adr_plugins=["file name 1", "file name 2",...]
364 +* (((
365 +(((
366 +Adding multiple plugins The format is adr_plugins=["file name 1", "file name 2",...]
367 +)))
368 +)))
322 322  
370 +(((
371 +(((
323 323  Finally, re-run chirpstack-network-server.exe, and then select the plugin you just compiled in Device-profiles,
373 +)))
374 +)))
324 324  
325 325  [[image:https://wiki.dragino.com/images/3/39/Chirpstacksolution-10.png||alt="Chirpstacksolution-10.png" height="275" width="554"]]
326 326  
... ... @@ -330,6 +330,10 @@
330 330  
331 331  == 6.1 MIC Mismatch or MIC Failed ==
332 332  
384 +(((
333 333  When the device is registered or the device is working normally, the problem of MIC mismatch and MIC failed occurs.
386 +)))
334 334  
388 +(((
335 335  Under normal circumstances, users need to change the APPKEY to solve this problem.
390 +)))
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0