Wiki source code of Point to Point Communication of LT-22222-L
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
5 | = **1. Overview** = | ||
6 | |||
7 | ((( | ||
8 | Shipped LT-22222-L is base on LoRaWAN protocol. We also develop a open source Point to Point LoRa protocol for LT-22222-L. The source code and hex file can be found at: | ||
9 | ))) | ||
10 | |||
11 | ((( | ||
12 | [[Point to Point Software for LT-22222-L>>https://github.com/dragino/LT-22222-L]]. | ||
13 | ))) | ||
14 | |||
15 | == == | ||
16 | |||
17 | = **2. Features for this firmware** = | ||
18 | |||
19 | |||
20 | == **2.1 Point To Point** == | ||
21 | |||
22 | === **2.1.1 Overview** === | ||
23 | |||
24 | [[image:image-20220602111219-1.png||height="472" width="972"]] | ||
25 | |||
26 | |||
27 | === **2.2.2 Configure** === | ||
28 | |||
29 | |||
30 | (% border="1" style="background-color:#f7faff; color:black; width:500px" %) | ||
31 | |=**A's configuration**|=**B's configuration** | ||
32 | |AT+GROUPMOD=0|AT+GROUPMOD=0 | ||
33 | |AT+TXCHS=868700000|AT+TXCHS=869000000 | ||
34 | |AT+RXCHS=869000000|AT+RXCHS=868700000 | ||
35 | |AT+TRIG1=2,50|AT+TRIG1=2,50 | ||
36 | |AT+TRIG2=2,50|AT+TRIG2=2,50 | ||
37 | |AT+DI1TODO1=2|AT+DI1TODO1=2 | ||
38 | |AT+DI1TORO1=2|AT+DI1TORO1=2 | ||
39 | |AT+DI2TODO2=2 |AT+DI2TODO2=2 | ||
40 | |AT+DI2TORO2=2|AT+DI2TORO2=2 | ||
41 | |||
42 | |||
43 | |||
44 | === **2.2.3 Serial port display** === | ||
45 | |||
46 | |||
47 | (% class="wikigeneratedid" %) | ||
48 | [[image:image-20220602111219-2.png]] | ||
49 | |||
50 | |||
51 | (% class="wikigeneratedid" %) | ||
52 | [[image:image-20220602111219-3.png]] | ||
53 | |||
54 | (% class="wikigeneratedid" %) | ||
55 | If the sender does not get the ACK reply from the receiver, it will retransmit up to 4 times, each interval is 6 seconds, and the UplinkCounter of the retransmission will not increase. | ||
56 | |||
57 | |||
58 | == **2.2 Point To Mult-Point ** == | ||
59 | |||
60 | === **2.2.1 Overview** === | ||
61 | |||
62 | |||
63 | [[image:1654152390874-192.png]] | ||
64 | |||
65 | |||
66 | === **2.2.2 Configure** === | ||
67 | |||
68 | |||
69 | (% style="color:#4f81bd" %)**Configuration of the TX group:** | ||
70 | |||
71 | AT+GROUPMOD=0,2 | ||
72 | |||
73 | AT+TXCHS=868700000 | ||
74 | |||
75 | AT+RXCHS=869000000 | ||
76 | |||
77 | AT+TRIG1=2,50 | ||
78 | |||
79 | AT+TRIG2=2,50 | ||
80 | |||
81 | AT+DI1TODO1=1 | ||
82 | |||
83 | AT+DI1TORO1=1 | ||
84 | |||
85 | AT+DI2TODO2=1 | ||
86 | |||
87 | AT+DI2TORO2=1 | ||
88 | |||
89 | |||
90 | (% style="color:#4f81bd" %)**Configuration for RX group number 1:** | ||
91 | |||
92 | AT+GROUPMOD=1,1 | ||
93 | |||
94 | AT+TXCHS=869000000 | ||
95 | |||
96 | AT+RXCHS=868700000 | ||
97 | |||
98 | |||
99 | (% style="color:#4f81bd" %)**Configuration for RX group number 2:** | ||
100 | |||
101 | AT+GROUPMOD=1,2 | ||
102 | |||
103 | AT+TXCHS=869000000 | ||
104 | |||
105 | AT+RXCHS=868700000 | ||
106 | |||
107 | |||
108 | === **2.2.3 Serial port display** === | ||
109 | |||
110 | |||
111 | [[image:image-20220602144747-1.png]] | ||
112 | |||
113 | |||
114 | [[image:image-20220602144747-2.png]] | ||
115 | |||
116 | ((( | ||
117 | If the TX group does not receive all the ACK replies from the RX group, it will retransmit up to 4 times, each time interval is 30 seconds, and the retransmission UplinkCounter will not increase. | ||
118 | ))) | ||
119 | |||
120 | |||
121 | |||
122 | |||
123 | == **2.3 AT command** == | ||
124 | |||
125 | |||
126 | ((( | ||
127 | (% style="color:#037691" %)**ATZ** (%%)**: ** Trig a reset of the MCU | ||
128 | ))) | ||
129 | |||
130 | ((( | ||
131 | (% style="color:#037691" %)**AT+FDR** (%%)**:** Reset Parameters to Factory Default, Keys Reserve | ||
132 | ))) | ||
133 | |||
134 | ((( | ||
135 | (% style="color:#037691" %)**AT+FCU** (%%)**:** Get or Set the Frame Counter Uplink | ||
136 | ))) | ||
137 | |||
138 | ((( | ||
139 | (% style="color:#037691" %)**AT+FCD** (%%)**:** Get or Set the Frame Counter Downlink | ||
140 | ))) | ||
141 | |||
142 | ((( | ||
143 | (% style="color:#037691" %)**AT+TXP** (%%)**:** Get or Set the transmit power, the maximum is 20dBm (default is 14dBm) | ||
144 | ))) | ||
145 | |||
146 | ((( | ||
147 | (% style="color:#037691" %)**AT+SYNC** (%%)**:** Get or Set the Sync word [1:0x34,0:0x12] (default is 1) | ||
148 | ))) | ||
149 | |||
150 | ((( | ||
151 | (% style="color:#037691" %)**AT+PMB** (%%)**: **Get or Set the preamble (default:8) | ||
152 | ))) | ||
153 | |||
154 | ((( | ||
155 | (% style="color:#037691" %)**AT+TXCHS **(%%)**:** Get or Set the transmit frequency of TX (default:868700000) | ||
156 | ))) | ||
157 | |||
158 | ((( | ||
159 | (% style="color:#037691" %)**AT+TXSF **(%%)**:** Get or Set the spreading factor of TX (7 to 12) (default:12) | ||
160 | ))) | ||
161 | |||
162 | ((( | ||
163 | (% style="color:#037691" %)**AT+RXCHS **(%%)**:** Get or Set the transmit frequency of RX (default:869000000) | ||
164 | ))) | ||
165 | |||
166 | ((( | ||
167 | (% style="color:#037691" %)**AT+RXSF **(%%)**:** Get or Set the spreading factor of RX (7 to 12) (default:12) | ||
168 | ))) | ||
169 | |||
170 | ((( | ||
171 | (% style="color:#037691" %)**AT+BW **(%%)**: **Get or Set the bandwidth [0:125khz,1:250khz,2:500khz] (default:0) | ||
172 | ))) | ||
173 | |||
174 | ((( | ||
175 | (% style="color:#037691" %)**AT+CR **(%%)**: **Get or Set the coding rate [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] (default:1) | ||
176 | ))) | ||
177 | |||
178 | ((( | ||
179 | (% style="color:#037691" %)**AT+TDC **(%%)**:** Get or set the application data transmission interval in ms(default 10 minutes) | ||
180 | ))) | ||
181 | |||
182 | ((( | ||
183 | (% style="color:#037691" %)**AT+VER **(%%)**:** Get firmware version number | ||
184 | ))) | ||
185 | |||
186 | ((( | ||
187 | (% style="color:#037691" %)**AT+SEND **(%%)**: **Set Custom sent hex data | ||
188 | ))) | ||
189 | |||
190 | ((( | ||
191 | (% style="color:#037691" %)**AT+GROUPMOD **(%%)**: **Set or Get the grouping mode of the device (default: 0) | ||
192 | ))) | ||
193 | |||
194 | ((( | ||
195 | ((( | ||
196 | (% style="color:#037691" %)**AT+GROUPID **(%%)**: **Set or Get the password for matching between TX group and RX group, which can be composed of numbers or characters (default: 12345678) | ||
197 | ))) | ||
198 | ))) | ||
199 | |||
200 | ((( | ||
201 | (% style="color:#037691" %)**AT+TRIG1 **(%%)**:** Set or Get the DI1 pin interrupt trigger mode (default 0,0) | ||
202 | ))) | ||
203 | |||
204 | ((( | ||
205 | (% style="color:#037691" %)**AT+TRIG2 **(%%)**: **Set or Get the DI2 pin interrupt trigger mode (default 0,0) | ||
206 | ))) | ||
207 | |||
208 | ((( | ||
209 | (% style="color:#037691" %)**AT+DI1TODO1 **(%%)**: **Set or get the mode in which DI1 maps to DO1 (default 0) | ||
210 | ))) | ||
211 | |||
212 | ((( | ||
213 | (% style="color:#037691" %)**AT+DI1TORO1 **(%%)**: **Set or get the mode in which DI1 maps to RO1(default 0) | ||
214 | ))) | ||
215 | |||
216 | ((( | ||
217 | (% style="color:#037691" %)**AT+DI2TODO2 **(%%)**:** Set or get the mode in which DI2 maps to DO2(default 0) | ||
218 | ))) | ||
219 | |||
220 | ((( | ||
221 | (% style="color:#037691" %)**AT+DI2TORO2 **(%%)**: **Set or get the mode in which DI2 maps to RO2(default 0) | ||
222 | ))) | ||
223 | |||
224 | ((( | ||
225 | |||
226 | ))) | ||
227 | |||
228 | ((( | ||
229 | |||
230 | ))) | ||
231 | |||
232 | ((( | ||
233 | (% style="color:#4f81bd" %)**Example 1:** | ||
234 | ))) | ||
235 | |||
236 | ((( | ||
237 | **AT+SEND=01020304 **will send a payload of 01020304 | ||
238 | ))) | ||
239 | |||
240 | ((( | ||
241 | |||
242 | ))) | ||
243 | |||
244 | ((( | ||
245 | (% style="color:#4f81bd" %)**Example 2: ** | ||
246 | ))) | ||
247 | |||
248 | ((( | ||
249 | **AT+TRIGx=a **Trigger directly without triggering time | ||
250 | ))) | ||
251 | |||
252 | ((( | ||
253 | **AT+TRIGx=a,b** | ||
254 | ))) | ||
255 | |||
256 | ((( | ||
257 | a=0: falling edge; | ||
258 | ))) | ||
259 | |||
260 | ((( | ||
261 | a=1: rising edge; | ||
262 | ))) | ||
263 | |||
264 | ((( | ||
265 | a=2: falling edge or rising edge; | ||
266 | ))) | ||
267 | |||
268 | ((( | ||
269 | b: triggering time in milliseconds. | ||
270 | ))) | ||
271 | |||
272 | ((( | ||
273 | AT+TRIGx=2,50 Falling edge or rising edge trigger, and the trigger time exceeds 50ms. | ||
274 | ))) | ||
275 | |||
276 | ((( | ||
277 | |||
278 | ))) | ||
279 | |||
280 | ((( | ||
281 | (% style="color:#4f81bd" %)**Example 3: ** | ||
282 | ))) | ||
283 | |||
284 | ((( | ||
285 | **AT+DI1TODO1= maps value** | ||
286 | ))) | ||
287 | |||
288 | ((( | ||
289 | **AT+DI1TORO1= maps value** | ||
290 | ))) | ||
291 | |||
292 | ((( | ||
293 | **AT+DI2TODO2= maps value** | ||
294 | ))) | ||
295 | |||
296 | ((( | ||
297 | **AT+DI2TORO2= maps value** | ||
298 | ))) | ||
299 | |||
300 | ((( | ||
301 | |||
302 | ))) | ||
303 | |||
304 | (% border="1" style="background-color:#f7faff; color:black; width:706px" %) | ||
305 | |=(% style="width: 102px;" %)((( | ||
306 | Maps value | ||
307 | )))|=(% style="width: 331px;" %)((( | ||
308 | DIx to DOx | ||
309 | )))|=(% style="width: 268px;" %)((( | ||
310 | DIx to ROx | ||
311 | ))) | ||
312 | |(% style="width:102px" %)((( | ||
313 | 0 | ||
314 | )))|(% style="width:331px" %)((( | ||
315 | No Action | ||
316 | )))|(% style="width:268px" %)((( | ||
317 | No Action | ||
318 | ))) | ||
319 | |(% style="width:102px" %)((( | ||
320 | 1 | ||
321 | )))|(% style="width:331px" %)((( | ||
322 | If DIx is high, control DOx to output low level, If DIx is low, control DOx to output high level | ||
323 | )))|(% style="width:268px" %)((( | ||
324 | ((( | ||
325 | If DIx is high, control ROx to close, | ||
326 | ))) | ||
327 | |||
328 | ((( | ||
329 | if DIx is low, control ROx to open | ||
330 | ))) | ||
331 | ))) | ||
332 | |(% style="width:102px" %)((( | ||
333 | 2 | ||
334 | )))|(% style="width:331px" %)((( | ||
335 | If DIx is high, control DOx to output high level, If DIx is low, control DOx to output low level | ||
336 | )))|(% style="width:268px" %)((( | ||
337 | ((( | ||
338 | If DIx is high, control ROx to open, | ||
339 | ))) | ||
340 | |||
341 | ((( | ||
342 | if DIx is low, control ROx to close | ||
343 | ))) | ||
344 | ))) | ||
345 | |(% style="width:102px" %)((( | ||
346 | 3 | ||
347 | )))|(% style="width:331px" %)((( | ||
348 | DOx state flip | ||
349 | )))|(% style="width:268px" %)((( | ||
350 | ROx state flip | ||
351 | ))) | ||
352 | |||
353 | ((( | ||
354 | (% style="color:#4f81bd" %)**Example 4: ** | ||
355 | ))) | ||
356 | |||
357 | ((( | ||
358 | **AT+GROUPMOD=0** Set to point to point mode | ||
359 | ))) | ||
360 | |||
361 | ((( | ||
362 | **AT+GROUPMOD=0,aa** Set the TX group that controls the number of aa (The maximum value of aa is 8) | ||
363 | ))) | ||
364 | |||
365 | ((( | ||
366 | ((( | ||
367 | **AT+GROUPMOD=1,bb** Set to the RX group controlled by the TX group, numbered bb(The maximum value of aa is 8) | ||
368 | ))) | ||
369 | ))) | ||
370 | |||
371 | ((( | ||
372 | **AT+GROUPMOD=0,2** Set to control the TX group of the two RX groups | ||
373 | ))) | ||
374 | |||
375 | ((( | ||
376 | **AT+GROUPMOD=1,1** Set the RX group numbered 1 | ||
377 | ))) | ||
378 | |||
379 | ((( | ||
380 | **AT+GROUPMOD=1,2** Set the RX group numbered 2 | ||
381 | ))) | ||
382 | |||
383 | |||
384 | == **2.4 Data Format** == | ||
385 | |||
386 | ((( | ||
387 | 8 bytes of GROUPID + 9 bytes of payload + 4 bytes of checksum | ||
388 | ))) | ||
389 | |||
390 | ((( | ||
391 | |||
392 | ))) | ||
393 | |||
394 | ((( | ||
395 | (% style="color:#4f81bd" %)**Payload:** | ||
396 | ))) | ||
397 | |||
398 | (% border="1" style="background-color:#f7faff; color:black; width:938px" %) | ||
399 | |=(% style="width: 123px;" %)((( | ||
400 | **Size (bytes)** | ||
401 | )))|=(% style="width: 107px;" %)((( | ||
402 | 1 | ||
403 | )))|=(% style="width: 107px;" %)((( | ||
404 | 1 | ||
405 | )))|=(% style="width: 107px;" %)((( | ||
406 | 1 | ||
407 | )))|=(% style="width: 107px;" %)((( | ||
408 | 1 | ||
409 | )))|=(% style="width: 107px;" %)((( | ||
410 | 1 | ||
411 | )))|=(% style="width: 107px;" %)((( | ||
412 | 1 | ||
413 | )))|=(% style="width: 107px;" %)((( | ||
414 | 1 | ||
415 | )))|=(% style="width: 107px;" %)((( | ||
416 | 1 | ||
417 | )))|=(% style="width: 107px;" %)((( | ||
418 | 1 | ||
419 | ))) | ||
420 | |(% style="width:123px" %)((( | ||
421 | **Value** | ||
422 | )))|(% style="width:38px" %)((( | ||
423 | address | ||
424 | )))|(% style="width:70px" %)((( | ||
425 | request | ||
426 | )))|(% style="width:52px" %)((( | ||
427 | ACK | ||
428 | )))|(% style="width:127px" %)((( | ||
429 | ((( | ||
430 | DI1& | ||
431 | ))) | ||
432 | |||
433 | ((( | ||
434 | DI1 level | ||
435 | ))) | ||
436 | )))|(% style="width:101px" %)((( | ||
437 | DI1TODO1 | ||
438 | )))|(% style="width:91px" %)((( | ||
439 | DI1TORO1 | ||
440 | )))|(% style="width:111px" %)((( | ||
441 | ((( | ||
442 | DI2& | ||
443 | ))) | ||
444 | |||
445 | ((( | ||
446 | DI2 level | ||
447 | ))) | ||
448 | )))|(% style="width:105px" %)((( | ||
449 | DI2TODO2 | ||
450 | )))|(% style="width:106px" %)((( | ||
451 | DI2TORO2 | ||
452 | ))) | ||
453 | |||
454 | ((( | ||
455 | (% style="color:#037691" %)**The first byte**(%%)**:** 00 is the broadcast address, 01-08 is the RX group number. | ||
456 | ))) | ||
457 | |||
458 | ((( | ||
459 | (% style="color:#037691" %)**The second byte**(%%)**:** send mapping request when not 0, not request when it is 0. | ||
460 | ))) | ||
461 | |||
462 | ((( | ||
463 | (% style="color:#037691" %)**The third byte**(%%)**:** ACK returned to the sender after the mapping is completed. | ||
464 | ))) | ||
465 | |||
466 | ((( | ||
467 | ((( | ||
468 | (% style="color:#037691" %)**The fourth byte**(%%)**:** the high four bits are 1 to represent DI1, and the low four bits are the level of DI1 when the interrupt is triggered. | ||
469 | ))) | ||
470 | ))) | ||
471 | |||
472 | ((( | ||
473 | (% style="color:#037691" %)**The Fifth byte**(%%)**: **DI1TODO1 when the interrupt is triggered, 0 when the interrupt is not triggered. | ||
474 | ))) | ||
475 | |||
476 | ((( | ||
477 | (% style="color:#037691" %)**The Sixth byte**(%%)**:** 0 does not trigger interrupt when DI1TORO1 interrupt is triggered. | ||
478 | ))) | ||
479 | |||
480 | ((( | ||
481 | ((( | ||
482 | (% style="color:#037691" %)**The seventh byte**(%%)**:** the high four bits are 2 to represent DI2, and the low four bits are the level of DI2 when the interrupt is triggered. | ||
483 | ))) | ||
484 | ))) | ||
485 | |||
486 | ((( | ||
487 | (% style="color:#037691" %)**The 8th byte**(%%)**: **DI2TODO2 when the interrupt is triggered, 0 when the interrupt is not triggered. | ||
488 | ))) | ||
489 | |||
490 | ((( | ||
491 | (% style="color:#037691" %)**The 9th byte**(%%)**:** DI2TORO2 when an interrupt is triggered, 0 when an interrupt is not triggered. | ||
492 | ))) | ||
493 | |||
494 |