AdaFruit Feather M0, stuck between EV_TXSTART and EV_TXCOMPLETE?

Hi,

I had a sketch running for about 6 days testing my standby code, and found it seemingly stuck between the EV_TXSTART and EV_TXCOMPLETE events.

I’m wondering what might cause that to happen.

This sketch is running with my mod to use a 32768 Hz TCC register as the source for LMIC ticks. It had wrapped at least once in the time the sketch is running so I don’t think that was the cause.

My loop() function looks like this:

void loop() {

    os_runloop_once();

    // If LMIC hasn't joined yet, or is in a TX/RX state,
    // let LMIC process and return without doing anything else.
    if ( ! (joined && timeOk)) {
        return;
    }

    // No point doing anything if LMIC is busy in an uplink/downlink.
    if (LMIC.opmode & OP_TXRXPEND) {
        return;
    }

    // Now my logic to check the job queue and maybe go to standby mode.
    ...
}

The sketch was in a state where joined and timeOK were both true.

I am attempting to let LMIC tight-loop os_runloop_once() while it is in an uplink/downlink state, and only go on to see if it can go to standby when LMIC has not scheduled any jobs for the next few seconds.

I have log messages that should have been written if the checks above did not cause an early return from loop(). The log messages are coming from Serial1 (although, it seems Serial now works when coming out of standby mode when it didn’t used to).

The sketch sent an uplink every hour, plus whatever uplinks were required to handle MAC commands from TTN.

Any idea what could cause LMIC to fail to get to a state where it issues EV_TXCOMPLETE?

I’ve now modified the sketch to use the WDT when it’s not in standby mode, removed the first if statement in loop(), and replaced the second one with

if ( ! LMIC_queryTxReady()) {
        return;
    }

But I’m wondering if anyone has seen this on a Feather?

Regards, David.