Transmit Failure after days using LMIC library and Arduino IDE

Hello,

I am currently stuck with troubleshooting the transmission failure of my sensor node. It can work for several days fine until it reports a failure detected by the LMIC library and stops transmitting. I am using Arduino IDE, ATMEGA328P and an external interrupt to wake up my sensor node after a certain time interval.

For troubleshooting, I have logged the events using an SD card and noticed following error msg:

>     Measurement done
>     23:40:18
>     Sending uplink packet...
>     FAILURE

The failure arises from the LMIC library and most likely this part:

> // start transmitter (buf=LMIC.frame, len=LMIC.dataLen)
> static void starttx () {
>     ASSERT( (readReg(RegOpMode) & OPMODE_MASK) == OPMODE_SLEEP );
>     if(getSf(LMIC.rps) == FSK) { // FSK modem
>         txfsk();
>     } else { // LoRa modem
>         txlora();
>     }
>     // the radio will go back to STANDBY mode as soon as the TX is finished
>     // the corresponding IRQ will inform us about completion.
> }

The assert function checks the statement and reports an error. How do you think shall I troubleshoot this problem?

I have thought about:

  1. editing the library to report no failures
  2. changing the code flow to allow
  3. best solution imo: add an if statement in the Arduino code to force sleep or restart the loop after detecting a failure.

Thank you!

Also asked in the Things Network forums;