September 2019 Update

New! We're moving to the new forum!

ALL new Blog posts will be on the forum.

Please join us there.

This Blog will no longer be updated...

Friday, September 13, 2019

OTA Updates timing out

Now that I've moved all the processing from the Mega 2560 to the ESP8266, the Over The Air firmware updates ate timing out a lot. I presume this is because the 8266 is busy communicating with the 2560 and doing database reads and writes.  Sometimes it can take 5 or 6 tries :(

The unit I'm using for development no longer has the usb connector on it (see previous blog post) it was the switch module, and I caught the cable on my foot and yanked it off the work table, and ripped the connector half off. So now to program it, I use the tx/rx pins on the 2560 (and have to co-ordinate hitting reset and upload at the same time) but without using the CH340 USB-SERIAL chip, I cannot access the ESP8266 except by WiFi using the OTA upload. The ESP's pins are available, but I haven't explored whether I need to use resistors or anything like I do with the ESP-01 boards.

So, my best solution is to keep OTA working.

The solution I came up with takes advantage of the tight coupling between the GBW Terminal software and the Modules themselves. They talk back and forth as it is, exchanging information while you are connected via the USB port. I added a button on the terminal that will pause everything except the esp8266 web server. 

Here's how it works.  Click the button, and it sends {{pauseForOTA}} to the 2560 Module over the serial connection. The 2560 then sends the command PAUSE4OTA to the 8266 and waits for an acknowledgement. It will try 10 times, then abort, and go back to normal processing. If the 8266 acknowledges the command, then the 2560 will no longer do any processing in the loop() method except for a delay(0) and echo received characters to the Terminal program. The only processing the 8266 will do is to run the web server, which will output status info to the serial port, which will be passed to the terminal by the 2560. When the update is finished, you just reboot the whole thing and it goes back to normal processing.

So far, seems to work, sometimes updates are really fast, sometimes slow, but they are much more reliable now.

No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed