Program stalling - Seeeduino XIAO, Adafruit RFM9x LoRa module + RadioHead Library

I have a XIAO conneted to an Adafruit RFM9x LoRa module, and I have a relatively simple program running. The program uses a timer with a one second interval to indicate that a transmission is due over the radio.


#define RFM95_CS PIN_A7
#define RFM95_INT PIN_A6
#define TRANSMISSION_FREQUENCY 868.6

/****************
 * The XIAO does not run on FreeRTOS, and therefore we cannot
 * make use of Tasks, so instead, we use a Timer to indicate
 * that we need to perform some action
 *************************************************************/
#define Transmission_Timer TimerTc3 


/****************
 * Evaluated to determine whether or not we need to send
 * a WPT message
 *************************************************************/
volatile bool TransmitNextMessage = false;

/****************
 * Forward declarations of functions
 *************************************************************/
void TRANSMISSION_ISR();
void transmit();

/****************
 * Create an instance of the LoRa radio
 *************************************************************/
RH_RF95 LoRa_Radio(RFM95_CS, RFM95_INT);

void setup()
{
  Serial.begin(115200);
  delay(100);
  uint32_t timestamp = millis();
  while(millis() - timestamp < 2000)
    ;

  Serial.println("LoRa radio TX Test");
  while (!LoRa_Radio.init())  { Serial.println("LoRa radio init failed"); delay(1000); }
  while (!LoRa_Radio.setFrequency(TRANSMISSION_FREQUENCY)) 
  {
    Serial.print("Setting Freq to: "); Serial.print(TRANSMISSION_FREQUENCY); Serial.println(" failed"); delay(1000);
  }
  LoRa_Radio.setTxPower(20); // maximum power for the Adafruit RFM9x chip
  LoRa_Radio.setModeTx();

  /****************
   * Initialize the timer and register the ISR function
   *************************************************************/
  Transmission_Timer.initialize();
  Transmission_Timer.attachInterrupt(TRANSMISSION_ISR);
}

unsigned long packetnum = 1; // packet counter, we increment per xmission
void loop()
{
  __disable_irq();
  
  bool run = TransmitNextMessage;
  if(run)
    TransmitNextMessage = !TransmitNextMessage;

  __enable_irq();

  if(run)
    transmit();
}

void transmit()
{
  uint8_t size = 32;
  char message[size];
  memset(message, 0, size);
  snprintf(message, 32, "Hello World # %lu", packetnum++);

  Serial.printf("Sending [%u]::[%s] on ", strlen(message), message); Serial.println(TRANSMISSION_FREQUENCY); 
  LoRa_Radio.send((uint8_t *)message, strlen(message));
}

void TRANSMISSION_ISR() { TransmitNextMessage = true; }

The probem I am experiencing is manifest in the XIAO simply ceasing and requiring a reset at any given time.

There is no continuity to it that I can see, for example it might stop running after 1800 seconds, and another time it will stop after 5052 seconds.

Would anyone have any ideas as to why this could be happening … I don’t really want to be littering the code with Serial.print() statements, but at this time I think that’s the only way to figure out at what point it is stalling

Update: So, the latest scoop is that it ran for 3hrs 13minutes and 36seconds this time …it seems to be getting stuck on sending a packet via the radio, and I’m not sure if this is an issue with the Adafruit board or with the XIAO