Custom Mega2560 PCB – USB detected but no successful programming, ATmega2560 not executing code

Hello,

I designed a custom PCB inspired by the Arduino Mega 2560 Rev3. I am facing an issue where the ATmega2560 does not appear to execute any code, and USB uploads via bootloader always fail.

Full EasyEDA schematic is attached.

I will describe the situation chronologically and list all tests performed.


Hardware

Custom PCB based on:

  • ATmega2560-16AU
  • ATmega16U2-MU (USB–Serial interface)
  • 16 MHz crystal on both MCUs
  • Design inspired by Arduino Mega 2560 Rev3

USB-C connector with ESD protection.
5V copper plane used for VCC.

ATmega2560 clock configuration:

  • 16 MHz crystal
  • 1M resistor in parallel
  • No external load capacitors on XTAL1 / XTAL2

USB Section (ATmega16U2)

Initially, when plugging the board into USB, nothing appeared in Device Manager.

After investigation, I found that the USB D+ series resistor (R_USB_DP1) was populated with 1 kΩ instead of approximately 22 Ω.

After removing the 1 kΩ resistor and bridging the pads:

  • The ATmega16U2 appeared in DFU mode
  • I flashed the official firmware:
    Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex
  • The board is now correctly detected as Arduino Mega 2560
  • A stable COM port appears in Windows

Conclusion:
The ATmega16U2 and USB interface now appear to be functioning correctly.


ATmega2560 – ISP Programming

Using USBasp:

Initially:

  • “Target does not answer”

Programming only works when the “Slow SCK” jumper is enabled.

With Slow SCK enabled:

  • Burn Bootloader succeeds
  • Upload Using Programmer succeeds

However:

There is no visible evidence that the flashed program is actually executed.

Important detail:
ISP does not work at normal speed, only with Slow SCK enabled.


USB Upload

Using Arduino IDE:

Board: Arduino Mega or Mega 2560
Processor: ATmega2560

Upload via USB consistently fails with errors such as:

  • stk500v2_getsync() failed
  • timeout communicating with programmer
  • avrdude timed out
  • sometimes “port disappeared”

Pressing RESET does not cause visible USB re-enumeration.

Conclusion:
Bootloader upload via USB does not work.


Code Execution Test

To verify whether the ATmega2560 is running code, I flashed this minimal sketch using USBasp:

void setup() {
pinMode(44, OUTPUT);
}

void loop() {
digitalWrite(44, HIGH);
delay(1000);
digitalWrite(44, LOW);
delay(1000);
}

Result:

  • No observable output activity
  • No visible change on pins 44–47
  • No indication that the MCU is executing the program

However:

The MOSFET/backlight output stage works when the gate is manually forced to +5V, confirming the output hardware itself is functional.

This suggests the ATmega2560 can be programmed in ISP (Slow SCK), but does not appear to execute code.


Observations

  • ISP only works with Slow SCK
  • USB bootloader upload always fails
  • No user code appears to execute
  • No crystal load capacitors are present on the ATmega2560

What would you check next in this situation?

Thank you.


Hmm.

That issue was already identified and corrected.

Originally R_USB_DP1 was populated as 1k instead of ~22Ω.
I removed the 1k resistor and bridged the pads.

After that correction:

  • The ATmega16U2 appeared in DFU mode
  • I flashed the official Arduino usbserial firmware
  • The board is now detected correctly as Arduino Mega 2560
  • A stable COM port appears

So the USB D+ resistor issue has already been resolved.
The current problem concerns the ATmega2560 not executing code.

Do you find something else ?

How was it identified if it was corrected?