Skip to main content

Point to Point Communication for RS485-LN

1. Point to Point

1.1 Overview

1656901825798-483.png

1.2 Configure

A's configurationB's configuration
AT+GROUPMOD=0AT+GROUPMOD=0
AT+GROUPID=12345678AT+GROUPID=12345678
AT+TXCHS=868700000AT+TXCHS=869000000
AT+RXCHS=869000000AT+RXCHS=868700000
AT+CFGDEV=01 03 00 00 00 04,1AT+CFGDEV=01 03 00 00 00 02,1
oror
AT+SCHEDULE=01 03 00 00 00 04,1AT+SCHEDULE=01 03 00 00 00 02,1

1.3 Serial port display

image-20220704103422-2.png

A sends a command to B to query B's RS485 sensor data and display it on A's upper computer.

Similarly, B sends a command to A to query A's RS485 sensor data and display it on B's upper computer.

image-20220704103502-3.png

If the sender does not get the ACK reply from the receiver, it will retransmit up to 4 times, each interval is 10 seconds, and the UplinkCounter of the retransmission will not increase. (Retransmission only occurs when using the AT+CFGDEV command or triggering an external interrupt)

2. Point To Mult-Point

2.1 Overview

1656901541427-229.png

2.2 Configure

Configuration of the TX group:

AT+GROUPMOD=0,2
AT+GROUPID=12345678
AT+TXCHS=868700000
AT+RXCHS=869000000
AT+CFGDEV=01 03 00 00 00 02,1
or
AT+SCHEDULE=01 03 00 00 00 02,1

Configuration for RX group number 1:

AT+GROUPMOD=1,1
AT+GROUPID=12345678
AT+TXCHS=869000000
AT+RXCHS=868700000

Configuration for RX group number 2:

AT+GROUPMOD=1,2
AT+GROUPID=12345678
AT+TXCHS=869000000
AT+RXCHS=868700000

2.3 Serial port display

image-20220704103658-4.png

The TX group sends broadcast data to the RX group. After the RX group receives the data, it will reply to the TX group in order from small to large.

image-20220704103658-5.png

If the sender does not get the ACK reply from the receiver, it will retransmit up to 4 times, each interval is 30 seconds, and the UplinkCounter of the retransmission will not increase.(Retransmission only occurs when using the AT+CFGDEV command or triggering an external interrupt)

3. Point to Point (RS485 Pass Through)

3.1 Overview

PC --> RS485 to USB adapter --> RS485-LN A <----- LoRa ----> RS485-LN B <-- >RS485 sensor

image-20240430153458-2.png

3.2 Configure

Configuration of the PC:

RS485 sensor read command

Configuration for RX group number 1:

AT+MOD=1,500
AT+GROUPID=12345678
AT+TXCHS=869000000
AT+RXCHS=868700000

Configuration for RX group number 2:

AT+GROUPID=12345678
AT+TXCHS=869000000
AT+RXCHS=868700000

Configure parameters consistent with the RS485 sensor:

AT+BAUDR=4800
AT+PARITY=0
AT+DATABIT=8
AT+STOPBIT=0
AT+SCHEDULE=0,0
AT+CMDDL=400

3.3 Serial port display

image-20240430145609-1.png

If the sender does not get the ACK reply from the receiver, it will retransmit up to 4 times, each interval is 30 seconds, and the UplinkCounter of the retransmission will not increase.(Retransmission only occurs when using the AT+CFGDEV command or triggering an external interrupt)

4. AT command

