CheckForWirelessHEX interacting with AVR watchdog timer

Started by syrinxtech, July 03, 2015, 11:05:42 AM

syrinxtech

I ran into an interesting problem that I was hoping to see if anyone else had solved.  I added the "CheckForWirelessHEX" line in my code to allow me to do OTA upgrades.  That worked great with no problems.  Over the last two days I added a watchdog timer of 8 seconds using the "avr/wdt" library, which also works great with no problems. 

The problem I ran into was when I have the WDT set at 8 seconds and try to do an OTA code upgrade, it always fails at packet 134.  So, after a little head scratching I realized it was the WDT timing out and resetting the system.  So, my question is this.....is there a way to have both? 

If nothing else can I simply add a wdt_reset() in the "CheckForWirelessHEX" code to keep resetting the WDT timer?

Any suggestions would be appreciated.

syrinxtech

Perhaps I should have spent more time searching through these forums before I asked my question.

Felix proposed the idea of disabling the WDT before the "CheckForWirelessHEX" call and then enabling it afterwards.  I am going to try that now and see if it works.

syrinxtech

Case closed....the wdt_disable() before the call and another wdt_enable call afterwards took care of the problem.

THANKS FELIX!