LilyGO / TTGO-LORA32

ESP32-TTGO-T3
326 stars 100 forks source link

Sender Code Crashes #34

Closed va7ta closed 1 year ago

va7ta commented 1 year ago

I previously posted about this about a week ago and then closed the issue a day later as I decided I should do more testing to ensure that what I am seeing is not a hardware issue. I decide to swap sender/receiver functions between my two TTGO-LORA32 modules to confirm the sender failure occurred when running on either module. I also decided to use an alternate USB power source to ensure it wasn't being caused by a power glitch from a flakey power source. The sender failures continued to occur after running for random periods of time. Some failures occurred after a few hours and some failure-free periods extended much longer, more than 12 hours.

To restore I need to reset the sender either by cycling the USB port power source or pressing reset. The last transmission that is sent during the crash is typically garbled.

I wonder if there is a memory leak or a buffer over run that is causing the failures? The random nature of the failures is puzzling and probably difficult to track down. I wonder if there might be an EMI issue.

Considering the usual remotely installed sender applications I wonder if a watch dog timer could be implemented within the code to protect against this type of failure? Or would an external WDT be necessary?

va7ta commented 1 year ago

Greetings,

As an effort to rule out EMI as the cause of the intermittent sender crashes I subsequently decided to enclose the sender in an RF tight aluminum box. The LoRa antenna was placed externally to isolate it from the PCB as shown in the photos. This significantly reduced the PCB EMI exposure to the LoRa transmission.

The failures still occur as shown by the photos. In this instance the sender crashed after 18,912 transmissions which was after a operational period of about 3 hours.

As power cycling the sender without disturbing the receiver restores normal operation it is clear that the failures occur within the sender and that a sender firmware instability is probable as:

  1. When the sender/receiver functions of the two PCBs are reversed the failure always occurs on the sender transmission end which rules out a PCB hardware problem.
  2. Two different power sources were tried with the same results.
  3. Failures still occur with EMI isolation of the LoRa antenna and any other possible external EMI sources.

Possibly an external watch dog timer (WDT) is worthy of consideration to provide resets when necessary.

IMG_20221018_182706 IMG_20221018_182911 IMG_20221019_093316 IMG_20221019_095408

va7ta commented 1 year ago

Subsequently I ran another test and this time it got up to 39,302 transmissions (roughly 18 hrs.) before the sender crashed. Once it crashes a reset is needed to restore the sender to normal operation. It would seem that for this sender version the addition of an effective external WDT supervisor IC should be considered.

va7ta commented 1 year ago

Upon removing the WiFi code module that I had installed I found the LoRa sender code ran for days with over 100,000 transmissions without failing. There is apparently an incompatibility between the WiFi driver and the LoRa code that was causing the crashes.