Closed ooxi closed 4 years ago
I will not merge this. This has nothing to do with programming the part. And by keeping the code small and simple you are able to take it and modify for your needs.
If you need to have serial numbers, it is fine, but there is no need for everyone to have it.
Well I can see you reasoning, however we also print the target DSU_DID
which is not strictly required for programming either.
If you do not reconsider (and you are under no obligation to do so), I will carry this patch in a small fork :-)
We only print it when the target is not known. DSU_DID is required for ongoing maintenance. It is less relevant now that revision is masked out, but previously situation when a part is not recognized because of a different revision number were common. Printing DSU_DID in this case is more user friendly than just printing "unknown part". We also need to read it anyway, since it is used as part of the part detection method.
For future reference: patch will be carried in edbg-serial-number.
By printing the serial number of the target acted upon enables a lot of use cases like statistical analysis and tracability. The serial number is read from the devices memory using SWD.
Successfully tested on samd21 hardware as well as verified using datasheet of the following targets:
However the targets samr34 as well as samr35 do not seem to support serial number extraction. I wanted to keep the pull request as small as possible, but I can implement a device discrimation if you want in order to not print wrong serial numbers for unsupported devices.
For my usecase it would be very helpful to be able to read the serial number into a file, however I did not find information about a unique device identification for other targets then CM0+.
Sample output: