Strange problem with custom arduino mega 2560

Hello everyone, I have strange problem
I'm working on my engineering project which uses an atmega2560. The hardware is ready and i have checked it for short and open connection, everything is fine.
Now the problem is that I'm able to burn bootloader, the Arduino IDE prompts verified but when i try to upload blink through USBasp or Arduino uno the the sketch is uploaded but it wont run i.e the pin does not toggle
have i missed anything ?

Thing i have checked:

  1. The voltage is fine
  2. The device signature is OK (checked it with AVR dude).
  3. The connection is fine

Maybe your sketch is incorrect. Post it so we can see.
Post your schematic also.

Thank you for your input

the code is

void setup() {
  pinMode(4, OUTPUT);

void loop() {
  digitalWrite(4, HIGH);
  digitalWrite(4, LOW);

P.S. I had disabled the ground fill while taking the snapshot, the Led resistance is connected to ground and was tested before soldering the micro controller.

The LED which i am trying to blink

the entire schematics.

P.S there was a problem with multiple attachments.

The schematic & code looks fine to me. Had to look up the Mega schematic to check that PG5 is D4.
Several of the pads look like they are connected to each other as one large pad - did they actually turn out that way?
I would have brought out RX0/TX0 to a header to aid in code debugging.

Any chance the LED is installed backwards?

Yup have to refer the pin map every single time :frowning: and those are vias for top copper and bottom copper ground plane. The RX0/TX0 was something that i forgot to implement and it struck me later when the entire PCB was developed (BLUNDER :zipper_mouth_face: )
The LED is oriented correctly. Have tried with other open pins to see whether they toggle but no success :frowning:

Can we rule out the ESD and clock problem knowing that we are able to read the device signature and program it ??