SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
542 stars 140 forks source link

The error message "Device ID mismatch" seems to be a bug. #1099

Open berkut0 opened 1 month ago

berkut0 commented 1 month ago

The occurrence of this error seems to be a bug, by commenting out part of the code device flashed without any struggle.

in nvmserialupdi.py:

if not self.device_info.get(DeviceInfoKeysAvr.DEVICE_ID) == device_id_read:
    self.logger.warning("ID read ('%06X') does not match expected device id! ('%06X')", device_id_read,
                        self.device_info.get(DeviceInfoKeysAvr.DEVICE_ID))
    # raise ValueError("Device ID does not match")

I got the idea from a message I got when I set the logging level to debug:

WARNING - ID read ('1E9321') does not match expected device id! ('1E9221')

Interestingly, it only differs in one number.

when you have received messages:

Device ID mismatch! Stopping.
Failed programming: uploading error: exit status 1

there might be a workaround, but I think this is the bug

Chip: ATtiny 416

MX682X commented 1 month ago

The 1E9321 is the chip signature for the Attiny816. As your selected chip has only less memory and otherwise the same specs, there aren't any complications. Are you sure you have the correct chip? Where did you order it form? There are cases where chips are getting re-marked, but usually the other way around (marking indicates bigger memory)

berkut0 commented 1 month ago

@MX682X Incredibly, the Chinese factory installed 816 instead of 416. The chip is so small that I didn't check it after receiving the boards. Interesting surprise.

Thanks, that clears things up!

I should point out that the error message is a bit short on detail in such cases.