Skip to content

Main app start on watchdog reset during update firmware #16

@jigneshpatel47

Description

@jigneshpatel47

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions