Last modified by Xiaoling on 2025/04/23 15:57

From version 40.53
edited by Xiaoling
on 2022/06/06 10:50
Change comment: There is no comment for this version
To version 41.2
edited by Xiaoling
on 2022/06/06 10:54
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -474,117 +474,209 @@
474 474  After we got the valid value from each RS485 commands, we need to combine them together with the command **AT+DATAUP**.
475 475  )))
476 476  
477 +(((
477 477  **Examples:**
479 +)))
478 478  
481 +(((
479 479  Below are examples for the how above AT Commands works.
483 +)))
480 480  
485 +(((
481 481  **AT+COMMANDx : **This command will be sent to RS485/TTL devices during each sampling, Max command length is 14 bytes. The grammar is:
487 +)))
482 482  
483 483  (% border="1" class="table-bordered" style="background-color:#4f81bd; color:white; width:500px" %)
484 484  |(% style="width:498px" %)(((
491 +(((
485 485  **AT+COMMANDx=xx xx xx xx xx xx xx xx xx xx xx xx,m**
493 +)))
486 486  
495 +(((
487 487  **xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent**
497 +)))
488 488  
499 +(((
489 489  **m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command**
490 490  )))
502 +)))
491 491  
504 +(((
492 492  For example, if we have a RS485 sensor. The command to get sensor value is: 01 03 0B B8 00 02 46 0A. Where 01 03 0B B8 00 02 is the Modbus command to read the register 0B B8 where stored the sensor value. The 46 0A is the CRC-16/MODBUS which calculate manually.
506 +)))
493 493  
508 +(((
494 494  In the RS485-BL, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same.
510 +)))
495 495  
512 +(((
496 496  **AT+SEARCHx**: This command defines how to handle the return from AT+COMMANDx.
514 +)))
497 497  
498 498  (% border="1" class="table-bordered" style="background-color:#4f81bd; color:white; width:500px" %)
499 499  |(% style="width:577px" %)(((
518 +(((
500 500  **AT+SEARCHx=aa,xx xx xx xx xx**
520 +)))
501 501  
502 -* **aa: 1: prefix match mode; 2: prefix and suffix match mode**
503 -* **xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix**
522 +* (((
523 +**aa: 1: prefix match mode; 2: prefix and suffix match mode**
504 504  )))
525 +* (((
526 +**xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix**
527 +)))
528 +)))
505 505  
530 +(((
506 506  **Examples:**
532 +)))
507 507  
534 +(((
508 508  1)For a return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
536 +)))
509 509  
538 +(((
510 510  If we set AT+SEARCH1=1,1E 56 34.      (max 5 bytes for prefix)
540 +)))
511 511  
542 +(((
512 512  The valid data will be all bytes after 1E 56 34 , so it is (% style="background-color:yellow" %)**2e 30 58 5f 36 41 30 31 00 49**
544 +)))
513 513  
546 +(((
514 514  [[image:1653271044481-711.png]]
548 +)))
515 515  
550 +(((
516 516  2)For a return string from AT+COMMAND1:  16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
552 +)))
517 517  
554 +(((
518 518  If we set AT+SEARCH1=2, 1E 56 34+31 00 49
556 +)))
519 519  
558 +(((
520 520  Device will search the bytes between 1E 56 34 and 31 00 49. So it is(% style="background-color:yellow" %) **2e 30 58 5f 36 41 30**
560 +)))
521 521  
562 +(((
522 522  [[image:1653271276735-972.png]]
564 +)))
523 523  
566 +(((
524 524  **AT+DATACUTx : **This command defines how to handle the return from AT+COMMANDx, max return length is 45 bytes.
568 +)))
525 525  
526 526  (% style="background-color:#4f81bd; color:white; width:510px" %)
527 527  |(% style="width:726px" %)(((
572 +(((
528 528  **AT+DATACUTx=a,b,c**
574 +)))
529 529  
530 -* **a: length for the return of AT+COMMAND**
531 -* **b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.**
532 -* **c: define the position for valid value.  **
576 +* (((
577 +**a: length for the return of AT+COMMAND**
533 533  )))
579 +* (((
580 +**b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.**
581 +)))
582 +* (((
583 +**c: define the position for valid value.  **
584 +)))
585 +)))
534 534  
587 +(((
535 535  **Examples:**
589 +)))
536 536  
537 -* Grab bytes:
591 +* (((
592 +Grab bytes:
593 +)))
538 538  
595 +(((
539 539  [[image:1653271581490-837.png||height="313" width="722"]]
597 +)))
540 540  
599 +(((
600 +
601 +)))
541 541  
542 -* Grab a section.
603 +* (((
604 +Grab a section.
605 +)))
543 543  
607 +(((
544 544  [[image:1653271648378-342.png||height="326" width="720"]]
609 +)))
545 545  
611 +(((
612 +
613 +)))
546 546  
547 -* Grab different sections.
615 +* (((
616 +Grab different sections.
617 +)))
548 548  
619 +(((
549 549  [[image:1653271657255-576.png||height="305" width="730"]]
621 +)))
550 550  
551 551  (((
624 +(((
552 552  (% style="color:red" %)**Note:**
553 553  )))
627 +)))
554 554  
555 555  (((
630 +(((
556 556  AT+SEARCHx and AT+DATACUTx can be used together, if both commands are set, RS485-BL will first process AT+SEARCHx on the return string and get a temporary string, and then process AT+DATACUTx on this temporary string to get the final payload. In this case, AT+DATACUTx need to set to format AT+DATACUTx=0,xx,xx where the return bytes set to 0.
557 557  )))
633 +)))
558 558  
559 559  (((
636 +(((
560 560  **Example:**
561 561  )))
639 +)))
562 562  
563 563  (((
642 +(((
564 564  (% style="color:red" %)AT+COMMAND1=11 01 1E D0,0
565 565  )))
645 +)))
566 566  
567 567  (((
648 +(((
568 568  (% style="color:red" %)AT+SEARCH1=1,1E 56 34
569 569  )))
651 +)))
570 570  
571 571  (((
654 +(((
572 572  (% style="color:red" %)AT+DATACUT1=0,2,1~~5
573 573  )))
657 +)))
574 574  
575 575  (((
660 +(((
576 576  (% style="color:red" %)Return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
577 577  )))
663 +)))
578 578  
579 579  (((
666 +(((
580 580  (% style="color:red" %)String after SEARCH command: 2e 30 58 5f 36 41 30 31 00 49
581 581  )))
669 +)))
582 582  
583 583  (((
672 +(((
584 584  (% style="color:red" %)Valid payload after DataCUT command: 2e 30 58 5f 36
585 585  )))
675 +)))
586 586  
677 +(((
587 587  [[image:1653271763403-806.png]]
679 +)))
588 588  
589 589  
590 590  === 3.3.4 Compose the uplink payload ===
... ... @@ -731,26 +731,8 @@
731 731  
732 732  == 3.4 Uplink Payload ==
733 733  
734 -(% border="1" style="background-color:#4f81bd; color:white; width:850px" %)
735 -|**Size(bytes)**|(% style="width:130px" %)**2**|(% style="width:93px" %)**1**|(% style="width:509px" %)**Length depends on the return from the commands**
736 -|Value|(% style="width:130px" %)(((
737 -(((
738 -Battery(mV)
739 -)))
826 +[[image:image-20220606105412-1.png]]
740 740  
741 -(((
742 -&
743 -)))
744 -
745 -(((
746 -Interrupt _Flag
747 -)))
748 -)))|(% style="width:93px" %)(((
749 -PAYLOAD_VER
750 -
751 -
752 -)))|(% style="width:509px" %)If the valid payload is too long and exceed the maximum support payload length in server, server will show payload not provided in the LoRaWAN server.
753 -
754 754  Below is the decoder for the first 3 bytes. The rest bytes are dynamic depends on different RS485 sensors.
755 755  
756 756  (((
image-20220606105412-1.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +13.9 KB
Content