September 2019 Update

New! We're moving to the new forum, eventually it will replace this blog. Please join us there.

View the Most Recent Feature Sheet by clicking HERE!

Saturday, August 31, 2019

Endless reboots :(

Posted: 1:45am

Since re-installing windows 10 on my development machine, when I compile and upload my code to an ESP8266 sends it into an endless loop of rebooting. 

I do have a full backup if it comes to that, but the whole idea was to start fresh, so I'd rather make this work. I suspect I may have picked up a new version of some library which I need to make a change for, or perhaps I made a change to my copy of the library and now that it was re-installed, my changes were lost. I have been known to change code in libraries early on, but I learned my lesson, only do it if absolutely necessary, and DOCUMENT the changes!  

Here is my plan of attack, I have two programs, one for the Mega 2560, and one for the ESP8266 (actually all my boards) which are just blank sketches. They do the absolute bare minimum, and I use them when I am finished with a board and put it back, just so I can start clean every time. I also use them in times like this.  I have installed the blank firmware on both the 2560 and the 8266, and at this point, it is stable, not rebooting, and I can do OTA updates on the 8266.

This tells me that the problem is not in the compiler or core libraries, it is either in my code, or in one of the libraries I'm using. The next step will be to comment out everything in setup() and loop() that is not needed, so they will resemble the blank versions when compiled. If they run, then I simply start uncommenting sections until it fails, and that gives me somewhere to look for the problem.


Update: 8:30am

Well, I didn't make a lot of progress overnight, I got sidetracked with a ton of other tasks. I did manage to install the new sensor module firmware with everything commented out, so it was basically the same as my blank firmware, and it ran without issue, so that's one positive step. I enabled the moduleCfg read, and it still ran without issue, but as soon as I enabled the send to the 2560, it started giving me random (seemingly) watchdog timeouts and rebooting.  This is where I got sidetracked, and haven't made any further progress.

I did however find a bug in my method which waits for an acknowledgement when it sends data from the 8266 to the 2560. I  recently added a database close after every use to fix another problem, and the way this method was written, I put it in the wrong place, and if the data was not acknowledged on the first "wait cycle" (it will try 5 times to read an acknowledgement, with a timeout in between) then the database was closed, and never reopened during the cycles, this was causing the initial reboots. I was adding serial prints to the code so I could follow it as it executed, and this is when I saw the mistake.

So right now, it still throws intermittent wdt reboots, and I feel like a complete newb because I can't stop them... I know it happens when you go into a loop or process that takes longer than the timeout value, which I forget at the moment.

It's been a long night, maybe a nap will help.

No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed