I got my new ArduPilot Mega board this week and it has already the Atmega 2560 on it.


So how do I get the ArduCopter RC2 code on that board ?


I already selected the right board type







This is the error message Ill get when I try to upload the code:

D:\DATA\Arduino\libraries\APM_RC\APM_RC.cpp:27:3: error: #error Please check the Tools/Board menu to ensure you have selected Arduino Mega as your target.

Please help!



Views: 2714

Reply to This

Replies to This Discussion

open APM_RC.cpp with editor (it is located in D:\DATA\Arduino\libraries\APM_RC\ on your pc)


it says

#if !defined(__AVR_ATmega1280__)
# error Please check the Tools/Board menu to ensure you have selected Arduino Mega as your target.


you have three options:

1. remove these three lines

2. replace 1280 with 2560

3. write "#if !defined(__AVR_ATmega1280__ || __AVR_ATmega2560__)" <- best solution

Hi Sebastian,

thanks for your quick reply.

The upload works perfect if I use your option 2 but with option 3 Ill get the following error


D:\DATA\Arduino\ArduCopter\libraries\APM_RC\APM_RC.cpp:26:33: error: missing ')' after "defined"
D:\DATA\Arduino\ArduCopter\libraries\APM_RC\APM_RC.cpp:26:36: error: missing binary operator before token "1"

So I think there is a little syntax error in your option 3 but as I am not really firm with the syntax I can´t find it.




yes it should be a syntax error, but I don't exactly know how to fix it...

you're fine with option 2, but maybe someone could tell how the syntax works here

try replacing

#if !defined(__AVR_ATmega1280__ || __AVR_ATmega2560__)



#if !defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)


This is fixed in the latest libraries on trunk.  Guess we should update RC2 as well!


Not sure which of the above suggestions will also work but this one certainly will:

#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) 


There were other small (but very similiar) changes that needed to be made in some of the other libraries to support 2560:



You should be able to click on the + sign beside each file name.  It will show the line numbers on the left side and the green line shows what the line must be changed to.

Thank´s for your reply´s


I tried all the other otions with || (or) no sucess but this one is definitly working

#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) 


Thanks for the link.

Will have a look at the other libraries now


Does the new board with the 2560 on it also use the ATmega8U2 instead of the ftdi chip ?


I asked Chris to post the v1.4 Eagle schematic and layout files on the DIY Drones Store APM catalog page and I believe that he did so.



no, because ftdi chip is located on the IMU shield, not on APM

hello, did you get this board(atmega 2560) to work with apm planner?for some reason i cant read/write the eeprom.

any help will be greatly appreciated

thank you

The planner has not been updated yet to work with the 2560 boards....

Hello, do you know if there is an issue with the Configurator v1.2.2. too?

I tried to get it comunicating with my 2560 board without any sucess.




Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service