The reason for this is because there is a bug in the Arduino MEGA 2560/ADK firmware that does not allow flash write commands to start at anywhere but the beginning of flash memory (0x000000). See the bottom of this page for more technical details.

The reason for this is because there is a bug in the Arduino MEGA 2560/ADK firmware that does not allow flash write commands to start at anywhere but the beginning of flash memory (0x000000). See the bottom of this page for more technical details.

−

Because ROBOTC is not able to burn a new bootloader as of today, you will need to use the Arduino's Open Source language with our a modified bootloader file to re-burn your bootloader on your Arduino MEGA 2560/ADK boards. Once the new bootloader is burned, you will be able to program your Arduino MEGA 2560/ADK with both ROBOTC and the Arduino Open Source language.

+

Because ROBOTC is not able to burn a new bootloader as of today, you will need to use the Arduino's Open Source language with our a modified bootloader file to re-burn your bootloader on your Arduino MEGA 2560/ADK boards. '''The enhanced bootloader is backwards compatible with the original one. That means you'll still be able to program it through the Arduino programming environment as before, in addition to ROBOTC for Arduino.'''

== Hardware Needed ==

== Hardware Needed ==

Line 13:

Line 13:

'''Using an AVR ISP (In System Programmer)'''

'''Using an AVR ISP (In System Programmer)'''

*Your Arduino MEGA 2560/ADK (to program)

*Your Arduino MEGA 2560/ADK (to program)

−

*An AVR Programmer such as the [http://www.sparkfun.com/products/9825|AVR Pocket Programmer]

+

*An AVR Programmer such as the [http://www.sparkfun.com/products/9825 AVR Pocket Programmer]

*An AVR Programming Cable (the pocket programmer comes with one)

*An AVR Programming Cable (the pocket programmer comes with one)

Line 32:

Line 32:

In addition, you'll need the ROBOTC modified bootloader. You can download that here:

In addition, you'll need the ROBOTC modified bootloader. You can download that here:

Contents

Arduino 2560 Bootloader Issue

The current bootloader burned onto the Arduino MEGA 2560/ADK is not compatible with ROBOTC. In its current form, you will be able to download the ROBOTC Firmware to the Arduino MEGA 2560/ADK, but you will not able to download any user programs.

The reason for this is because there is a bug in the Arduino MEGA 2560/ADK firmware that does not allow flash write commands to start at anywhere but the beginning of flash memory (0x000000). See the bottom of this page for more technical details.

Because ROBOTC is not able to burn a new bootloader as of today, you will need to use the Arduino's Open Source language with our a modified bootloader file to re-burn your bootloader on your Arduino MEGA 2560/ADK boards. The enhanced bootloader is backwards compatible with the original one. That means you'll still be able to program it through the Arduino programming environment as before, in addition to ROBOTC for Arduino.

Hardware Needed

To burn a new version of the Arduino bootloader to your MEGA 2560/ADK, you'll need an AVR ISP Compatible downloader.

Select the "Burn Bootloader" option under the "Tools" menu. The modified bootloader will now be sent to your Arduino. This typically take a minute or so.

You should be all set to download ROBOTC firmware and start using your Arduino MEGA 2560/ADK with ROBOTC!

Technical Details

The Arduino Bootloader sets the "eraseAddress" to zero every time the bootloader is called. ROBOTC called the "Load Address" command to set the address in which we want to write/verify when downloading program.

When writing a page of memory to the arduino, the Arduino bootloader will erase the existing page and write a whole new page.

In the scenario of downloading firmware, everything is great because the Erase Address and the Loaded Address both start at zero.

In the scenario of writing a user program, we start writing at memory location 0x7000, but the Bootloader erases information starting at location zero because the "Load Address" command doesn't update where to erase.

Our modification is to set both the Load Address and the Erase Address so the activity of writing a user program doesn't cause the firmware to be accidentally erased!