CommandDescription
ATZTrig a reset of the MCU
AT+FDRReset Parameters to Factory Default, Keys Reserve
AT+FCUGet or Set the Frame Counter Uplink
AT+FCDGet or Set the Frame Counter Downlink
AT+TXPGet or Set the transmit power, the maximum is 20dBm (default is 14dBm)
AT+SYNCGet or Set the Sync word [1:0x34,0:0x12] (default is 1)
AT+PMBGet or Set the preamble (default:8)
AT+TXCHSGet or Set the transmit frequency of TX (default:868700000)
AT+TXSFGet or Set the spreading factor of TX (7 to 12) (default:12)
AT+RXCHSGet or Set the transmit frequency of RX (default:869000000)
AT+RXSFGet or Set the spreading factor of RX (7 to 12) (default:12)
AT+BWGet or Set the bandwidth [0:125khz,1:250khz,2:500khz] (default:0)
AT+CRGet or Set the coding rate [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] (default:1)
AT+TDCGet or set the application data transmission interval in ms(default 10 minutes)
AT+VERGet firmware version number
AT+SENDSet Custom sent hex data
AT+GROUPMODSet or Get the grouping mode of the device (default: 0)
AT+GROUPIDSet or Get the password for matching between TX group and RX group, which can be composed of numbers or characters (default: 12345678)
AT+INTMODGet or Set the trigger interrupt mode
AT+BAUDRGet or set the baud rate of rs485. (default: 9600)
AT+DATABITGet or Set databit(7:7 bits,8:8 bits) of rs485 (default: 8)
AT+PARITYGet or Set parity(0:none,1:odd,2:even) of rs485(default: 0)
AT+STOPBITGet or Set stopbit(0:1 bit,1:1.5 bit,2:2 bit) of rs485(default: 0)
AT+CMDDLGet or Set the delay waiting time after receiving RS485 command (default: 400)
AT+CRCCHECKGet or set to receive and verify RS485 sensor data (0: Disable,1:CRC16_MODBUS) (default: 1)
AT+SCHEDULEEach TDC sends command data to the receiver.
AT+CFGDEVInstantly send RS485 commands to the receiver.
AT+RS485Send commands to the local RS485 device.
AT+MODGet or set the host send mode.(default: 0)

Example 1:

AT+SEND=01020304 will send a payload of 01020304.

Example 2:

AT+INTMOD=aa (0:Disable,1:falling or rising,2:falling,3:rising) (default: 2)

RS485-LN support external Interrupt uplink since hardware v1.2 release.

image-20220704104958-6.png

Connect the Interrupt pin to RS485-LN INT port and connect the GND pin to V- port. When there is a high voltage (Max 24v) on INT pin. Device will send an lora packet.

Example 3:

AT+SCHEDULE: This command will be sent to Group RX during each transmission, Max command length is 14 bytes. The grammar is:

AT+SCHEDULE =xx xx xx xx xx xx xx xx xx xx xx xx,m

xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent

m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command

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.

Example 4:

AT+CFGDEV: This command will be sent to Group RX.

The grammar is:

AT+CFGDEV =xx xx xx xx xx xx xx xx xx xx xx xx,m

xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent

m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command.

Example 5:

AT+RS485: This command will be sent to local RS485 device.

The grammar is:

AT+RS485 =xx xx xx xx xx xx xx xx xx xx xx xx,m

xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent

m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command.

Example 6:

  • AT+MOD=0 Commands are transparently transmitted through UART.
  • AT+MOD=1,500 Commands are transparently transmitted through RS485. 500 ms after the first character is received from RS485, all characters are commands.

Example 7:

  • AT+GROUPMOD=0 Set to point to point mode
  • AT+GROUPMOD=0,aa Set the TX group that controls the number of aa (The maximum value of aa is 8)
  • AT+GROUPMOD=1,bb Set to the RX group controlled by the TX group, numbered bb(The maximum value of bb is 8)
  • AT+GROUPMOD=0,2 Set to control the TX group of the two RX groups
  • AT+GROUPMOD=1,1 Set the RX group numbered 1
  • AT+GROUPMOD=1,2 Set the RX group numbered 2

5. Data Format

8 bytes of GROUPID +n payload + 4 bytes of checksum

Payload(S12, SF11, SF10 maximum length is 59, SF9 maximum length is 123, SF8, SF7 maximum length is 230):

Size (bytes)1111payloadsize
ValueaddressrequestACKpayloadsizecommand data or return data
  • The first byte: 00 is the broadcast address, 01-08 is the RX group number
  • The second byte: send request when not 0, not request when it is 0
  • The third byte: ACK returned to the sender.
  • The fourth byte: The command length of the sender or the data length of the RS485 sensor returned by the receiver.
  • The Fifth byte: RS485 command or RS485 return data.