Go Down

Topic: "no hang" bootloader hack (Read 810 times) previous topic - next topic

ladyada

this hack will keep the Arduino from starting to bootload at the wrong times, a possible issue when using Diecimilas with Processing/MaxMSP, etc.

simply send any character (or string) that doesn't start with the number zero (ASCII hex 0x30) and it will go straight to the app


Add the following lines


/* main program starts here */
int main(void)
{
   uint8_t ch,ch2;
   uint16_t w;
   uint8_t firstchar = 0;
     
     .....
     
     /* Hello is anyone home ? */
     if(ch=='0') {
       firstchar = 1; // we got an appropriate bootloader instruction
       nothing_response();
     } else if (firstchar == 0) {
       // the first character we got is not '0', lets bail!
       app_start();
     }


mellis

Hmm... that's a great idea.  I think you should be able to do something similar without modifying the bootloader.  If you send, say, "ZZZZZ" or some other sequence of five invalid characters, I think the bootloader will start your sketch.  I don't have a Diecimila here at the moment, or I'd try it.  Can anyone else check if this works?

ladyada

Quote
Hmm... that's a great idea.  I think you should be able to do something similar without modifying the bootloader.  If you send, say, "ZZZZZ" or some other sequence of five invalid characters, I think the bootloader will start your sketch.  I don't have a Diecimila here at the moment, or I'd try it.  Can anyone else check if this works?


yes that works too...although i'd never seen it documented anywhere!

mellis

That's because I didn't think of it until I read your post.  Thanks for sparking the idea!  It might be a reasonable work-around for some of the problems people have been having using PD / Processing with Arduino.

Go Up