Pages: [1]   Go Down
Author Topic: "no hang" bootloader hack  (Read 778 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 239
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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();
      }

Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 239
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: