standalone MEGA 2560

Hi,
I have checked the firmware and it is v1.0.7 (from the device manage - USB\VID_1FFB&PID_0081&REV_0107&MI_04)

I am using the Arduino IDE and I selected Tools->Burn Bootloader and I get this error:

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

Is it a hardware wiring connection error? Or my procedure is wrong?

I have no experience with Pololu's programmer, but I have done standalone 2560s before and did one this week using Atmel programmers. Just to reiterate the process, bind pin 64 (avcc), 52 (vcc), and 21 (vcc) to 4.5V - 5.5V and pins 63, 53, and 22 to ground. Reset, pin 20, must be held high through a 10K external resistor in addition to being connected to the programming port - the programming port can overcome this when the 2560 is being programmed but when the 2560 is not being programmed it needs to be high. Pin 62 (aref) should be connected to ground through a .1uF cap, though this is not strictly necessary. Have you probed all of these pins to make sure they are connected correctly (aref will be floating but the others should be tied to ground or positive voltage). Have you ensured continuity between the pins on your programming port and the pins on the 2560? Are the pins actually in the correct order? I am betting a hardware issue right now. You shouldn't need a crystal for the default clock mode but may want to add that too, it shouldn't hurt you as the 2560 will initially use its internal clock.

The Pololu programmer does not support powering of the target device. How are you powering your mega2560?

One word of caution, when burning bootloader from IDE using the Pololu programmer to a mega2560, it tends to hang the IDE. It appears the Pololu programmer output has very verbose messages that overflows the IDE buffers. So if the IDE becomes unresponsive then just close the IDE window and reopen it again.

Thanks for your reply.

I have re-check and probe the wiring again and they are similar to JoeN process. In addition I have 3 x 0.1uF cap connected from AVcc to Gnd. I also have a resonator and a 1K resistor connected across the XTAL1 and XTAL 2. The datasheet of the resonator is attached.

The 6 ISCP pins are also probed from the 2560 up to the Pololu programmer where the 6 pins are indicated as shown.

I am currently powering the 2560 with a 9V battery cell thru a voltage regulator that provides a constant 5V output. The voltage level is sufficient as indicated by the Pololu programmer yellow blinking LED (which means that the programmer has detected the target device, and the voltage on the target VDD line is high).

The Arduino IDE didn't really hang but returns the following error msg when I tried to download bootloader or upload sketch using programmer.

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

awcr resonator.pdf (302 KB)

Usually those type of errors indicate bad ICSP connections to the target device. Can you post the full output?

Can you explain more on the full output?

I am using the Arduino IDE and the errors I received when burning bootloader and uploading using programmer are the same.

See attached screenshot.

Arduino IDE error burn bootloader.pdf (231 KB)

Arduino IDE error upload using programmer.pdf (235 KB)

From the IDE File->Preferences menu, you can enable "show verbose output during upload". Then post the results.

The errors you are seeing could be due to no system clock, or bad connections. What kind of prototyping board are you using for your ATmega2560?

Thanks.

I have attached the verbose output. Please help me on this, I can't figure out anything from this output.

I am using a Schmart board with TQFP 64 pin for my mega2561. I wired it up as per what I had mentioned in my earlier post.

Error with verbose output.txt (8.82 KB)

Hi,

I noticed this in the verbose output:
SCK period : 1.1 us
Varef : 0.0 V
Oscillator : 3.686 MHz

Does this imply that my circuit oscillator is 3.686 MHz?

No I believe that is the programmers clock speed.

What speed is your resonator?

The output indicates that the programmer cannot communicate to the ATmega2561.

Also the ATmega2561 is not the same as the ATmega2560, so we should change the part number to avrdude. But this is not why it's failing yet.

How is your reset pin connected up?

The speed of the resonator is 16MHz.

The reset pin is currently tied up to 5V thru a 10K resistor.

HH75:
The speed of the resonator is 16MHz.

The reset pin is currently tied up to 5V thru a 10K resistor.

The reset pin sounds fine. I've never used a resonator, only a crystal. I don't think it should matter. Unless you have set the fuse, the 2560 is using it's internal oscillator anyway, and since you cannot connect I assume you have not set that fuse yet.

You mean the 2560 is not using the resonator that is connected to it now?

I have set no fuse yet at the moment, do I have to set any fuses and how can I do that?

HH75:
You mean the 2560 is not using the resonator that is connected to it now?

I have set no fuse yet at the moment, do I have to set any fuses and how can I do that?

According to the datasheet:

10.3.1 Default Clock Source

The device is shipped with internal RC oscillator at 8.0MHz and with the fuse CKDIV8 programmed,
resulting in 1.0MHz system clock. The startup time is set to maximum and time-out
period enabled. (CKSEL = "0010", SUT = "10", CKDIV8 = "0"). The default setting ensures that
all users can make their desired clock source setting using any available programming interface.

This means that this chip, and I think all 8 bit AVRs are this way, is set to use the internal oscillator by default. This is the safest possible setting because unlike an external resonator, crystal, or clock, that internal oscillator is actually guaranteed to be there. AVRs are bricked if the clock source is selecting one that doesn't really exist.

From reply # 23...

Thanks for your reply.

I have re-check and probe the wiring again and they are similar to JoeN process. In addition I have 3 x 0.1uF cap connected from AVcc to Gnd. I also have a resonator and a 1K resistor connected across the XTAL1 and XTAL 2. The datasheet of the resonator is attached.

Likely the problem, If true...100K to 1M ohm is typical and Arduino uses 1 M

Bob

Typo error, it is a 1M resistor connected across the resonator.

That means regardless of whether my resonator is working or not, it should work using the internal oscillator? So it is not the resonator problem.

Ahh, okay. If it's still at factory default of 1MHz internal clock then you may need to slow down the Pololu programmer's ISP Frequency. You need to check your Windows Pololu USB AVR Programmer Configuration Utility and see what ISP Frequency it is set to. If it is 750kHz or above then it's too fast to program 1MHz AVRs. You will need to set it down to 200kHz or below.

I have tried setting it down to the lowest of 1.5Khz but I am still getting the same error log.

Just to recheck my step for burning bootloader...

I hooked up pololu programmer to the ISCP pin, power up the mega 2561, run the Arduino IDE, check the correct serial port is used, check the correct programmer is used and click Burn Bootloader.

The ISP Frequency of 1.5kHz may be too low actually. My testing showed 200kHz works best for 1MHz AVRs.