Pages: [1]   Go Down
Author Topic: Diecimilia Bootloader Help  (Read 440 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,

I'm working on getting the Arduino working as the main electronics platform for the RepRap project, and part of that is emulating our old electronics.  The problem I'm running into is that our software just opens the serial port and starts reading and writing from it.  Right now I get around that with a delay() in the host software, but its not practical long term.

I remember reading somewhere that you can send a command that will tell the bootloader to skip bootloading and start program execution, anyone know what it is?
Logged

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

hey zach.. i hacked this up a bit ago, it just looks if the first character is '0'
http://www.ladyada.net/library/arduino/bootloader.html
you may want to modify it a bit
Logged

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

thanks ladyada.  unfortunately other people are going to use this and I cant tell all of them to run custom firmware.

however, i did find a decent workaround by looking through the bootloader code.  if you send a string of 10 '0' (ascii zero) characters, then it bails and boots as normal.  still takes about 2 seconds though.
Logged

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

Hmm... the bootloader code is supposed to quit if it gets five characters that aren't part of the normal protocol (e.g. "XXXXX" or "ZZZZZ").  Have you tried that?  Honestly, I think waiting a couple of seconds might be the best bet.  I'm going to try to do some work on the bootloader and see about incorporating ladyada's changes or other options for dealing with the sort of situation.
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Quote
 I'm going to try to do some work on the bootloader and see about incorporating ladyada's changes or other options for dealing with the sort of situation.

As a suggestion :
What about losing a pin on the Arduino in favor of direct startup.
I don't know how other people see this, but I would have no problem losing one of the analog inputs.
Basic idea: If that input is pulled to ground on startup the bootloader skips waiting for an upload and starts the current sketch immediatly. If the pin is pulled to Vcc the bootloader expects an upload so it waits for 10 seconds as usual.  
Eberhard
Logged

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

We've talked about that before, but the consensus always seemed to be that people didn't want to give up a pin.  The analog inputs can be used as general purpose i/o as well, so it's not much better to use one of those.  Also, it doesn't help too much, since even with the pin in "bootloader enabled" mode, we'd still want it to do a good job of starting your sketches - otherwise you'd need to be constantly changing a jumper setting.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm going to try to do some work on the bootloader and see about incorporating ladyada's changes or other options for dealing with the sort of situation.

Related to this, how would you feel about patching the bootloader to accept signature reading over the universal SPI programming command?
This would enable people to use Arduino boards with the default avr tools without having to supply the -F switch (which is a bit annoying and might trigger an unexpected error someday).

I'm using the following patch, which works for me:

Code:
Index: ATmegaBOOT_168.c
===================================================================
--- ATmegaBOOT_168.c      (revision 379)
+++ ATmegaBOOT_168.c      (working copy)
@@ -466,8 +466,21 @@
 
       /* Universal SPI programming command, disabled.  Would be used for fuses and lock bits.  */
       else if(ch=='V') {
-          getNch(4);
-          byte_response(0x00);
+          ch = getch();
+          getch();
+          ch2 = getch() & 3;
+          getch();
+          if(ch == 0x30){      /* read signature */
+            ch = SIG3;
+            if(ch2 == 0){
+              ch = SIG1;
+            }else if(ch2 == 1){
+              ch = SIG2;
+            }
+          }else{
+            ch = 0;
+          }
+          byte_response(ch);
       }

Logged

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

Not a bad idea if we're making changes anyway, although we have the problem of the bootloaders that are already out there.  I keep meaning to submit a patch to avrdude to use the dedicated device signature command instead of universal spi.
Logged

Pages: [1]   Go Up
Jump to: