Difference between revisions of "Template:SX1262-LoRa-DTU-xF User Guide"

From Waveshare Wiki
Jump to: navigation, search
Line 404: Line 404:
 
*The default firmware update interface is RS485, other interfaces are not supported.
 
*The default firmware update interface is RS485, other interfaces are not supported.
 
*Press the KEY button within three seconds after powering on, and the TXD and RXD lights will flash once, and enter the firmware update mode, use a USB to RS485 tool (such as USB TO RS485) to connect DTU and PC.
 
*Press the KEY button within three seconds after powering on, and the TXD and RXD lights will flash once, and enter the firmware update mode, use a USB to RS485 tool (such as USB TO RS485) to connect DTU and PC.
*Download and open the firmware update software, open the corresponding COM, select the latest firmware such as SX1262-LoRa-DTU-HF-V1.1.ws, and click the Update button to update.
+
*Download and open the firmware update software, open the corresponding COM, select the latest firmware such as SX1262-LoRa-DTU-HF-V1.2.ws, and click the Update button to update.
 
[[File:SX1262-LoRa-DTU-xF User Guide24.jpg]]
 
[[File:SX1262-LoRa-DTU-xF User Guide24.jpg]]

Revision as of 07:24, 22 July 2023

How To Use

Boot Test

  • This test uses two sets of USB to RS232 cables and a DTU connection to test on PC Windows 10, DTU uses an RS232 interface for streaming mode transmission by default when powered on.
  • Install DTU's antenna, RS485/RS232/RS422 interface circuit according to the #Hardware Description chapter (power on with RS232 by default, switch to other interfaces to refer to the AT command set), power supply, etc.
  • Download and open the AT setting tool or other serial port assistant tools, connect the USB to the RS232 serial port number, set the baud rate to 115200, and finally click to open the serial port.
  • After entering the data in the SSCOM sending area and clicking the send button, the received data will be printed on the other set of DTU, and vice versa, as shown in the figure below.
  • Similarly, other acquisition devices such as PLC can also use DTU to send and receive data.

SX1262-LoRa-DTU-xF User Guide 01.jpg

AT Commands

  • The DTU works in the stream transmission mode of the RS232 interface by default, and the default parameters can be used for pairing and sending. The default parameters are as follows:
Item Parameter Default Value
Spreading Factor Default 7, (7~12 optional)
Bandwidth Default 0: 125KHz (1:250, 2:500 (KHz) optional)
Code Rate Default 4/5 (4/5, 4/6, 4/7, 4/8 optional)
Emit Power Default 22dBm (10~22dBm optional)
Network ID Default 0 (0~255 optional)
LBT (Listen Before Talk) Default 0: disabled, 1: enabled
Operating Mode Default 1: stream mode (2: packet mode, 3: relay mode)
Transmission Channel HF version defaults to 18 (corresponding to 868MHz) ( 0~80 is optional, corresponding to 850~930Mhz or 410~490MHz )
LF version defaults to 23 (corresponding to 433MHz)
Receiving Channel HF version defaults to 18 (corresponding to 868MHz) ( 0~80 is optional, corresponding to 850~930Mhz or 410~490MHz )
LF version defaults to 23 (corresponding to 433MHz)
Address Default 0 (0~65535 optional, 65535 is broadcast listening address)
Interface Selection Default 3: RS232 (1: RS422, 2: RS485, 3: RS232 optional)
Interface Baud Rate Default 115200bps (1200~115200bps optional)
Interface Parity No parity by default (no parity, odd parity, even parity optional)
Key Default 0 no encryption (0~65535 optional)
  • For DTU settings, please check the add CRLF or add the carriage return line feed option. If the extension bar does not appear, click the extension button on the right to pop up. Click the +++ command button to enter the AT command mode, as shown in the figure below:

DTU-xF User Guide.jpg

  • When configuring DTU for other devices such as PLC, pay attention to the carriage return and line feed character CR LF(\r\n) at the end of the AT command.
+++\r\n                                               Enter AT command mode
AT+EXIT\r\n                                           Exit AT command mode
ATE\r\n                                               Enable/disable AT command echo
AT+VER\r\n                                            Check the software version number
AT+HELP\r\n                                           View AT help

