Arduino Mega 2560 R3 - only started after 10 seconds if powered by USB

There seem a few threads about this topic, but most of them seem to have a dead end.

I have an Arduino Mega 2560 R3 (manufacturer: GWS).

  • If I power up through USB, then it seems that it takes 10 seconds before the device is started.
  • If I power up through an external PSU, then it starts almost instantly.

It has nothing to do with the PC or its USB port, because I tested it on 4 different PC brands. They all give the same result.

The code I used is as simple as this:

void setup() {

  • pinMode(LED_BUILTIN, OUTPUT);*
  • // Show that I am alive*
  • digitalWrite(LED_BUILTIN, HIGH);*
    }

void loop()
{
}

I would expect the LED_BUILTIN to light up immediately. This is the case if I power through external PSU. But if I power through USB, the LED_BUILTIN only lights up after about 10 seconds.

I have ordered a second Arduino Mega R3 via this Arduino website now (a real one :)). I'm curious if the same issue will be seen.

Anybody an idea how to avoid this?

Just some additional info.

If I start the Arduino Mega 2560 R3 with USB power, and then immediately program via USB using the IDE, then it seems to program it immediately without delay.

I have no clue why this is kind of “waking up” the device immediately.

Code snippits don’t give clues either.

Paul

How do you mean? The code I loaded is the most simple code you ever can have. If the LED is not on immediately.... what else could be wrong?

Very strange , I have a genuine Mega and it’s starts just the same on usb or with power .
I would be tempted to reload the bootloader in case there is an issue there ??

I never have reloaded a bootloader. Any idea where I can find how to do this?

In any case, I will wait until I receive my “real” Arduino Mega 2560 I ordered today. Will check first if it is happening also there. If it is, then I doubt it is the bootloader. If it is not, then I will execute your suggestion.

There are lots of guides to boot loading - google will find them

Have you used the same Usb cable in those tests on the other PCs? Could it be the cable?

Yes, same cable. It’s also seems to be exactly the same delay each time. If it would be a bad cable, then I would expect more random results.

And the more I think of it - seeing that there are a few reports of this issue on internet, I almost can’t believe it would be a corrupted bootloader. It would be very coincident that I have the exact same corruption as other people reporting it.

My new Arduino Mega R3 board just arrived. This time, it’s a “real” Arduino board. I immediately tried with this simple sketch:

void setup() {

  • pinMode(LED_BUILTIN, OUTPUT);*
  • // Show that I am alive*
    digitalWrite(LED_BUILTIN, HIGH); // In all tests, this LED only lights up after 10 seconds if powered by USB only
    }

void loop()
{
}

I have exactly the same results. If I power this using USB, then the LED only goes on after about 10 seconds. This time I even used another USB cable.

Conclusion:

  • If I power my Arduino Mega R3 through USB, it starts only after 10 seconds
  • If I power my Arduino Mega R3 via external adaptor, it starts immediately
  • This happens with 2 Arduino’s (brand Arduino and brand GWS)
  • This happens with different USB cables (so it’s not related to USB cable)
  • This happens on multiple computers (so it’s not related to USB port)

@hammy: I have not reloaded the boatloader, as I don’t think it makes sense. The above sketch is the only sketch I loaded on my new Arduino, so I would be surprised that the boatloader was already corrupted. And also because I have now the same behavior on both Arduino’s - chances that both boatloaders have the same corruption is almost non-existing. But thanks anyway for your valuable suggestion!

Am I really the only person that discovered this strange behavior???

A further test!
Do you have access to a powered USB hub? If so, use it, and not connected to a PC, to power you Mega. Results?

Paul

Good idea! I have some powered USB modules that I'm using to load smartphones. I just connected both Arduino's to it, and the LED lights up immediately!

Would that mean that the power of a normal USB port is not sufficient? Although, the power LED ("ON") always lights up immediately, it's only LED_BUILTIN in my sketch above that is lighting up after 10 seconds. Because the power LED is on immediately, I would assume that power is sufficient? And even if the power is not sufficient, shouldn't then my Arduino not start at all? Why is it starting after 10 seconds?

hansbilliet:
Good idea! I have some powered USB modules that I'm using to load smartphones. I just connected both Arduino's to it, and the LED lights up immediately!

Would that mean that the power of a normal USB port is not sufficient? Although, the power LED ("ON") always lights up immediately, it's only LED_BUILTIN in my sketch above that is lighting up after 10 seconds. Because the power LED is on immediately, I would assume that power is sufficient? And even if the power is not sufficient, shouldn't then my Arduino not start at all? Why is it starting after 10 seconds?

It means the USB control in your PC does not turn on the power until it has a chance to determine what is connected, using the data lines.
Paul

@Paul_KD7HB - why is the Power ON LED then lighted up immediately?

Other test is to use a cell phone charger to power the Mega.

I suspect ( but not sure ) that the driver asserts the DTR so the boot loader kicks in and that causes the delay.

Good idea! I have some powered USB modules that I'm using to load smartphones. I just connected both Arduino's to it, and the LED lights up immediately!

As you can see above, I already tried this. These powered USB modules are just an array of USB ports to charge devices. I guess that this is what you mean? This is indeed not showing a delay.

Be aware that the other computers I have used did not have the Arduino IDE, nor any specific driver for Arduino, installed.

Can you explain a bit more what you mean with the fact that DTR kicks the bootloader?

During an upload, the IDE asserts the DTR line to force a reset of the Mega.

I don't know how the driver works but the thinking was that it might do the same.

@sterretje - This would have made sense if I only tested on a computer that has the IDE and eventual Arduino specific drivers installed. But I connected it to the USB of several other computers that has nothing installed related to Arduino, and they all seem to show that same behavior.

  • If I connect it to a computer USB, the Arduino waits 10 seconds to start
  • If I connect to a non-intelligent powered USB (charger), the Arduino starts immediately

Understand the USB data is just that and only that. DTR high or low is just a message from the computer, not the actual electrical signal.
OR it could be just a standard signal of some type that is ALWAYS sent upon USB connection and is interpreted by the Arduino as a command to simulate DTR.

Paul

Ok, but let's bring this back to my original question. Because so far, nobody could tell me for sure what is going on.

Isn't there an Arduino helpdesk available to ask this question?

Bottomline is:

  • If I connect it to a computer USB, the Arduino waits 10 seconds to start
  • If I connect to a non-intelligent powered USB (charger), the Arduino starts immediately