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

Weird AVR family warning on locked AVR-Dx #1894

Closed
LinuxJedi opened this issue Aug 21, 2024 · 4 comments · Fixed by #1907
Closed

Weird AVR family warning on locked AVR-Dx #1894

LinuxJedi opened this issue Aug 21, 2024 · 4 comments · Fixed by #1907
Labels
enhancement New feature or request

Comments

@LinuxJedi
Copy link

I'm flashing a locked AVR-Dx with the following command, which works great, but the messages are a bit weird:

avrdude -c atmelice_updi -p avr64da64 -e -U flash:w:flash.hex -U lock:w:0xA33A3AA3:m

This is the initial message before the flash executes:

Error: device is locked; chip erase required to unlock
Error: device is locked; chip erase required to unlock
Error: unable to read byte at address 0x0000
Error: read operation failed for memory signature
Error: unable to read signature data for part AVR64DA64 (rc = -3)
Warning: received FamilyID: "AVR    "
expected FamilyID: "    AVR"

Whilst really minor, I find it odd for two reasons:

  1. It says "Error", but these are more warnings, they are non-fatal and I have provided -e anyway.
  2. The FamilyID appears to have different whitespace to the expected response.

I don't know enough about avrdude's code or the protocol to understand why, and it isn't really a problem, but it was just a little unexpected :)

@stefanrueger
Copy link
Collaborator

Thanks for reaching out @LinuxJedi.

Yes, I can relate to your observation. It is a side effect of the way that AVRDUDE is written as an application from our big AVR library libavrdude that there are a couple of independent abstraction levels that engage with hardware: lower levels don't necessarily know whether upper levels have an alternative plan should things go wrong and upper levels don't necessarily know how many error messages and warnings the lower levels have issued. So, yes, AVRDUDE tends to overcomplain, and sometimes doesn't get the error/warning level right. We won't be able to fix that but have done a lot of work to smoothen out communication in standard cases.

The FamilyID is a thing, albeit one that Microchip botched. This is a situation where AVRDUDE cannot read the signature and thus cannot really verify that it's the chip the user said it is. Early on, AVRDUDE tried to evaluate the FamilyID, but Microchip subsequently has failed to put a reasonable string into the space foreseen for the FamilyID in their SIB for the series of chips they developed later on. Rather than AVR DA, AVR Ex, or similar they actually "encode" different one with "AVR " and " AVR", believe it or not. To make things worse, AVRDUDE's config file seems to have mistakenly put the wrong expected FamilyID into 64da64's entry in this case. I have long doubted the utility of this FamilyID check, so am tempted to just drop FamilyID from the code and config file. @MCUdude? @dl8dtl? @mcuee?

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 21, 2024

I don't have an AVR64DA64, but I do have an AVR128DA64. And this has the AVR family ID. I just gave it a try.
So I don't know how the AVR64DA64 ever got that AVR family ID.

The story I've been told is that they messed up when they released the DA series with AVR, and corrected new chips (ABR DB, DD etc.) with AVR instead. so again, I have no idea how or why the 64DA64 is different than the rest of the DAs (I've currently tested the 128DA64, 128DA48 and 128DA28). So yes, I'd vote for dropping the family ID.

But the other lock "errors" should perhaps be turned into warnings.

But it doesn't serve any purpose for Avrdude anymore. Is we really want that we can just read the SIB, something that wasn't possible a few Avrdude versions ago.

@stefanrueger
Copy link
Collaborator

the other lock "errors" should perhaps be turned into warnings

It's as fatal as it can get, leading straight to being unable to read the signature. And the only remedy is CE. So, that's way more than just a mere warning from almost any vantage point except when you know a CE is the master plan all along... but that's nothing that the low-level routine can or should know. I hope users can live with this situation being communicated as error.

@mcuee
Copy link
Collaborator

mcuee commented Aug 21, 2024

I have long doubted the utility of this FamilyID check, so am tempted to just drop FamilyID from the code and config file. @MCUdude? @dl8dtl? @mcuee?

Looks like a good move to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants