Arduino mega 2560 icsp problem

I am trying to upload the blink example sketch to my arduino mega 2560 over icsp. I am using an arduino duemilaniove as the isp programmer. When I upload the sketch I don't get any errors but the LED doesn't blink. I also had to burn the bootloader on the mega and it worked perfectly. I am using Linux and arduino ide 1.0.5 Hope someone could help me.

can you ensure you're getting the sketch really uploaded? That is - all phases are passed - fuses, upload, verification. If all ok then try to do some basic debug - eg light the led in setup before entering main loop.

The sketch is getting uploaded. I tried to light up the led in the setup but it still doesn't work. Is it possible that the memory size of the mega2560 or the case that the mega is an avr chip could be a problem for the uploading.

Under File:Preferences, click the verbose output boxes. Then expand the message part of the IDE and confirm the upload is actually completing.

You have the digitalWrite for the ledPin after the pinMode, yes?

I do have the digitalWrite after the pinMode. If I upload the sketch with file: Upload using programer I don’t get errors but the tx and rx leds on the mega do not blink while uploading. If I upload It with the usual upload button I get this error:

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

and the tx and rx leds on the mega also don’t blink while uploading

FIile:Upload Using Programmer will not flash the Rx/Tx LEDs, those are driven by the USB/Serial adapter. Upload Using Programmer requires an AVR ISP be connected to the ICSP header. The programmer takes Reset Low, accesses memory using the SCK, MOSI, MISO pins, and then releases Reset to restart the chip.

But the uploaded code still doesn't work with neither Upload using programer or whit the usual upload. This is the code I'm uploading

int led = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);   
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // 
}

// the loop routine runs over and over again forever:
void loop() {
}

But it works if I upload it over the USB port

?? If you install a bootloader, and then do a normal upload via the USB/Serial interface it works, but if you use Arduino as Programmer via the ICSP pins and File:Upload Using Programmer it doesn't work?

That is very odd.