Wiki source code of Instruction for LA66 Peer to Peer firmware
Last modified by Bei Jinggeng on 2022/12/19 11:05
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% class="wikigeneratedid" %) | ||
2 | **Table of Contents:** | ||
3 | |||
4 | {{toc/}} | ||
5 | |||
6 | |||
7 | |||
8 | = 1. Overview = | ||
9 | |||
10 | |||
11 | This instruction is for how to use Peer to Peer firmware in LA66. | ||
12 | |||
13 | |||
14 | |||
15 | = 2. Firmware Location = | ||
16 | |||
17 | |||
18 | Click[[ here>>https://www.dropbox.com/sh/dq03kkfdrqnhy66/AACpHIcKYMa4o1IySKtVoeENa?dl=0]] to download the firmware and update it to LA66 according to the instruction for different boards. | ||
19 | |||
20 | |||
21 | |||
22 | = 3. How to use? = | ||
23 | |||
24 | |||
25 | == 3.1 AT command == | ||
26 | |||
27 | |||
28 | (% style="color:blue" %)**1). Lora parameter configuration:** | ||
29 | |||
30 | |||
31 | AT+FRE: Get or Set TX and RX frequency | ||
32 | |||
33 | AT+BW: Get or Set TX and RX BandWidth | ||
34 | |||
35 | AT+SF: Get or Set TX and RX Spreading Factor | ||
36 | |||
37 | AT+POWER: Get or Set Tx Power Range | ||
38 | |||
39 | AT+CRC: Get or Set TX and RX CRC Type | ||
40 | |||
41 | AT+HEADER: Get or Set TX and RX Header Type | ||
42 | |||
43 | AT+CR: Get or Set TX and RX Header Type | ||
44 | |||
45 | AT+IQ: Get or Set TX and RX InvertIQ | ||
46 | |||
47 | AT+PREAMBLE: Get or Set TX and RX Preamble Length | ||
48 | |||
49 | AT+SYNCWORD: Get or Set sync word | ||
50 | |||
51 | |||
52 | |||
53 | (% style="color:blue" %)**2). General configuration:** | ||
54 | |||
55 | |||
56 | ATZ: Trig a reset of the MCU | ||
57 | |||
58 | AT+FDR: Reset Parameters to Factory Default | ||
59 | |||
60 | AT+CFG: Print all configurations | ||
61 | |||
62 | AT+FCU: Get or Set the Frame Counter Uplink | ||
63 | |||
64 | AT+FCD: Get or Set the Frame Counter Downlink | ||
65 | |||
66 | AT+GROUPMOD: Get or Set TX and RX group | ||
67 | |||
68 | AT+RXMOD: Get or Set Rx Timeout and Reply mode | ||
69 | |||
70 | AT+SEND: Send text data or hex along with the application port and confirm status | ||
71 | |||
72 | AT+RECV: Print last receive message, RSSI and SNR | ||
73 | |||
74 | |||
75 | |||
76 | == 3.2 Serial port information == | ||
77 | |||
78 | |||
79 | (% style="color:blue" %)**1). Information initialized at reset:** | ||
80 | |||
81 | [[image:image-20220926112125-1.png]] | ||
82 | |||
83 | |||
84 | (% style="color:blue" %)**2). In retransmission, the Uplinkcounter does not accumulate. The following figure shows that the third count packet is retransmitted twice when the ACK packet is not received.** | ||
85 | |||
86 | |||
87 | [[image:image-20220926112125-2.png]] | ||
88 | |||
89 | |||
90 | (% style="color:blue" %)**3). In the figure below, the receiver sends an ACK to the sender after receiving the packet, and the sender stops retransmission after receiving the ACK.** | ||
91 | |||
92 | |||
93 | (% style="color:red" %)**Receiver: (configured as AT+RXMOD=65535,2)** | ||
94 | |||
95 | [[image:image-20220926112125-3.png]] | ||
96 | |||
97 | |||
98 | |||
99 | (% style="color:red" %)**Sender:** | ||
100 | |||
101 | [[image:image-20220926112125-4.png]] | ||
102 | |||
103 | |||
104 | |||
105 | == 3.3 Data Format == | ||
106 | |||
107 | |||
108 | 1 byte of TXGROUPMOD +n payload | ||
109 | |||
110 | |||
111 | Payload(S12, SF11, SF10 maximum length is 59, SF9 maximum length is 123, SF8, SF7 maximum length is 230): | ||
112 | |||
113 | (% border="1" style="background-color:#ffffcc; color:green; width:316px" %) | ||
114 | |=(% style="width: 105px;" %)**Size (bytes)**|=(% style="width: 109px;" %)** 1**|=(% style="width: 99px;" %)**payloadsize** | ||
115 | |(% style="width:105px" %)**Value**|(% style="width:109px" %)TXGroupmod|(% style="width:99px" %)Send data | ||
116 | |||
117 | |||
118 | |||
119 | = 4. AT Command Set = | ||
120 | |||
121 | |||
122 | == 4.1 Set TX and RX Bandwidth == | ||
123 | |||
124 | |||
125 | **Set TX and RX BandWidth (0 ~~ 9), (% style="color:blue" %)AT Command : AT+BW(%%)** | ||
126 | |||
127 | 0: 125 kHz | ||
128 | |||
129 | 1: 250 kHz | ||
130 | |||
131 | 2: 500 kHz | ||
132 | |||
133 | 3: 62.5 kHz | ||
134 | |||
135 | 4: 41.67 kHz | ||
136 | |||
137 | 5: 31.25 kHz | ||
138 | |||
139 | 6: 20.83 kHz | ||
140 | |||
141 | 7: 15.63 kHz | ||
142 | |||
143 | 8: 10.42 kHz | ||
144 | |||
145 | 9: 7.81 kHz | ||
146 | |||
147 | |||
148 | (% style="color:red" %)**Default Value: AT+BW=0,0** (%%) ~/~/ BandWidth: 125kHz ,125kHz | ||
149 | |||
150 | (% style="color:red" %)**Range: (0 ~~ 9)** | ||
151 | |||
152 | |||
153 | |||
154 | == 4.2 Set TX and RX frequency == | ||
155 | |||
156 | |||
157 | **Set TX and RX frequency (MHz), (% style="color:blue" %)AT Command : AT+FRE(%%)** | ||
158 | |||
159 | |||
160 | (% style="color:red" %)**Default Value: AT+FRE=868.100,868.100** (%%) ~/~/ Frequency: 868.100MHz, 868.100MHz | ||
161 | |||
162 | |||
163 | |||
164 | == 4.3 Set TX and RX Spreading Factor == | ||
165 | |||
166 | |||
167 | **Set TX and RX Spreading Factor ( 5 ~~ 12), (% style="color:blue" %)AT Command : AT+SF(%%)** | ||
168 | |||
169 | |||
170 | (% style="color:red" %)**Default Value: AT+SF=12,12** (%%) ~/~/ Spreading Factor : 12,12 | ||
171 | |||
172 | (% style="color:red" %)**Range: (5 ~~ 12)** | ||
173 | |||
174 | |||
175 | |||
176 | == 4.4 Set Tx Power Range == | ||
177 | |||
178 | |||
179 | **Set Tx Power Range( 0 ~~ 22 dBm), (% style="color:blue" %)AT Command : AT+POWER(%%)** | ||
180 | |||
181 | |||
182 | (% style="color:red" %)**Default Value: AT+POWER=20** (%%) ~/~/ Output Power: 20dBm | ||
183 | |||
184 | (% style="color:red" %)**Range: (0 ~~ 22)** | ||
185 | |||
186 | |||
187 | |||
188 | == 4.5 Set TX and RX Coding Rate == | ||
189 | |||
190 | |||
191 | **Set TX and RX Coding Rate ( 1 ~~ 4 ), (% style="color:blue" %)AT Command :AT+CR(%%)** | ||
192 | |||
193 | 1: 4/5 | ||
194 | |||
195 | 2: 4/6 | ||
196 | |||
197 | 3: 4/7 | ||
198 | |||
199 | 4: 4/8 | ||
200 | |||
201 | |||
202 | (% style="color:red" %)**Default Value: AT+CR=1,1** (%%) ~/~/ Coding Rate: 4/5, 4/5 | ||
203 | |||
204 | (% style="color:red" %)**Range: (1 ~~ 4)** | ||
205 | |||
206 | |||
207 | |||
208 | == 4.6 Set TX and RX Header Type == | ||
209 | |||
210 | |||
211 | **Set TX and RX Header Type ( 0,1 ), (% style="color:blue" %)AT Command : AT+HEADER(%%)** | ||
212 | |||
213 | 0: Variable length packet (explicit header) | ||
214 | |||
215 | 1: Fixed length packet (implicit header) | ||
216 | |||
217 | |||
218 | (% style="color:red" %)**Default Value: AT+HEADER=1,1** (%%) ~/~/ Header Type: explicit, explicit | ||
219 | |||
220 | (% style="color:red" %)**Range: (0 ~~ 1)** | ||
221 | |||
222 | |||
223 | |||
224 | == 4.7 Set TX and RX CRC Type == | ||
225 | |||
226 | |||
227 | **Set TX and RX CRC Type ( 0,1) ,(% style="color:blue" %)AT Command:AT+CRC(%%)** | ||
228 | |||
229 | 0: CRC OFF | ||
230 | |||
231 | 1: CRC ON | ||
232 | |||
233 | |||
234 | (% style="color:red" %)**Default Value: AT+CRC=0,0** (%%) ~/~/ CRC: OFF, OFF | ||
235 | |||
236 | (% style="color:red" %)**Range: (0 ~~ 1)** | ||
237 | |||
238 | |||
239 | |||
240 | == 4.8 Set TX and RX InvertIQ == | ||
241 | |||
242 | |||
243 | **Set TX and RX InvertIQ ( 0,1) , (% style="color:blue" %)AT Command:AT+IQ(%%)** | ||
244 | |||
245 | 0: Standard IQ setup | ||
246 | |||
247 | 1: Inverted IQ setup | ||
248 | |||
249 | |||
250 | (% style="color:red" %)**Default Value: AT+IQ=0,0** (%%) ~/~/ Invert IQ: 0,0 | ||
251 | |||
252 | (% style="color:red" %)**Range: (0 ~~ 1)** | ||
253 | |||
254 | |||
255 | |||
256 | == 4.9 Set TX and RX Preamble Length == | ||
257 | |||
258 | |||
259 | **Set TX and RX Preamble Length ( 0 ~~ 65535 ) , (% style="color:blue" %)AT Command: AT+PREAMBLE(%%)** | ||
260 | |||
261 | |||
262 | (% style="color:red" %)**Default Value: AT+PREAMBLE=8,8** (%%) ~/~/ Preamble: 8,8 | ||
263 | |||
264 | (% style="color:red" %)**Range: ( 0 ~~ 65535 )** | ||
265 | |||
266 | |||
267 | |||
268 | == 4.10 Set Syncword == | ||
269 | |||
270 | |||
271 | **Set Syncword(0: private,1: public), (% style="color:blue" %)AT Command : AT+SYNCWORD(%%)** | ||
272 | |||
273 | |||
274 | (% style="color:red" %)**Default Value: AT+SYNCWORD=0** (%%) ~/~/ 0x3444 for Public Network | ||
275 | |||
276 | (% style="color:red" %)**Range: ( 0 ~~ 1 )** | ||
277 | |||
278 | |||
279 | |||
280 | == 4.11 Set TX and RX group == | ||
281 | |||
282 | |||
283 | **Set TX and RX group. (0 ~~ 255),(% style="color:blue" %)AT Command:AT+GROUPMOD(%%)** | ||
284 | |||
285 | Group > 0: Device only accept same group transmision | ||
286 | |||
287 | Group = 0: Accept Any group | ||
288 | |||
289 | |||
290 | (% style="color:red" %)**Default Value: AT+GROUPMOD=0,0** (%%) ~/~/ Group: 0,0 | ||
291 | |||
292 | (% style="color:red" %)**Range: ( 0 ~~ 255 )** | ||
293 | |||
294 | |||
295 | |||
296 | |||
297 | == 4.12 Set Rx Timeout and Reply mode == | ||
298 | |||
299 | |||
300 | **Set Rx Timeout and Reply mode, Parameter 1, Parameter2, (% style="color:blue" %)AT Command:AT+RXMOD(%%)** | ||
301 | |||
302 | **Parameter 1: ** | ||
303 | |||
304 | 0: Always no RX | ||
305 | |||
306 | 1 ~~ 65534: Open RX window and last for specify seconds. | ||
307 | |||
308 | 65535: RX window always open. | ||
309 | |||
310 | |||
311 | **~ Parameter 2: ** | ||
312 | |||
313 | 0: No ACK | ||
314 | |||
315 | 1: Send an ACK once got a message from another device. ACK Content is same as receive message | ||
316 | |||
317 | 2: Send an ACK once got a message from another device. ACK Content is 0x00 FF | ||
318 | |||
319 | |||
320 | (% style="color:red" %)**Default Value: AT+RXMOD=65535,2** (%%) ~/~/ RX Mode: 65535, 2 | ||
321 | |||
322 | |||
323 | |||
324 | == 4.13 Send Message == | ||
325 | |||
326 | |||
327 | **Send Message, (% style="color:blue" %)AT Command:AT+SEND(%%)** | ||
328 | |||
329 | **Parameter 1:** send hex or text | ||
330 | |||
331 | 0: Send hex | ||
332 | |||
333 | 1: Send text | ||
334 | |||
335 | |||
336 | **Parameter 2:** Content | ||
337 | |||
338 | |||
339 | **Parameter 3 :** ACK Type | ||
340 | |||
341 | 0: No ACK | ||
342 | |||
343 | 1: Wait for ACK (Same as what we sent) | ||
344 | |||
345 | 2: Wait for ACK ( 0x00 FF) | ||
346 | |||
347 | |||
348 | **Parameter 4 :** Retransmission ( 0 ~~ 8 ) | ||
349 | |||
350 | 0: No re-transmission | ||
351 | |||
352 | 1 ~~ 8: total sends 1~~8 transmission, interval 5 seconds | ||
353 | |||
354 | |||
355 | Example: AT+SEND=1,hello world,0,3 | ||
356 | |||
357 | (% style="color:red" %)**Notice: RX reply (Defined by AT+RXMOD) won't ask for TX ACK** | ||
358 | |||
359 | |||
360 | |||
361 | == 4.14 Print last receive message with RSSI and SNR == | ||
362 | |||
363 | |||
364 | **Print last receive message with RSSI and SNR,(% style="color:blue" %)AT+Command:AT+RECV(%%)** | ||
365 | |||
366 | 0: Print in Hex | ||
367 | |||
368 | 1: Print in text | ||
369 | |||
370 | |||
371 | Example: AT+RECV=0 | ||
372 | \\The recevied message will be clear after this command. | ||
373 | |||
374 | |||
375 | |||
376 | |||
377 | |||
378 | |||
379 | |||
380 | |||
381 | |||
382 |