-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hi,
I am updating firmware from wireless so I download file in sd card and change eeprom byte and doing watchdog set as per example.
wdt_enable(WDTO_500MS); // have the wdt reset the chip
// if 500ms passes without a reset
Serial.println("rebooting and flashing with firmware.bin on sdcard");
EEPROM.write(0xFA2, 0xF0); //changed firmware location in both main and bootloader
wdt_reset();
delay(600);
My issue is that after reset using watchdog timer it starts the main app again and not able to update firmware from sd card. it starts the main app because of the below condition in bootloader code stk500boot.c
https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560/blob/master/hardware/microbridge/avr/bootloaders/microbridge/stk500boot.c#L591
// check if WDT generated the reset, if so, go straight to app
if (mcuStatusReg & _BV(WDRF))
{
app_start();
}
Is there any way to restart micro without watchdog or Is it safe to remove the above condition from the bootloader?
I am using atmega2560, 3.3V, and 8Mhz atmega revision.
Thank you,
Jignesh