AVRDUDE Verification Error

I recently received the 3pi robot I ordered from Pololu. After playing around with the demo program, I tried to use the Pololu AVR programmer to program the ATmega328P onboard with a simple test program. It seems AVRDUDE was able to erase the flash memory but is not able to successfully program the microcontroller, because the demo program is no longer loaded. I’ve tried programming from both Linux and Windows, but it fails with the same error no matter what. I have also used other HEX files that I know run on other ATmega328P microcontrollers I own. It looks to me like the onboard microcontroller is malfunctioning, but I’d appreciate any advice people can give me. Hopefully I’m just doing something wrong, because it’s depressing that my first attempt at programming this fresh-out-of-the-box 3pi has failed.

Here is the output of AVRDUDE (using the same parameters found in the Pololu Makefile):

avrdude -p m328p -c avrisp2 -P /dev/ttyACM0 -U flash:w:test.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "test.hex"
avrdude: input file test.hex auto detected as Intel Hex
avrdude: writing flash (10048 bytes):

Writing | ################################################## | 100% 2.48s

avrdude: 10048 bytes of flash written
avrdude: verifying flash memory against test.hex:
avrdude: load data flash data from input file test.hex:
avrdude: input file test.hex auto detected as Intel Hex
avrdude: input file test.hex contains 10048 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x9d != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Hello.

I am sorry that you are having trouble with the 3pi.

Your AVRDUDE command looks good, but I am not sure what ISP frequency you are using. Please try adding the -B 3 option, which sets the ISP frequency back to the default of 200 kHz.

Please make sure your 3pi’s batteries are freshly charged.

Just to rule out the possibility that this could be a problem with your Pololu USB AVR Programmer, could you please try using the same programmer and the same AVRDUDE command that failed for the 3pi to program one of your other ATmega328Ps? If the same programmer and same command work to program another microcontroller, then the programmer is most likely OK.

–David

Thanks for your quick reply!

One of the other threads I’ve found online suggested adding the -B 3 option to AVRDUDE which I’ve tried to no avail.

My batteries are also brand new NiMH cells from Pololu which I completely charged before powering on my 3pi.

I’m currently at work, but I’ll try testing the programmer later tonight when I’m back at home.

Hopefully we can get this figured out.

Well it turns out that I do not have any of my other ATmega chips with me (I’m away at work for the summer), but I did try my SparkFun Pocket AVR Programmer and it failed with the same exact error I posted earlier. It would seem that I have a malfunctioning microcontroller on my 3pi, does it not?

Again, thanks for the help!

Yes, it sounds like the microcontroller is malfunctioning. We do test all of our boards before they ship, and that is when the demo program was loaded onto your 3pi, but unfortunately it sounds like something might have happened to the AVR since then.

I have emailed you with instructions on how to send the 3pi to us so we can take a look at it. Sorry for the inconvenience.

–David