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