[solved] Programming ATmega2560 on Arduino Mega 2560 with ICSP

Hello,

I'm trying to program the ATmega2560 on my Arduino Mega 2560 via the ICSP header next to it.

My programmer is an USBASP device.

I am uploading the following blink code:

#define F_CPU 16000000UL
#include <util/delay.h>

int main() {
  DDRB = 0xFF;
while(1) 
    {
        //PORTB ^= _BV(7); //for atmega
          PORTB ^= _BV(3); //for attiny
        _delay_ms(500);
    }
}

When uploading the code for an ATINY85 I select the board from damellis/attiny.
My question is: What board do I select for the ATMEGA2560?

I can upload the bootloader using the "Arduino Mega or Arduino Mega 2560" board, but the code does not upload.

Any advice?

Additionally, and this might be linked to the above problem or not:

I also tried uploading the code with Eclipse using the AVR-GCC toolchain. This will upload the code the both the ATtiny85 and the ATmega2560, however on the ATtiny the LED will blink, but on the ATMEGA not.

For the ATtiny I have a LED on PB3, on the ATmega I want to use the LED already on the Arduino board, which is connected to PB7, if I'm correct

Oke, ofcourse after some research on this topic and this message I have found the solution.

I changed the high fuse bytes to 0xD9 and uploading from eclipse works.