Why the Arduino suddenly fails?

Hello,

I've read some post of people whose Arduinos suddenly fails (not being able to upload the sketches). I have had the same problem with two Arduino Mini. Without any reason (same software, same USB interface, same PC, almost same moment,...), suddenly, I can not upload the program. (I got the message "avrdude: verification error, first mismatch at byte 0x00xx" and that staff).

I've programmed the Arduino before hundred of times, so I think it's not my fault. I've tried to use avrdude to solve the problem, but no way; I am able to read the flash content, but I am not able to read the state of the lock bits or upload any skecth to the flash (well, I´m not an expert with avrdude, and perhaps there is something I'm missing, but I don´t think so).

I only find two possible explanations for this:

  • First one; Perhaps I've programed the flash too many times (Atmel guarantees 10000 cycles). Well, I´ve tried to figure out how many times I´ve programmed that arduino, probably 1000-3000 times, but I´m sure I´ve not reached even 5000 cycles. Could be a defective part, but it had happened to me with two parts (and the other one was only programmed a few times).

  • Second; for any strange reason, the flash has been locked (although not corrupted), and I'm not able to reprogram it. As I said, I can not read the lock bits with avrdude. (Any clue to see if the flash is locked?) With avrdude in terminal mode I only read 0's when I try to read the lock bits or extended registers (but also when I try to read the flash or the eeprom). In command line mode I can correctly dump the contents of the flash and the eeprom to a file (and they mantain the last uploaded sketch), but again I obtain 0's if I read the lock bits or extended registers (I don't know if this is the normal behaviour of avrdude).

Any idea or help? Due to this problem, I had to unmount a really complex piece of hardware with the Arduino Mini deeply embedded inside, and change it by a new Arduino (and, of course, the day before the demo... a nightmare, you know). I´m really worried about this, because now I don´t feel like using a platform that could be not reliable, unless I can understand what was the reason for this failure.

Thanks

(sorry, this is a re-post of a reply I sent to the thread "Need help, FAST (please)", but I got no comments)

I have had problems with what appeared to be bootloader corruption and simply failing to upload a new program when programming at voltages below 5V (a 3xAA / 4.5V battery with no regulation, to be precise). Not sure if this scenario applies to what you are experiencing.

-j

That's my guess too: something is getting corrupted because the power supply is unstable.

That's my guess too: something is getting corrupted because the power supply is unstable.

I've dumped the contents of the flash for the two Arduino Mini that were failing and compared them with a working Arduino Mini. The bootloader sections (from 0x3800 to end) are identical, so that's not the prblem. The sketch sections are logically different but I've checked they are also not currupted. So the only possibility I guess is that lock bits are corrupted ¿power supply problems? Could be, I was powering the Arduino trough the USB Mini, but perhaps there was aproblem when connecting or disconnecting it.

I've read the bootloader source code and I understand now why avrdude does not work in terminal mode or returns always 0's when I try to read the lock and other extended bits. So I'll try to make a programmer to read the lock bits and see if that was the problem.

Thanks