USB on Arduino Mega clone not recognized if board is first powered externally

I've worked with Arduinos for many years, but never had this problem. I have an Elegoo Mega board, which is supposed to be identical to a standard Mega. I am connecting with a Mac running OS 13.

If I connect the Mega directly to USB (with a USB C-B cable), no problem. But I first power the Mega with a 12v adapter plugged into the barrel jack, the Mac does not recognize any serial port when the USB cable is connected.

If I connect with USB, then turn on the external power everything is fine.

The Mega RUNS fine with only external power connected; a complicated sketch functions perfectly. But the serial port will not show up on the computer unless the external power is first disconnected.

I've never used an Arduino with the 16u2 USB interface before, so I'm wondering if that has something to do with the problem. I see this problem even if nothing else is connected to the Mega board.

Why did you do that?
Unless you have a serious reason to do so, you should avoid connecting external power and USB at the same time. With dual power you can burn the board or damage the USB port on your laptop, especially if you are dealing with a clone

Yes it has everything to do with your problem.

A board with a 16u2 USB interface has to establish a virtual address. This means it talks to the computer via the Arduino IDE and establishes an address to use. Without connecting it to you Arduino it can't do that. Also if the code has any wait for Serial to become established code then it won't work either if only powered externally and not to the computer.

With dual power you can burn the board or damage the USB port on your laptop, especially if you are dealing with a clone

My understanding is that the voltage selector circuit disconnects USB power when VIN is above a certain threshold.

A board with a 16u2 USB interface has to establish a virtual address. This means it talks to the computer via the Arduino IDE and establishes an address to use.

So if I'm understanding, the 16u2 powers up and cannot establish a virtual address because it is not connected to a computer. It then enters a state where it will not establish an address if later connected to the computer?

That's annoying, if true. The Mega also backfeeds from USB power to VIN, so I'd rather not have the USB connected while the external supply is switched off. But it sounds like there's no easy way around it.

Correct. The onboard 5V rail can come from either Vusb or the output of the onboard 5V regulator. When Vin rises above 6.6V, a comparator turns off a FET between Vusb and the 5V rail, and the 5V regulator (fed by Vin) supplies 5V.

When powered by USB, you will get Vusb-0.65V backfed thru the non operating 5V regulator at the Vin pin - but not at the barrel connector. There's a diode between the barrel connector input and the Vin pin. So to get that 6.6V on Vin, your external supply should supply an absolute minimum of 7.3V - and higher would be better. I generally aim for 8-9V at the barrel connector.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.