Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve signature check for UPDI parts #1840

Merged
merged 6 commits into from
Jul 15, 2024

Conversation

stefanrueger
Copy link
Collaborator

Fixes #1813.

Microchip decided to put the signature area for UPDI at two different memory offsets, so you now need to know which part you have in order to be able to read the signature. This PR checks all different known offsets if an attempt to read a UPDI-part signature draws a blank. It's not fool-proof as, conceivably, if there was a valid signature at the wrong location that byte sequence would mistakenly be understood as the signature of the part.

Without this PR:

$ avrdude -cserialupdi -p64dd28 -t
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0xffffff (probably .avr8x) (retrying)
avrdude: device signature = 0xffffff (probably .avr8x) (retrying)
avrdude: device signature = 0xffffff (probably .avr8x)
avrdude error: Yikes!  Invalid device signature.
avrdude error: expected signature for AVR64DD28 is 1E 96 1B
        Double check connections and try again, or use -F to override
        this check.


avrdude done.  Thank you.

With this PR:

$ avrdude -cserialupdi -p64dd28 -t
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 1E 96 22 (AVR64DU28)
avrdude error: expected signature for AVR64DD28 is 1E 96 1B
        double check chip or use -F to override this check

avrdude done.  Thank you.

The code graciously assumes Microchip won't create more than ten different regions for signatures within their UPDI series.

@stefanrueger stefanrueger added the bug Something isn't working label Jul 14, 2024
@stefanrueger stefanrueger merged commit 96090dd into avrdudes:main Jul 15, 2024
13 checks passed
@stefanrueger stefanrueger deleted the signature-check branch July 15, 2024 16:34
@stefanrueger stefanrueger mentioned this pull request Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading error message when specifying wrong AVR-Ex part
1 participant