Pages: [1]   Go Down
Author Topic: Removable bootloader delay  (Read 1093 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wonder if the startup delay could be made  zero maybe by looking at a pin on startup or how long the reset button is held. I guess the mode would have to stored in a byte of eeprom for subsequent power ups. Wouldn't this pretty much allow the boot loader to be used always instead of a programmer to load code. I am using a mini with about 10sec delay.
 For the next version could the prefs include  a font menu. The current font is very unfriendly for the eyeballs.
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What? :-/
Logged

CT, USA
Offline Offline
Sr. Member
****
Karma: 3
Posts: 446
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The latest bootloader already does not have a significant delay, and I guess the only way to totally eliminate such delay is to go barebone and not use bootloader at all smiley
Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Like Senso, I am not sure that I have understood leofls.

But, it is feasible to have the bootloader look for something to shorten the bootloader delay. My question is what?

If it is EEPROM, then existing programs which use EEPROM might break.
It can't be the Reset button as that is a physical piece of hardware that forces the microcontroller to reset and not run any code.
If it were a different button, then an I/O pin would be lost (and I run out of pins already).

So, leolfs, if you want a shorter bootloader delay, you could blow a new bootloader into your chip, and that would work. I believe Ladyada has a quick-boot bootloader, so you could start there.

But I can't think of any other hardware way you could do it without changing the board design, is a way which some folks (including me) might regard as a dis-improvement.

You might try to change the bootloader, so that it has a short delay, and maybe change avrdude (the upload program) so that it can force a reset back into the bootloader? All this stuff is Open Source, so you could do it.

[edit]What is the use case you are looking to fix?[/edit]

HTH
GB
« Last Edit: April 08, 2010, 09:38:57 pm by gbulmer » Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 5557
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you change the bootloader to look for some kind of header or footer byte sequence in the hex file (that could be appended or pre-pended to the file in the build process)? Unless I misunderstand where this delay occurs...
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Could you change the bootloader to look for some kind of header or footer byte sequence in the hex file (that could be appended or pre-pended to the file in the build process)? Unless I misunderstand where this delay occurs...

No, the delay is well before that. It's to see if there is any valid activity on the serial receive line at all right after a power-up or reset. If there is and it's a proper signal, then the bootloader stays active servicing valid commands from AVRDUDE via the IDE connection. If there is no serial data activity after the delay period times out, then the bootloader jumps to the existing sketch already resident in memory.

I've noticed that lots of development boards use a simple switch or removable jumper to activate the bootloader or not on power-up or reset. While it does take up a digital input pin, it does eliminate a delay on programs starting.

Lefty
« Last Edit: April 09, 2010, 12:14:54 am by retrolefty » Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
lots of development boards use a simple switch or removable jumper to activate the bootloader or not on power-up or reset. While it does take up a digital input pin, it does eliminate a delay on programs starting.

I'd really rather not use a pin, for the following reasons:
1. I have two project which use 18 I/O's  smiley
2. There are very few choices of pin which aren't a disaster.
Shouldn't be:
- pin 0 or 1, USB to serial connection
- SPI as they are used to blow firmware (pins 10, 11, 12, 13)
- ADC as they are too precious (and two are I2C)
- PWM as they are too precious, (3, 5, 6, 9, 10, 11)
- digital pin 8 on Timer1 (16 bit), that is timed input capture
- pin 2 (or 3) change-pin direct interrupts (their own ISR's)
- pin 6 & 7 are the analogue comparator pins AIN0 & AIN1
- pin 4 is PD4 XCK (USART External Clock I/O, i.e. uSrt)) & T0
(that's all of them, I think)
Losing these pin uses would reduce the value to me as a prototyping and physical computing platform - Arduino is so flexible its wonderful.
3. All the pins go to shields which may use any pin permutation, so someone needs to worry about them

The biggest obstacle for me, is I haven't understood the Use Case. Without a clear need, I'd be worried to make any changes to a part of the interface that is so concrete and physical.

So, I'd like to understand the need.

A simple solution does exist; program the flash with a different bootloader. Ladyada does that, and it seems a robust, simple solution.

To facilitate that, I'd prefer to have the unused pins on the FTDI (USB to serial) wired up to a more convenient header so that it can be used in "bit-banging" mode to reprogram the Arduino, then folks who want a different bootloader can flash a new bootloader with minimal extra cost.

I'd like the unused FTDI header pins to have ground and +V in an 2x3 arrangement so a simple 6-pin to 6pin header is all that is needed to reprogram the board. It will cost a redesign of the PCB, but I think at least one attempt already exists by Solarbotics. (My only reservation is the pin layout is not a 2x3 match to ICSP header for an easy cable connection)
[edit]I did say I'd like the FTDI header to not need to be cleared of solder but I think that doesn't matter, and it protects the pads, and is probably easy to do, so cover them in solder![/edit]

That might satisfy use cases of people who want to reprogram the bootloader, or the whole board, without extra cost, or external hardware. It doesn't change the Arduino's more significant (IMHO) physical interface.
(It would satisfy my use case in that area when the functionality is in avrdude and the Arduino IDE smiley)

HTH
GB
« Last Edit: April 09, 2010, 06:23:36 am by gbulmer » Logged

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

leofs PMed me about my toastedBoot bootloader http://code.google.com/p/toastedboot/ which is basically adaboot++.  I mostly put it up on google code because there was no other home for modded bootloaders -- they were just zip files on people's web sites, which made it hard to find the "latest".  

One adaboot feature is that it goes direct to the sketch on powerup and only waits listening to the serial on reset.  That seemed to satisfy him which may be why we haven't heard anything more.

BTW, features I added to adaboot are:

1.  if you double click the reset button, it waits a LOOONG time for a serial.  This is very useful when your board is far away from the computer and you don't have the auto-reset feature (i.e. using a FTDI cable).  Originally, I had it set up the opposite -- it would wait a long time by default, a double click would drop direct to the sketch.  Unfortunately, the auto-reset feature of the standard Arduino actually resets the board more than once so I swapped it so toastedBoot would work on boards that support autoreset.  But if you are using a clone you may prefer this other double-click behavior.

2.  The pin 13 led fades in and out while the board is waiting for a sketch.  This way you know it hasn't hung somewhere.

3.  Code crunching -- I reworked the code a lot to make it smaller so that new features could be added in the same flash space.



On a slightly different topic:  

I think that it would be possible to write a sketch that updated the bootloader.  I mean why not?  Its just writing to flash.  The problem with this idea is that if the sketch was interrupted mid-write your board would be bricked -- you'd have to buy a $20 ICSP to recover it.  So maybe its not worth the support calls it would generate.  What do you think?

Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1.  if you double click the reset button, it waits a LOOONG time for a serial.
That's an interesting idea, how does it work? What survives a reset?

Quote
I think that it would be possible to write a sketch that updated the bootloader.  I mean why not?  Its just writing to flash.  The problem with this idea is that if the sketch was interrupted mid-write your board would be bricked -- you'd have to buy a $20 ICSP to recover it.  So maybe its not worth the support calls it would generate.  What do you think?
A few things:
0. I think all techniques that reflash the bootloader brick the chip if the power fails at a bad point in time.
1. Could you reduce the period of time when the system is vulnerable to power failure by downloading the bootloader (e.g. into RAM/EEPROM), and then blowing as quickly as practical from an on-chip copy?

A sketch to update the bootloader might be useful for leolfs use case (but I didn't understand it, so I may be wrong).

My favourite approach to flashing a chip is the FTDI bit-banging programmer "Burning the Bootloader without external AVR-Writer" which shows a technique for using the unused FTDI pins to program the ATmega.

If boards implemented that in an easy-to-connect way, and avrdude and the Arduino IDE supported it, then it would always be practical to recover a bricked-chip for minimal cost (a cable).

I assume we'll get Arduino/Freeduino boards like the Freeduino SB which implement an AVR programmer using only the FTDI chip. It makes perfect sense. Then reprogramming the bootloder may become a more natural activity.

A reflash-the-bootloader-sketch might be useful and good fun while we wait for everyone to make boards that way.

If your bootloader is very small, can you also include an ICSP programmer in the bootloader, so that one Arduino can program another? (like MegaISP and ArduinoISP but in the bootloader)

Then all anyone needs to bootstrap a new AVR-based board (including an Arduino) is an Arduino  smiley-wink

GB
« Last Edit: April 14, 2010, 10:56:26 am by gbulmer » Logged

Pages: [1]   Go Up
Jump to: