Strange error message?

I,ve written a sketch that compiles with no errors. It seems to upload fine, but at the very end of uploading, I get:

avrdude: verification error, first mismatch at byte 0x1d00
0xff != 0x91
avrdude: verification error; content mismatch

Can someone tell me what this means, and/or what to look for to fix the problem.

Thankful for any help,
DJ

I've never seen that one, but it looks like the code written to the AVR doesn't match what has been read back.
I'd guess your processor is toast, or at least the memory page at 0x1d00 is.
Try a much smaller sketch, maybe even an "empty" sketch, and see if you still get the error.

No, my MCU's not toast. I loaded a larger sketch and it works fine. I've had this error before and as I recall it had something to do with using FLASH_ARRAY. I can't remember how I fixed the problem. I would like to know the cause though. Frustrating!

Thanks for the reply,
DJ

Maybe you have a FLASH_ARRAY large enough that the Sketch exceeds the available Flash.

Does PROGMEM data get counted in the bytes used?

I'm using an Arduino Mega, so I'm fairly certain I have enough flash. The flash arrays are less than 256 bytes. I would put post the code, but it's for a project I hope to sell some day. :-/ Does this error mean that after the sketch has completed uploading it fails verification? One other thing the LED on pin 13 blinks after uploading and the sketch doesn't use pin 13 at all. Strange! :-?

Thanks again for the help guys,
DJ

Does this error mean that after the sketch has completed uploading it fails verification?

Yes.

One other thing the LED on pin 13 blinks after uploading and the sketch doesn't use pin 13 at all. Strange!

That is strange.

Try clearing out the TEMP directory BEFORE starting the Arduino IDE.

Do you have anything running that automatically clears the TEMP directory?

could there be just a byte or two of flash that is bad? is this the largest program you've loaded? I suppose even if it wasn't there'd be a very small chance that say, FF, was loaded into a flash location that couldn't be written to anything other than FF in a program that worked.

If this doesn't resolve itself with some small change in code I suppose it would be possible to use a flash library to write a little memory test. That sounds like a generally useful project. If it were winter I might take it on. The downside to the project is that flash is only rated for some (large) number of writes, I think. Probably limiting the test to only checking 01010101 and 10101010 rather than testing every possibility would be better for the health of the processor.

Another,easier test would be to load it onto another board, of course. Post the sketch so someone can try that.