I need to make my program run immediately on a reset or power up. However, the bootloader delays program startup by around 2.5 seconds. How can I get over this? Is there a way to turn off the bootloader wait period?
-
1Not the easiest solution, but I've modified the bootloader on a Trinket, to have it wait only if the board was reset, and not on regulator power on. Something similar can be done for the Mega. That way you can still use serial to program the board, unlike Majenko's solution.– GerbenCommented Oct 15, 2015 at 12:59
-
@Gerben: +1 - this is worth making into an answer.– JRobertCommented Oct 15, 2015 at 19:43
1 Answer
Yes. You remove the bootloader completely and program the Arduino using a hardware programmer.
If you could "turn off" the wait period you would never be able to get into the bootloader to program the board, so the bootloader would be completely useless. So either way you would then need a hardware programmer to do anything constructive with the board.
A hardware programmer could be another Arduino, or a real hardware programming adapter.
-
I am using a Mega 2560, so I guess I need to use another Arduino for programming the Mega via the ICSP connector. Is that right?– RajivCommented Oct 15, 2015 at 11:32
-
Yes, that's right. There's plenty of tutorials on the web of how to wire it up. It's just the same as how you install the bootloader on a blank chip, but instead you're installing your sketch. It can be done direct from the IDE if you select the right programmer and programming operation.– MajenkoCommented Oct 15, 2015 at 11:41
-
1. I used an AVRISP Mk2 programmer. 2. I selected AVRISP V2 in 'Arduino IDE 1.6.5, with Tools > Select Prorammer 3. When I select Sketch > Upload using Programmer, I get the following error... "Error while uploading: missing 'program.tool' configuration parameter" I'm using Ubuntu 14.04 with Arduino IDE 1.6.5– RajivCommented Oct 15, 2015 at 12:07
-
AVRISP is not using an Arduino as a programmer - there should be a separate entry for that.– MajenkoCommented Oct 15, 2015 at 12:13
-
OK. So I connected an Arduino Uno 1. I loaded Arduino ISP program from Examples 2. Selected Tool > Programmer > ArduinoISP 3. Then Sketch > Upload Using Programmer And I get this error: "avrdude: Error: Could not find USBtiny device (0x2341/0x49)" Yes, I've checked and rechecked - I have indeed selected ArduinoISP and not USBtiny.– RajivCommented Oct 15, 2015 at 12:19