taligentx / dscKeybusInterface

An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
GNU General Public License v3.0
497 stars 125 forks source link

esp8266 restart problems! #202

Closed javierferwolf closed 2 years ago

javierferwolf commented 3 years ago

The problem of constant restart of at least 3 times a day and sometimes up to many more times! I have tested on various PC858 panels and i always get the same problem esp89266 reboot! I have fixed the serial port error and got the following Debug Messages ets Jan 8 2013,rst cause:4, boot mode:(3,6) esp8266 wdt reset load 0x4010f000, len 1392, room 16 tail 0 chksum 0xd0 csum 0xd0 v3d128e5c ~ld

Module: [Generic ESP8266 Module|Nodemcu] Development Env: [Arduino IDE 1.8.13] Core Version: [2.7.4] and tested too 2.6.3

I use the example of telegram!

I have tried different power supplies and esp8266 modules nodemcu! and i get the same problem! please is there any solution or someone has the same problem?

thank you!

kricon commented 3 years ago

I did a bit of google search on that (watchdog reset), and found few possible causes. I must note that I haven't yet tried Telegram sketch. Have you tried other examples, does same thing happens on them?

It could be power-supply related, implying that wiring is good (soldered, no breadboard/dupoint wires and powersupply close to nodemcu). Voltage fluctuation, some recommends adding 47mF capacitors on en/rst/vcc pins to gnd Have you tried powering NodeMCU just from USB? Does same thing happen when powered from 3v3 or 5V from seperate power supply, what are you using as a voltage supply?

It could also be Code-related, have you done any code modifications, or changing pins? You can try to Erase all flash content and reupload the sketch - it fixed issue to someone. Verified that you're using correct library resources and correct example (from esp8266 folder). Someone stated it could be a bad ESP8266 module, but you said you tried on few different ones...Does ESP8266 get hot?

Hope it helps as thats all I can think of, maybe other can help you more.

javierferwolf commented 3 years ago

thank you @kricon for your answer! I will take into account the recommendation of the 47mF capacitors on rst/vcc pins to gnd!

I have tried power supplies of all kinds from 5v adapters and from the USB computer! even the current dividers of the 10 and 15kohms resistors that connect to the green and yellow of the panel, I have replaced it with optocouplers but the problem keeps happening. The telegram sketch that is in the example of this library I have not changed anything I just copied and pasted but I have not changed any pin.

I have used 5 modules esp8266! 2 nodemcu and 3 only esp12-E but in all the problem happens I have even tried with different PC585 panels. Esp8266 modules do not heat up!

kricon commented 3 years ago

I forgot capacitor on EN pin. Value isn't critical, it can be anywhere 47mF-100mF. Current dividers on ESPs should be 33k and 10k, 15k/10k are for Arduinos which run on 5V. PC585 is older series with linear voltage regulation, and it keybus operates at about 13.6V while newer pc1616/1832/1864 operates at slightly a lower voltage. You must drop that voltage to ESP8266-safe voltage of about 3.3V. Using 15k/10k resistors, singal voltages on PC585 can go up to 5.5V high and can burn ESP8266 or it can cause issue like you're having to self-restart. You can try to run some other example, like Status or KeybusReader for a day and see if it also causes ESP8266 to restart. BTW: just curious, which optocoupler did you use? There has been few folks around which tried to use optocouplers and it didn't work for them with this project.

Dilbert66 commented 3 years ago

In my experience with esp8266's one of the main culprits for hardware WDT reboots have usually been ISR routines taking too long to run. The ESP is very sensitive to timing due to it's other background processes with WIFI connections. I have not seen this with this library but have seen it in other code. It's possible the telegram example you mentioned using needs some optimizing to keep the WDT timers fed regularly.

Edit: I had a quick look at the telegram example and it looks fine. From this cursory look, nothing stands out as a possible cause. The only thing that perhaps could be an issue is the telegrambot.sendmessage function which uses an external library. If this takes too long to run, that might also be something to look into.

taligentx commented 3 years ago

Hi @javierferwolf - is this still an issue when testing with the other example sketches, or is it only happening with Telegram?

javierferwolf commented 3 years ago

Hi @taligentx - yes, indeed the ESP8266 continues with the reboot problem, I don't know if this is related to the instability of the internet connection. So my question, how can I monitor the internet to have a reference and rule out that the problem is the internet? apparently I have a stable connection but I don't know if it is stable enough for the ESP8266

hcoiro commented 3 years ago

HI, I had the same problem, sometimes a day the telegram sketch reboot the ESP8266. I did a modification on the sketch in order that when reseted do not send again, connection message. I check boot error reason and most of the time is reason 2 , and there were just two times that the reason was 1. So what I did is if reset reason is 2, then I did not initialize telegram sending message of connection. case REASON_DEFAULT_RST: Serial.println("Power ON!"); //0 // Normal Power up break; case REASON_WDT_RST: Serial.println("Hardware watchdog reset!"); //1 break; case REASON_EXCEPTION_RST: Serial.println("Fatal Excepcion!"); //2 break; case REASON_SOFT_WDT_RST: Serial.println("Software WDT Reset!"); //3 break; case REASON_SOFT_RESTART: Serial.println("Software Restart!"); //4 break; case REASON_DEEP_SLEEP_AWAKE: Serial.println("Wake from deep sleep!"); //5 break; case REASON_EXT_SYS_RST: Serial.println("External!"); //6 break;

javierferwolf commented 3 years ago

I have been absent for several days but finally I have had time and I have seen your message thank you @hcoiro for your answer! It is certainly a nuisance since there are days the messages sent by telegram of reboot are too many! I'm a bit of a newbie to arduino programming so I'm not sure where in the sketch I should modify or add what you mentioned. Please can you specify in which part of the sketch I should put your recommendations? thank you!