Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main app start on watchdog reset during update firmware #16

Open
jigneshpatel47 opened this issue Apr 6, 2021 · 1 comment
Open

Main app start on watchdog reset during update firmware #16

jigneshpatel47 opened this issue Apr 6, 2021 · 1 comment

Comments

@jigneshpatel47
Copy link

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

@jigneshpatel47 jigneshpatel47 changed the title Main app start after chaning EEprom byte Main app start on watchdog reset during update firmware Apr 6, 2021
@dheerajluffy
Copy link

hi is it solved? facing similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants