How RAK3172 module know that Gateway disconnect

Hi,

I am using the RAK Wireless RAK3172-T for our application. When the gateway is powered off and the device is disconnected, how can we determine that the connection is lost? I am using the AT+NJS=? command for status, but it does not update when the gateway disconnects; it always shows ‘1’ on status. Is there a more reliable method to check whether the gateway is joined or not?

Once the device had joined, you need to implement other functions to determine whether the gateway is still in range or functional.

(1) Use Confirmed Packets with AT+CFM=1. In this mode, the LoRaWAN server sends back an ACK packet. If your device does not receive the ACK it will show an error in the response.
(2) Use LinkCheck with AT+LINKCHECK=1 (or 2). When enabled. the LoRaWAN server will send back a packet with information about the connectivity. If the LinkCheck fails, the connection to the LoRaWAN server is interrupted.

Both methods should not be used all the time, because both are increasing the usage of air time of the device. But you can use them every now and then to check the connection to the LoRaWAN server.

Details for these two commands are in the RUI3 AT command manual