Go Down

Topic: Running Arduino Micro 24/7 (Read 2 times) previous topic - next topic

retrolefty


It's a well-known problem with some versions of the bootloader on the Arduino Mega.

Installing a corrected bootloader will fix it.

Your technique (of holding down reset) stops the sketch from loading after a power-off, so the problem WDT is not activated.


Well he stated using an arduino micro board, which like the leonardo board uses a 32U4 chip, so I don't think his problem is based on the old 'doesn't handle WDT interrupts correctly' problem. I would think all the 32U4 based arduino products handle WDT correctly? And I would not think there are upgraded bootloaders avalible for this chip series anyway?

This sounds more like a problem the very first UNO boards had that if loaded with a sketch that started sending serial data immediatly effected the 8U2 USB serial chip from responding to the bootloader correctly, or something like that? It was fixed with a firmware upgrade to the 8U2, but I recall a work around was holding in the reset button, plug the board in and only release the reset when the upload started?

Lefty

Nick Gammon


I would think all the 32U4 based arduino products handle WDT correctly?


Well the empirical evidence appears to be against that hope.

retrolefty

#12
Jan 28, 2013, 03:37 am Last Edit: Jan 28, 2013, 03:41 am by retrolefty Reason: 1


I would think all the 32U4 based arduino products handle WDT correctly?


Well the empirical evidence appears to be against that hope.


If anyone wants to try and knows how to reburn the bootloader in case the test results come out positive (or is that negative, I always seem to get that wrong  ;) ), below is a sketch that will 'brick' any bootloader that doesn't disable the WDT upon entry to the bootloader. Bricked both my mega1280 boards until I upgraded them to a optiboot.

Code: [Select]

// Test sketch to see if WDT interrupts are handled properly by the bootloader

/*
Warning Warning Warning this is a semi-destructive test in that
if your bootloader does not reset WDT interrupts upon starting
it will be forced into a tight loop of bootloader starts/WDT resets
chip/bootloader starts again/lather rinse repeat. One can only
recover to normal operation by reburning the bootloader with
a ICSP programmer. If this sketch runs properly on a chip with a WDT aware bootloader,
you will see continous serial output on the serial monitor.

Note that current arduino mega boards will fail this test and brick

*/

// Code from arduino forum poster (sorry name not remembered) 1/11/13

#include <avr/wdt.h>

void setup(){
 Serial.begin(57600);
 delay(100);
 Serial.println("Hello world");
 wdt_enable(WDTO_15MS);
}

void loop(){
 Serial.println("I am going to not get stuck..");
 for(int x=0; x<100; x++) {
   wdt_reset();
   x++;
   delay(10);
 }
 wdt_reset();
 Serial.println("I am going to get stuck now..");
 for(int x=0; 1; x++) {
   delay(10);
 }
}



Nick Gammon

Well I just happened to have an Arduino Micro to hand (recently received) so I tried your torture test.

It worked (the WDT did its stuff) and afterwards I could upload a new sketch.

Although ... this is strange. After powering it off and on again, even with the ASCII table sketch loaded (and nothing to do with watchdogs) the sketch didn't run. I could upload it again, and it would run, but it wouldn't run the existing one from power-off.

Nick Gammon

Yes, it seems really flaky.

I can upload new sketches, and after opening the serial monitor it runs them ... the first time.

Go Up