Suddenly cannot flash ATmega328P due to verification failure

atmegaavrdude

For a couple of years I have been flashing some boards I designed that use an ATmega328P using a USBtinyISP and avrdude. I have three identical boards that have been programmed successfully dozens of times. Suddenly I cannot program ANY of them. In every case, avrdude gives me a verification error. For any given board, it's the same address, but each board fails at a different address (0x02df, 0x0a97, and 0x043f). After the failure, two of the boards appear to be working (LEDs react appropriately) but I would not trust them. Interestingly, a fourth board, used for development, occasionally (rarely) flashes successfully. FWIW, the boards are connected to the USBtinyISP via pogo pins. But this connector has been working for a couple of years. I can see in my scroll history multiple successful flashes just two days ago!

What could possibly be causing this complete failure? What can I try? I'm at my wits end.

Best Answer

The problem is gone and I wish I could say exactly why. In an act of sheer desperation I did a make clean and then make in the main firmware directory (there are libraries in a couple of other directories that I did not touch). I then flashed a board that had not worked and it passed verification! So I did another board. Passed. And another. Passed. And another. 100% success. No failures at all

I cannot explain why just rebuilding the flash would fix this. As far as I know, avrdude just writes the hex file, reads it back, and compares the two. If anybody has any possible explanation, I'd love to hear it.

On the other hand, there was a lunar eclipse the night before this all started...

Related Topic