I updated RAK3172 version from 1.04 to 3.4.2-rui3_22q1_update.112
Below I have listed the commands that I run on Device A and the problem with receiving responses
ATZ\r\n \r\n RAKwireless RAK3172-E Example\r\n ------------------------------------------------------\r\n Current Work Mode: LoRa P2P.\r\n
AT+NWM=0\r\n \r\n RAKwireless RAK3172-E Example\r\n ------------------------------------------------------\r\n Current Work Mode: LoRa P2P.\r\n
AT+P2P=869525000:7:250:0:8:5\r\n OK\r\n
AT+PSEND=0D0076454BB0054C3230007BA5\r\n //data is received on second device (Device B) OK\r\n
AT+PRECV=65534\r\n OK\r\n
And now I have a problem. I don’t get the response from Device B. There is no data to read on serial port (I’m sure taht device B sends a reply)
When i changed version to 1.04 everything works fine.
Unfortunately, device B is an external device to which I do not have access and I do not know how exactly the transmission is implemented there. I can only say that communication with Device B worked, when Device A was in version 1.04
for a device A in pseudo-code it looks like this
while (true)
{
AT+VER=?\r\n
ATZ\r\n
AT+NWM=0\r\n
AT+P2P=869525000:7:250:0:8:5\r\n
AT+PSEND=0D0076454BB0054C3230007BA5\r\n //data is received on second device (Device B )
AT+PRECV=65534\r\n
//waiting for data on serial port with timeout
}
I’am not sure that is a root couse.
I tried remove AT+NWM=0 command from my flow, because after ATZ i got info RAKwireless RAK3172-E Example\r\n ------------------------------------------------------\r\n Current Work Mode: LoRa P2P.\r\n
so i don’t need to change to P2P manually, but it doesn’t help.
I am not sure what your experience with AT+NWM=1 is but it should restart the module automatically. If you can give more info or details, we will check it
Hi @carlrowan , could you give more details about why the device restarts?
it is possible to work switching from LoRaP2P and LoRaWAN modes using the arduino API (api.lorawan.nwm.set() and api.lora.nwm.set())? or doing so leads to an undefined state?
If possible I would like to know if the answer to this questions are valid for rak_rui 4.2.0
The LoRaP2P and LoRaWAN have different implementation. Making them work simultaneously is hard to do because once you receive a packet, you must handle it in accordance to the protocol you are trying to use - plain LoRa or with LoRaWAN stack?
If you really need something that will switch from LoRaP2P ↔ LoRaWAN, the possible way is use ABP then disable all frame counter checks. This way, you can always restart the module once you switch mode then send the LoRaWAN packet directly using the same sessions keys. I haven’t personally tested this but it is likely to work. Doing this however, removes security features implemented on LoRaWAN protocol.