I finally got the Atmel ICE and Studio 7 working with my mega2560. Breakpoints, control over compilation, and lots of other good stuff. It looked good until I got to a breakpoint and needed the value of a variable. It said the location of the variable was unknown. Almost all the variables were at unknown locations. That makes it a pretty useless system.
So I went back to the original Arduino software - clunky, but at least I can print out variable contents in the Serial Monitor window. When I tried to upload a sketch I got a timeout fault. I reset the fuses to what I believe is the original configuration:
Arduino Mega 2560
Low Fuse 0xFF
High Fuse 0xD8
Extended Fuse 0xFD
but it didn't do any good. The microprocessor seems to be fine - I give it power and it happily runs the last test program I uploaded.
Any thoughts on how to recover access through the original Arduino software?
Sounds like you need to upload the bootloader to your Mega. Unfortunately you can't use the ICE for AVR boards in the Arduino IDE without some work. So you need a different programmer or use another Arduino with the ArduinoISP sketch.
I've looked through all the off line information I could find. There's a lot of good information out there that should have been provided by the manufacturer, but has been obtained, mostly by trial and error, by various users. Unfortunately this is a common occurrence in the tech industry.
It looks like when I loaded a sketch with Studio 7, even though it was just a small test program, it stomped on the bootloader. So I'll give Studio 7 another shot before giving up on it. Here's the codeit is running. All it does is set some flip flops on some attached boards that turn some specific LEDs on and off.
void loop()
{
unsigned int i;
unsigned int j;
unsigned int k;
// put your main code here, to run repeatedly:
k=0;
for (j=1; j<5;j++)
{
setAddress (j); //board address to test
for (i=22; i<38; i++)
{
digitalWrite (i, LOW);
k++;
delay(500);
digitalWrite (i, HIGH);
}
}
i and j are the important variables. To verify the external wiring I need to verify which board (j) and bit (i) turn on which LED. j is recognized and is correctly displayed in the watch window. i and k (k is just a counter) are at 'Unknown location's and can not be read. The breakpoint is on the delay(500); line.
Can anyone shed some light on why J can be read but i and k can not??
By making all variables global in scope they can be watched. That's really bad coding practice in anything but the most trivial programs. Not looking forward to importing all the logic code this app requires.