AT+SF=7\r\n                                           Set the spreading factor to 7, the value range is 7~12
AT+BW=0\r\n                                           Set bandwidth, 0 means 125KHz, 1 means 250KHz, 2 means 500KHz
AT+CR=1\r\n                                   Set the encoding rate to 1, 1 represents 4/5, 2 represents 4/6, 3 represents 4/7, 4 represents 4/8
AT+PWR=22\r\n                                         Set the RF power, the value range is 10~22dBm
AT+NETID=0\r\n                                        Network ID assignment, the value range is 0~65535
AT+LBT=0\r\n                                          Enable/disable LBT function, 0: disable, 1: enable
AT+MODE=1                                             DTU working mode, 1: stream mode, 2: packet mode, 3: relay mode
AT+TXCH=18\r\n                                        Transmit channel, value range 0~80, corresponding frequency point is 850~930MHz or 410~490MHz
AT+RXCH=18\r\n                                        Receive channel, value range 0~80, corresponding frequency point is 850~930MHz or 410~490MHz
AT+RSSI=0\r\n                                         Enable/disable RSSI signal value output, 0: disable, 1: enable
AT+ADDR=0\r\n                                         Set DTU address, value range 0~65535
AT+PORT=3\r\n                                         Set COM port, 1:RS422, 2:RS485, 3:RS232
AT+BAUD=115200\r\n                                    Set COMx port baud rate, value range 1200~115200, 1200, 2400, ....., 57600, 115200ss
AT+COMM="8N1"\r\n                                     Set COM port parameters, data bits: 8 or 9, parity: N, O, E, stop bits: 0, 1, 2
AT+KEY=0\r\n                              Set the key, the value range is 0~65535, 0: prohibit encryption, 1~65535: encrypt the transmission key value
AT+AllP=7,125,1,22,0,0,1,18,18,0,0,3,115200, "8N1",0   Set the spreading factor to key multi-parameter
AT+RESTORE=0\r\n                                      Restore factory settings, 0: disabled, 1: enabled

Stream Transfer Mode

  • DTU is in the stream mode when working in the RS232 interface by default, and the factory default parameters can be used for pairing and sending.
  • Stream transfer mode refers to a transmission mode in which the DTU transmits the data stream sent by the interface to other DTUs for demodulation by LoRa and outputs the data stream from the specified interface, that is, send and receive as shown below:
    • Suppose there are DTU A, B, C, D, E, F, and G devices to form a stream mode communication network. To change the address, channel, and working mode of the DTU device in the LoRa network, please refer to the following communication diagram and parameter table, and pay attention to using the AT command (AT+MODE=1\r\n) to switch to the stream transfer mode.
      • DTU A and DTU C form point-to-point communication.
        • DTU A sends Hello World to the DTU C device, the DTU C device with a matching address channel can receive it normally.
        • DTU C sends Hello World to the DTU A device, DTU A device with a matching address channel can receive it normally.
      • DTU A, B, C, D, E, and F constitute stream mode point-to-multiple communication, DTU B address is set to 65535 (Hex: 0xFFFF), at this time it will be used as a device with broadcast monitoring function in the LoRa network, DTU B broadcast when sending data streams, devices with addresses 0~65535 in the same channel can receive data streams, and when other devices send data streams, DTU B can monitor the data streams of devices with addresses 0~65535 in the same channel.
        • DTU B broadcasts and sends HI World data streams, DTU A, C, D, and E devices with matching channels receive normally, and DTU F devices with mismatched channels fail to receive.
        • When DTU A, C, D, and E send data stream, such as DTU A sends Hello World, DTU B device can monitor the received data stream.
        • When a DTU F device with a mismatched channel sends a data stream, DTU B fails to monitor and receive.

DTU-xF User Guide02.jpg

Parameters DTU A DTU B DTU C DTU D DTU E DTU F
Spreading Factor 7 7 7 7 7 7
Bandwidth 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz
Code rate 1: 4/5 1: 4/5 1: 4/5 1: 4/5 1: 4/5 1: 4/5
Operating Mode 1: Stream mode 1: Stream mode 1: Stream mode 1: Stream mode 1: Stream mode 1: Stream mode
Address 65534 (Hex:0xFFFE) 65535 (Hex:0xFFFF) 65534 (Hex:0xFFFE) 65534 (Hex:0xFFFE) 0 (Hex:0x0000) 65534 (Hex:0xFFFE)
Channel 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12) 65 (Hex:0x41)
Example 1 Send Hello World × ×
Example 2 Send Hi World ×
Example 3 Send Any World × ×

