RAK3172-SiP WisDuo LPWAN SiP for LoRa P2P Communication Using AT Commands
This guide demonstrates how to configure two RAK3172-SiP modules for LoRa P2P communication using AT commands. You will configure both modules with matching LoRa parameters, set one module to receive data, and use the other to transmit a payload.
Connect the RAK3172-SiP to a PC
Connect both modules to a computer using USB-to-UART TTL adapters. Both modules must be connected simultaneously to test LoRa P2P communication. For detailed connection instructions, refer to the RAK3172-SiP Quick Start Guide.
LoRa P2P Communication
It is recommended to start by testing the serial communication and verify the current configuration is working by sending these two AT commands:
AT
ATE
ATE will echo the commands you input to the module, which is useful for tracking the commands and troubleshooting.
You will receive OK when you input the two commands. After setting ATE, see all the commands you input together with the replies.
Try again AT and you should see it on the terminal followed by OK.
Figure 1: at+version command response- In setting up the RAK3172-SiP to work in LoRa P2P mode, you need to change the LoRa network work mode command on both RAK3172-SiP modules.
AT+NWM=0
AT+NWM parameter mode can be either 0=LoRa P2P or 1=LoRaWAN.
Figure 1: P2P Mode-
The device will start automatically if you change modes from LoRaWAN to LoRa P2P and vice-versa.
-
You might need to input the
ATEcommand again to ensure that your succeeding commands on P2P mode echo on the terminal.
- You need to input the P2P setup on both RAK3172-SiP modules. The parameters should be exactly the same in the two modules.
AT+P2P=868000000:7:125:0:10:14
For this P2P setup, the LoRa parameters are the following:
- Link frequency: 868000000 Hz
- Spreading factor: 7
- Bandwidth: 125 kHz
- Coding Rate: 0 = 4/5
- Preamble Length: 10
- Power: 14 dBm
Refer to the P2P Mode section of the AT command documentation to learn more about the definition of the parameters used and the individual commands if you want specific parameters changed.
Figure 1: Configuring P2P in both RAK3172-SiP Module- To set one module as the receiver (RX), you need to set the value of the P2P receive command.
LoRa P2P default setting is Transmitter (TX) mode. This consumes lower power compared to Receiver (RX) mode where the radio is always listening for LoRa packets.
a. P2P LoRa RX configurable duration value is from 1 to 65533 ms. In this example, the device will listen and wait for LoRa P2P Packets for 30000 ms or 30 seconds. It will automatically disable RX mode and switch to TX mode after the timeout. If the device did not receive any packets within the time period, then the callback after timeout is +EVT:RXP2P RECEIVE TIMEOUT.
AT+PRECV=30000
b. If the AT+PRECV value is set to 65535, the device will listen to P2P LoRa packets without a timeout, but it will stop listening once a P2P LoRa packet is received. After receiving the packets, it will disable RX mode and automatically switch to TX mode again.
AT+PRECV=65535
c. If the AT+PRECV value is set to 65534, the device will continuously listen to P2P LoRa packets without any timeout. It will continuously stay in RX mode until AT+PRECV is set to 0.
AT+PRECV=65534
d. If the AT+PRECV value is set to 0, the device will stop listening to P2P LoRa packets. It disables LoRa P2P RX mode and switches to TX mode.
AT+PRECV=0
- With one module configured as Transmitter (TX) and the other device will be the Receiver (RX), try to send or transmit P2P payload data.
AT+PSEND= <payload>
AT_PARAM_ERRORis returned when setting the wrong or malformed value.AT_BUSY_ERRORis returned if the device is still in RX mode and you try to send or reconfigure the RX period. If theAT+PRECVcommand is set to 65534, you need to execute firstAT+PRECV=0to be able to configure again the TX and RX state and avoidAT_BUSY_ERROR.<payload>: 2-500 digit length, must be an even number of digits and character 0-9, a-f, A-F only, representing 1~256 hexadecimal numbers. For example, if the payload is like0x03, 0xAA, 0x32, therefore the AT command should beAT+PSEND = 03AA32.
Figure 1: Configuring P2P in both RAK3172-SiP Module