Error handling and troubleshooting on end devices (connection loss / no gateway / join failure)

Hi guys,

I recently started working with TTN on a ESP32 platform (Heltec Lora V2), using this library
https://github.com/manuelbl/ttn-esp32, which is a port of LMIC for ESP-IDF.

Is there a way to handle different kind of problems that may occur in practice.
For example: When I try to join but the gateway is turned off (or appkey etc. is wrong), it just goes into a infinite loop of events EV_TXSTART.
The same problem arises after I join, send a few messages then disconnect the gateway, the devices goes into a loop of EV_TXSTART (I counted 8 of them) then EV_TXCOMPLETE.
But I’d rather have some way of configuring how many trials should it have before giving up or any error/connection loss handling mechanism. Any suggestions how can I properly configure LMIC and what sort of troubleshooting capabilities it has?

Thank you!

If this is LMiC based, search the sources for LINK_CHECK_DEAD and similar.

It may be that it attempts to rejoin at that point - which is probably a strategic mistake.

I also have the problem, if the gateway ist down, and i start a node, the node runs in a endles loop “EV_JOINING” and drains all Battery. How can I stop this endles EV_JOINING?

Thanks,

First of all, join your nodes before you deploy them. And fix your node firmware so that it doesn’t re-join unless things are really broken (though how you would know that vs. being out of range is an unsettled issue - see below)

Next, if you are in a join setting, backoff the rate at which you try to do so. You might initially try say once a minute, but you should have a backoff so you eventually fall back to maybe just a few times a day, if these can get forgotten about in storage out of range of a gateway for months at a time.

To say that typical examples are not well suited to real world use would be to recognize an often overlooked reality. IMHO the whole OTAA scheme in LoRaWAN is dubious (at least in this version), but that’s another topic…