SX1262-LoRa-DTU-xF User Guide090.jpg

Packet Transfer Mode

  • Packet transfer mode refers to a transmission mode in which DTU communicates with other DTU devices with a specified address and channel. The address and channel of the receiving DTU device are specified in the first 3 bytes of the data stream. The data stream uses a hexadecimal data format.
    • Suppose there are DTU A, B, C, D, E, and F a total of 6 DTU devices to form a packet transfer mode LoRa communication network, change the address, channel, and working mode of the DTU device in the LoRa network, please refer to the following communication diagram and parameter table, pay attention to use AT command (AT+MODE=2\r\n) to switch to packet mode.
      • DTU A and DTU C devices form point-to-point communication in packet transfer mode.
        • DTU A sends the hexadecimal data stream FF FE 12 AA, where FF FE is the address of the DTU device (DTU C) receiving the data stream, 12 is the channel of the DTU device (DTU C) receiving the data stream, and AA is the data (Note that the hexadecimal data format is A...Z, such as AA, AZ, ZA, etc.), and the DTU C device whose address channel matches normally receives.
        • DTU C sends the hexadecimal data stream 00 01 12 CC, where 00 01 is the address of the DTU device (DTU A) receiving the data stream, 12 is the channel of the DTU device (DTU A) receiving the data stream, and CC is the data (Note that the hexadecimal data format is A...Z, such as AA, AZ, ZA, etc.), and the DTU A device whose address channel matches normally receives.
      • DTU A, B, C, D, E, F form the point-to-multiple communication of the packet mode, DTU B address is set to 65535 (Hex: 0xFFFF), at this time it will be used as a device with broadcast monitoring function in the LoRa network, and DTU B will broadcast and send Data flow, devices with address 0~65535 under the same channel can receive data flow when other devices send data flow, DTU B can monitor the data flow of devices with address 0~65535 under the same channel.
        • DTU B broadcasts and sends the hexadecimal data stream FF FF 12 BB, where FF FF is the broadcast address, 12 is the channel, BB is the data, and the channel matched DTU A, C, D, E (channel 18 (Hex:0x12)) device receives normally, but the channel does not match the DTU F (channel 65 (Hex: 0x41)) device fails to receive.
        • When DTU A, C, D, and E send data stream, such as DTU A sends FF FE 12 AA, DTU B device can monitor the received data stream BB.
        • When a DTU F device (channel 65 (Hex: 0x41)) with a mismatched channel sends a data stream, DTU B fails to monitor and receive.

DTU-xF User Guide03.jpg

Parameters DTU A DTU B DTU C DTU D DTU E DTU F
Spreading Factor 7 7 7 7 7 7
Bandwidth 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz
Code Rate 1: 4/5 1: 4/5 1: 4/5 1: 4/5 1: 4/5 1: 4/5
Operating Mode 2: Packet transfer mode 2: Packet transfer mode 2: Packet transfer mode 2: Packet transfer mode 2: Packet transfer mode 2: Packet transfer mode
Address 65534 (Hex:0xFFFE) 65535 (Hex:0xFFFF) 65534 (Hex:0xFFFE) 65534 (Hex:0xFFFE) 0 (Hex:0x0000) 65534 (Hex:0xFFFE)
Channel 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12) 65 (Hex:0x41)
Example 1 Send AA (Hex) × ×
Example 2 Send BB (Hex) ×
Example 3 Send CC (Hex) × ×

SX1262-LoRa-DTU-xF User Guide15.jpg

Relay Mode

  • Relay mode refers to a transmission mode that uses some DTU devices in the LoRa network as relay nodes to forward data packets from stream transfer mode or packet transfer mode, and the interface of the device itself does not output any data, so as to increase the wireless communication distance.

DTU-xF User Guide10.jpg

First-level Relay

  • First-level relay refers to the transmission mode in which multiple DTU devices are composed of LoRa networks, and only one DTU device is forwarded as a node in relay mode to forward data streams from other DTU devices.
    • After the DTU A, G, and H devices form another first-level relay LoRa network, and after setting DTU G (using AT+MODE=3rn instructions) to relay mode, DTU G only forwards the data stream of DTU A and DTU H, and the interface does not output the data stream.
    • Under the relay mode LoRa communication network, the communication device in stream transfer mode or packet transfer mode has the same parameters except for the NETID parameter, and the NETID parameter of DTU A and H will be used as the address of the relay node, such as the NETID of DTU A, H forms the address of DTU G Hex: 0x0304 (Decimal: 772).
