NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Programming 'error' but programs load & run

December 30, 2009
by NK_EK
NK_EK's Avatar

Hi,

I have a strange one: since this morning, I get the following error message when running make:

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0100
         0x00 != 0x3f
avrdude: verification error; content mismatch
avrdude: error: programmer did not respond to command: leave prog mode
make: *** [tempsensor-upload] Error 1

The program loads fine, but when avrdude reads it back to compare, it sometimes runs through to 100% and sometimes stops somewhere from 70% onwards.

The program also runs fine on the MCU.

I also reloaded the initialload program and the same thing happens. Same error message, but the code runs 100%.

I can read the output from the program / MCU through the USB-Serial header using Putty, so I don't think the header is shot.

I've been known to inadvertently 'break' things, so I would not be surprised if this is the case again.

Let me know if you need any more info, code, etc.

Thanks in advance.

Ernest

December 30, 2009
by Farmerjoecoledge
Farmerjoecoledge's Avatar

This is definate case for "Weird Happenings"

This software they got for us wannabes sucks sometimes. This eXtreme burner i'm trying to use erased the chip no problem. but try to program it, and it's either it cannot connect to chip or it's the wrong chip. Stupid eh?

Hey, if it's not broken don't fix it. It's just a quirk, a reboot usually fixes those. Conflicts between different software will cause those too.

December 30, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Ernest,

I have seen this behaviour out of the cables in the past, especially when writing particularly large programs. The last verification step reads back the program byte by byte and compares it against the .hex file you tried to write. There can sometimes be single byte errors when reading back that much data that would cause your program to not verify, but still work properly.

The other thing that could be happening is that you somehow managed to damage the receive side of the serial interface such that you can still send data reliably (to program) but it fails to get data back reliably. You can try running a program that has printf's in it to send data back to the computer, see if that works properly.

Humberto

December 30, 2009
by NK_EK
NK_EK's Avatar

Hi, everyone!

Thanks for the quick responses and ideas.

Yip, this is certainly one that almost qualifies for the "Weird Happenings" ;-)

It seems that there's nothing wrong with my kit (yoohoo!), it was just the USB->Serial cable I use (I'm not using the NK cable as I already had one set up & working, but these things can get 'finicky' sometimes). For some reason it could not successfully read back the code from the MCU - even though I could read output from the MCU using printf (strange, I know). Just restarted the PC and everything is good again.

Humberto, the code that I loaded was just under 12kb. Just for interest's sake - how big is the bootloader?

Thanks again, guys!

Ernest

December 31, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Hi NK_EK,

I don't remember off the top of my head how big the bootloader is, but we set the fuses such that 1024 words (2048 bytes) are reserved for the bootloader. So the bootloader eats 2K of your flash.

Humberto

Post a Reply

Please log in to post a reply.

Did you know that microcontrollers have two different kinds of memory, program space (flash) and SRAM? Learn more...