I have been soak testing Seeed LoRa-E5 equipped TinyCLR and netNF devices for the last couple of weeks and after approximately two days they would stop sending data. The code is still running but The Things Industries device live data tab is empty.
I have reviewed the code line by line and it looks okay. When I run the application on the device with the debugger attached the device does not stop transmitting (a heisenbug) which is a problem.
First step was to disable the sleep/wakeup power conservation calls and see what happens
#if PAYLOAD_COUNTER
Debug.WriteLine($"{DateTime.UtcNow:hh:mm:ss} Send Timeout:{SendTimeout.TotalSeconds} Seconds payload Counter:{PayloadCounter}");
#if CONFIRMED
result = device.Send(BitConverter.GetBytes(PayloadCounter), true, SendTimeout);
#else
result = device.Send(BitConverter.GetBytes(PayloadCounter), false, SendTimeout);
#endif
PayloadCounter += 1;
#endif
if (result != Result.Success)
{
Debug.WriteLine($"Send failed {result}");
}
/*
Debug.WriteLine($"{DateTime.UtcNow:hh:mm:ss} Sleep");
result = device.Sleep();
if (result != Result.Success)
{
Debug.WriteLine($"Sleep failed {result}");
return;
}
*/
Thread.Sleep(60000);
/*
Debug.WriteLine($"{DateTime.UtcNow:hh:mm:ss} Wakeup");
result = device.Wakeup();
if (result != Result.Success)
{
Debug.WriteLine($"Wakeup failed {result}");
return;
}
*/
The devices have now been running fine for 4.5 days so it looks like it might be something todo with entering and/or exiting low power mode.