Parameters DTU A DTU G DTU H
Spreading Factor 7 7 7
Bandwidth 0: 125KHz 0: 125KHz 0: 125KHz
Code Rate 1: 4/5 1: 4/5 1: 4/5
NETID Hex: 0x03 (Decimal: 3) Ignore Hex: 0x03 (Decimal: 3)
Operating Mode 1: Stream Transfer Mode 3: Relay Mode 1: Stream Transfer Mode
Address Hex: 0x0102 (Decimal: 258) Hex: 0x0304 (Decimal: 772) Hex: 0x0102 (Decimal: 258)
Channel 18 (Hex:0x12) 18 (Hex:0x12) 18 (Hex:0x12)

SX1262-LoRa-DTU-xF User Guide17.jpg

Second-level Relay

  • Second-level relay refers to the transmission mode in which multiple DTU devices are composed of LoRa networks, and only two DTU devices are forwarded as nodes in relay mode to forward data streams from other DTU devices.
  • In the above figure, DTU A, B, C, and D devices form a secondary relay LoRa network, respectively set DTU B, C (use AT+MODE=3rn instruction) to relay mode, DTU B, C only forwards DTU A and DTU D data streams, and the interface does not output data streams.
Parameters DTU A DTU B DTU C DTU D
Spreading Factor 7 7 7 7
Bandwidth 0: 125KHz 0: 125KHz 0: 125KHz 0: 125KHz
Code Rate 1: 4/5 1: 4/5 1: 4/5 1: 4/5
NETID Hex: 0x03 (Decimal: 3) Ignore Ignore Hex: 0x05 (Decimal: 5)
Operating Mode 1: Stream Transfer Mode 3: Relay Mode 3: Relay Mode 1: Stream Transfer Mode
Address Hex: 0x0102 (Decimal: 258) Hex: 0x0304 (Decimal: 772) Hex: 0x0405 (Decimal: 1029) Hex: 0x0102 (Decimal: 258)
Channel 18 (Hex: 0x12) 18 (Hex: 0x12) 18 (Hex: 0x12) 18 (Hex: 0x12)

SX1262-LoRa-DTU-xF User Guide 18.jpg

Other Functions

Encryption

  • The encryption function encrypts the DTU plaintext data using the AES algorithm and then transmits it through LoRa to achieve the purpose of wireless communication security.
  • Use AT+KEY=65535 (default 0: disable encryption, 1~65535: key value) command to set the encryption key.
  • After encryption is enabled, DTUs with the same key value can communicate normally, but DTUs with different key values cannot communicate normally.
    • In the figure, after setting the same key, DTU A and B communicate normally, but DTU C with different key values outputs garbled characters.

SX1262-LoRa-DTU-xF User Guide20.jpg
SX1262-LoRa-DTU-xF User Guid21.png

RSSI Output

  • RSSI, Received signal strength indication, used to evaluate signal quality, improve communication network, distance measurement, etc.
  • After using AT+RSSI=1 (default 0: disabled) to enable the RSSI function, as shown in the figure below, each output data packet will follow a hexadecimal RSSI value.

SX1262-LoRa-DTU-xF User Guide22.jpg

LBT (Listen Before Talk)

  • LBT (Listen Before Talk) means that the module actively monitors the channel environment noise before sending. This function can improve the communication success rate and anti-collision processing of DTU in harsh environments.
  • Use AT+LBT=1 (default 0: disabled) to enable the LBT function, and actively monitor the channel noise before sending the data packet, if it exceeds the threshold, the sending will be delayed, the maximum delay is two seconds, and the sending will be forced after more than two seconds.

SX1262-LoRa-DTU-xF User Guide23.jpg

Upgrade Firmware

  • The default firmware update interface is RS485, other interfaces are not supported.
  • Press the KEY button within three seconds after powering on, and the TXD and RXD lights will flash once, and enter the firmware update mode, use a USB to RS485 tool (such as USB TO RS485) to connect DTU and PC.
  • Download and open the firmware update software, open the corresponding COM, select the latest firmware such as SX1262-LoRa-DTU-HF-V1.2.ws, and click the Update button to update.

SX1262-LoRa-DTU-xF User Guide24.jpg