timmbogner / Farm-Data-Relay-System

A system that uses ESP-NOW, LoRa, and other protocols to transport sensor data in remote areas without relying on WiFi.
MIT License
485 stars 108 forks source link

Esp8266 freeze #150

Closed Stips5 closed 1 year ago

Stips5 commented 1 year ago

Is anyone havig problem with esp8266 freezing after 10-15 minutes, I have following hierarchy. Esp8266 with lora and mqtt which freezes after 15minutes, It receives lora msgs from esp32, so far no problems with it. Esp receives msg from another esp8266 through espnow and it also freezes after 15 minutes. So my thought is that it has to be some memory or cpu issue. Since its working same when connected to pc and when connected to power grid. No error msg are being printed in console. Any ideas?

timmbogner commented 1 year ago

I'm running a "torture test" sending data from an ESP32 ESP-NOW "stress test" sensor to a Wemos8266 gateway sending via ESP-NOW to ESP32 gateway, linked via UART to Wemos8266 MQTT gateway. They've been buzzing along for 30 minutes without issue.

I'll let this run for a while and get back to you tomorrow. What ESP8266 module are you using? Are you using the latest version of FDRS?

Stips5 commented 1 year ago

I am running version where pm data types where added, I am using nodemcu esp8266's. My sensor sends data every 10 seconds, at what rate do you send data?

  sendFDRS();
  sleepFDRS(10);  //Sleep time in seconds
timmbogner commented 1 year ago

The stress test sends every 15 milliseconds, and it's all still going on mine.

Try updating at least the 8266 devices to the latest FDRS version and see how they work. I made a lot of changes (behind the scenes) since your version, maybe something will have fixed it.

The only settings that should have changed are in LoRa config, let me know if you have questions on updating.

Stips5 commented 1 year ago

I've also added this to my MQTT gateway but its not reason why sensor fails

void mqtt_publish(const char* payload) {
#ifdef USE_WIFI

  //TODO extract to config paramet
```er
  client.setBufferSize(512);

Ill try with updateing FDRS
timmbogner commented 1 year ago

The only settings that should have changed are in LoRa config, let me know if you have questions on updating.

Just remembered that gateway neighbor and buffer usage actually have changed, check the docs for more info.

Stips5 commented 1 year ago

Its too bit jump for me, for now, I'll have to figure it out, I am using LoRa ra02 I think its 1278, I'll need some time to figure it out

18:12:18.196 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
18:12:18.196 -> 
18:12:18.196 -> Soft WDT reset
18:12:18.196 -> 
18:12:18.196 -> >>>stack>>>
18:12:18.228 -> 
18:12:18.228 -> ctx: cont
18:12:18.228 -> sp: 3ffffcb0 end: 3fffffc0 offset: 01a0
18:12:18.228 -> 3ffffe50:  3fff0034 3fff09cc fffffff4 402014bc  
18:12:18.228 -> 3ffffe60:  00000011 00000008 00000000 feefeffe  
18:12:18.228 -> 3ffffe70:  00000000 0028002f 00000000 00000000  
18:12:18.228 -> 3ffffe80:  0028002f 00000000 feefeffe feefeffe  
18:12:18.228 -> 3ffffe90:  feefeffe feefeffe feefeffe feefeffe  
18:12:18.228 -> 3ffffea0:  feefeffe feefeffe feefeffe feefeffe  
18:12:18.259 -> 3ffffeb0:  feefeffe feefeffe feefeffe feefeffe  
18:12:18.259 -> 3ffffec0:  feefeffe feefeffe feefeffe feefeffe  
18:12:18.259 -> 3ffffed0:  feefeffe feefeffe feefeffe 3fff19b4  
18:12:18.259 -> 3ffffee0:  00000000 00000002 3ffe8d94 4020b9a4  
18:12:18.260 -> 3ffffef0:  3ffe8d95 00000009 3fffff58 4020b9a4  
18:12:18.260 -> 3fffff00:  3fffff59 00000008 00000009 3fff0a58  
18:12:18.260 -> 3fffff10:  40208ef4 3ffe8d93 3fff09cc 40208f00  
18:12:18.292 -> 3fffff20:  40208ef4 3ffe8d93 3fff09cc 40209160  
18:12:18.292 -> 3fffff30:  3fffdad0 3fff09cc 00000009 40209244  
18:12:18.292 -> 3fffff40:  00000000 00000000 0000000b 40209276  
18:12:18.292 -> 3fffff50:  00000000 3a737365 00000000 3fff0a58  
18:12:18.292 -> 3fffff60:  3fffdad0 00000000 3fff09cc 40201775  
18:12:18.292 -> 3fffff70:  00000000 3a737365 00000000 00000000  
18:12:18.292 -> 3fffff80:  3a737365 00000000 feefeffe feefeffe  
18:12:18.292 -> 3fffff90:  feefeffe feefeffe 3fff0a44 402017c8  
18:12:18.324 -> 3fffffa0:  feefeffe feefeffe feefeffe 4020a3c4  
18:12:18.324 -> 3fffffb0:  feefeffe feefeffe 3ffe85f0 40101371  
18:12:18.324 -> <<<stack<<<
18:12:18.324 -> 
18:12:18.324 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
18:12:18.356 -> 
18:12:18.356 ->  ets Jan  8 2013,rst cause:1, boot mode:(3,2)
18:12:18.356 -> 
18:12:18.356 -> load 0x4010f000, len 3460, room 16 
18:12:18.356 -> tail 4
18:12:18.356 -> chksum 0xcc
18:12:18.356 -> load 0x3fff20b8, len 40, room 4 
18:12:18.356 -> tail 4
18:12:18.356 -> chksum 0xc9
18:12:18.356 -> csum 0xc9
18:12:18.356 -> v0004d060
18:12:18.356 -> ~ld
18:12:18.419 -> Address:0
18:12:18.419 -> RadioLib initialization failed, code -12
18:12:21.615 -> 

Also in docs it saids

define USE_SX126X

Enable this if using the SX126x series of LoRa chips.

but in example

// LoRa Configuration

define RADIOLIB_MODULE SX1276

timmbogner commented 1 year ago

If you changed it to #define RADIOLIB_MODULE SX1262 then you would need to set #define USE_SX126X <-- EDITED TO FIX

This is a configuration that worked with the SX1278 and a WeMos module the other day. I can recreate it again but I'm a bit busy for the next couple days.

#define LORA_FREQUENCY 433.0
#define RADIOLIB_MODULE SX1278  // ESP8266 SX1278
#define LORA_SS    15
#define LORA_RST   4
#define LORA_DIO   5
Stips5 commented 1 year ago

Yes, adding #define USE_SX1278 worked, as it doesnt crash, now I'll test traffic, so now it works with

#define USE_SX1278
#define LORA_FREQUENCY 433.0
#define RADIOLIB_MODULE SX1278  // ESP8266 SX1278

I'am heading to test freeze.

Stips5 commented 1 year ago

After switching to newest version it works like a charm, stress tested it for 12h, no problems so far, thanks mate :)

timmbogner commented 1 year ago

Excellent!

By the way, USE_SX1278 isn't actually needed. USE_SX126X is the only version of that option, if that's not set then the system will default to using SX127x methods.