0

I am wondering why after pressing the reset button on my Arduino, the latest program loaded runs but only after about 5seconds. The same thing happen when I run my arduino from the computer using the Arduino 1.6.9 software.

Is there any way to make this delay shorter?

Thanks, IF

  • 3
    (1) Might “about 5 seconds” be only a second or two? That is, did you measure the delay with a timepiece, or just estimate it offhand? (2) If this occurs with only one sketch, please edit your question to include a Minimal, Complete, and Verifiable copy of the sketch, so we can identify the programming error that is causing the problem. (3) If it happens with several different unrelated sketches, please edit your question to include a list of them. – James Waldby - jwpat7 Jul 5 '17 at 5:37
  • A few seconds sounds like normal and I don't think you can reduce the time. If you explain why you want it to be quicker it might be possible for someone to suggest a much quicker alterative. – Code Gorilla Jul 5 '17 at 7:24
  • 2
    The bootloader has to run for a few seconds before your sketch does. If you don't want that then delete the bootloader and use a hardware programmer. – Majenko Jul 5 '17 at 8:50
3

The first thing that happens when you apply power to a board or press reset, is the bootloader executes. That waits for a short time to accept a new sketch over the serial port. If nothing arrives it terminates and executes the existing sketch.

On the Uno that delay is only 2 seconds. However on the Leonardo the delay is much longer (around 5-8 seconds) owing to how the serial port is implemented: it has to allow time for the host computer to re-enumerate the USB device after a reset, and that takes a second or two.

If you don't want that delay you will need to remove the bootloader (i.e., ignore it) and program the board through a hardware programmer and the ICSP pins (which will disable the bootloader for you). You lose the convenience of programming through the USB connection though.

Alternatively choose a different board that doesn't have such a delay for the bootloader - one that uses a different programming method.

0

Having had the same issue , I recently found out that the Leonardo/Micro jumps directly into the user application when it is powered up, either by inserting a USB cable connected to a cellphone charger i.e power only USB , or by connecting external power via the RAW power input. So, if you need a quick restart after reset, just cut and reconnect the power supply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.