[ATOO] How can I do a rejoin?

Hello

I am using the library LMIC and I obrserved some time, the node can not send any more the data to TTN V3.

My node turn on a led while it is sending and the led turn off when the onEvent return
EV_COMPLETE

Some time, the led never turn off. It meens, the node is always trying the send, or waititng for a confirmation from TTN V3.

I inverstigated more, and I observed that this event occured because the onEvent return EV_LINK_DEAD after EV_COMPLETE

I also understand (with my words) the node lost connection or a new connection need to be etablished.

A recently exemple, my gateway had no credit on the GSM card. The gateway could not be seen at TTN V3 console. I charged my GSM card and the gateway was viewed at TTN V3 console. But all my nodes had the led on.

To solve that issue, I need to restart all my nodes and a join were done. My nodes work again

1494183: EV_JOINING
1523697: Unknown event
1916929: Unknown event
5909971: Unknown event
6231310: EV_JOINED

One of a solution I see, is to restart the nodes with the watchdog library.

I would add the bellow code after the line 179

wtime = Watchdog.enable(4000);
Serial.print(F("Restarting in "),2);
Serial.print(wtime,2);
Serial.println(F("ms"),2);
Watchdog.reset();
while(1);

But I wonder if I can do a rejoin , if onEvent return EV_LINK_DEAD. If yes how?

Would LMIC_reset() help if I call that function after the line 179?

Or should I call

os_init()
LMIC_reset()

Or is a function which does a rejoin, … or would it better to software restart?

Thanks

Hello,
Is there no way to rejoin my node to the network while I received a EV_LINK_DEAD message?

There are several functions related to joining in LMIC:

Joining is done on request of the node itself, it can initiate this any time as far as I know.
Ideally a device does this only once in its lifetime. A practical implementation could be to do this on reboot or power-cycling and try your very best to avoid rebooting/power-cycling, opinions may vary. Joining consumes a nonce-token so at some point you run out of those.

The log line about “Unknown event” suggests that your main arduino sketch is out-of-date with the library. It would be good to get the full information about what these events are exactly.

A node does not really have a “connection” to a gateway. The node message is broadcast and a gateway picks it up (could be more than 1). Then if the network considers it necessary to reply, it picks a gateway and sends a response. The node has a connection to the network, through a gateway.

I don’t know the exact details around what triggers the EV_LINK_DEAD message.

The code says at

“If this no such prove is coming then the datarate is lowered and a LINK_DEAD event is generated.”
If the data rate is lowered all the way to DR0/SF12, then it may take a relatively long time between transmits, because the LMIC library avoids violating the duty cycle rule of the regional setting (typically 0.1%). Each step in DR / SF is about a factor 2 in air-time.