Hello, I want to implement in my sketch the automatic start of the bootloader. I have trie to use the same trick with watchdog but seems it is not working to me, at least I cannot see the led. But the reset is performed. My code:
void setup() {
Serial.begin(115200);
Serial.println("Starting...");
}
void loop() {
if (stringComplete) {
if (lowerCaseInput.startsWith("at+res")) {
wdt_enable(WDTO_15MS);
while(1);
}
}
}
So after I will send to serial port at+res I will got imediately Starting... No bootloader action. To have bootloader in action, I have to do HW reset.
Anyone has an idea why?
Robert
There's a function called resetUsingWatchdog() in the wirelesshex lib that does that, take a look there: https://github.com/LowPowerLab/WirelessProgramming/blob/master/WirelessHEX69/WirelessHEX69.cpp
Hello thanks for the answer. Yes, this I did. The function looks like:
void resetUsingWatchdog(boolean DEBUG)
{
//wdt_disable();
if (DEBUG) Serial.print("REBOOTING");
wdt_enable(WDTO_15MS);
while(1) if (DEBUG) Serial.print('.');
}
It means it is the same thing, I am using. But still the bootloader is not called, but reset is done. Strange.....
Hold on. What bootloader are you using?
Hello, I am using original motenio board (without SPI flash memory), I didnt change it, so I expect, that I have your DualOptiboot.
Ok and how do you know it doesn't enter the bootloader?
I think, that bootloader will turn on the LED e.g. and it waits around 1 second for the data before it will start the normal processing. And it will not happen, the Starting... string is printed immediately.
No, if there's nothing to do it will immediately skip the bootloader without waiting.
In your case, there's no FLASH chip and inherently no flash image to write, so it will jump to the program ASAP.