i have one ESP32-POE and ESP32-POE and i'm using the Olimex RS485 module to read a power meter that is placed near the ESP32 (5 meters of CAT5 cable - 9600 8N1).
My device has this workflow (it's powered via PoE using a Cisco 2960x switch):
- Boot and acquire a DHCP address
- Connect to the server and check if there is a new ota package to download
- Read via modbus (Using ModbusMaster library) the power meter
- Prepare the data in JSON format using ArduinoJson library and send it to the broker using PubSubClient
- Wait for five minutes using Millis and start over with the loop
This is the main logic that "blocks" the loop and wait for some minutes:
void loop() {
wdt_reset();
MQTT_connect();
client_subscriber_loop(); // loop subscriber mqtt
unsigned long currentMillis = millis();
if (currentMillis - previousMillisTaskDataPublisher > MQTT_PUBLISH_EVERY) {
if (DEBUG == 1)
Serial.printf("Free internal heap on Loop Enter %u\n", ESP.getFreeHeap());
// OTA Check
trueverit_ota_check_update();
wdt_reset();
publish_data();
if (DEBUG == 1)
Serial.printf("Free internal heap on Loop Enter %u\n", ESP.getFreeHeap());
previousMillisTaskDataPublisher = currentMillis;
}
}
As you can see, i've also have Watchdog timer enabled and it is feeded in the loop or function that have to feed it (Modbus read, etc...)
Now, here comes the issues, this works exactly for 10 days and after that the MCU goes in loop, the LAN green led will flash indefinitely and nothing work, leaving the ESP32 in a undefined state.
This is the debug message that i see on arduino console:
There is no way to make it work a part of power off and power on the device.
This is extremely uncomfortable...in my case i have 25 of those devices placed far away from my office (600km) and i can't go every time to reboot them every ten days.
Maybe is hardware related issue? a software issue on ModbusMaster library?
Any toughts?
MQTT_PUBLISH_EVERY
also make the problem occur faster than 10 days. – Gerben Aug 6 '20 at 14:48There is no way to make it work a part of power off and power on the device.
does that include pressing the reset button? – Gerben Aug 6 '20 at 14:49