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

Fix the addresses of signature module structs for some devices #216

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

BryanKadzban
Copy link
Contributor

For some reason ST puts these registers at different locations on different devices.

ST publishes three different reference manuals: RM0385, RM0410, and RM0431. The first two document the UID and FlashSize registers at the addresses used before this commit; the last has them at the newly added addresses. That last reference manual is for the F7x2, F7x3, and F730 devices, so use these other addresses for those three types of device.

ST publishes three different reference manuals: RM0385, RM0410, and
RM0431.  The first two have the UID and FlashSize registers at the
addresses used before this commit; the last has them at the newly added
addresses.  That last reference manual is for the F7x2, F7x3, and F730
devices, so use the new address for those three families.
Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
I see you have added alternative addresses for FlashSize and Uid but what about the other structs that are now conditional (VrefCal, VtempCal30 and VtempCal110)?
Have you tested this in hardware?

@BryanKadzban
Copy link
Contributor Author

Those three structs aren't in the 0431 reference manual (none of the references to calibration are any of these registers), so yes, dropping them was intentional.

I didn't actually look to see if they're in both 0385 and 0410 though... Hmm. They're not in either, actually. I wonder if that means they're documented in some other manual, and maybe they are present on the F722 device? Looking at the original commit that added this signature module, it was first turned on for only the F746 chip ... aha, it's documented in the datasheet, not the reference manual (in a couple tables in the "temperature sensor" and "reference voltage" sections). And the datasheet for the 722 chip shows the same fields are present, but also at a different address than the 746.

OK, fixing that properly will take a lot of datasheet reading (since each chip has its own datasheet; they don't share an ID like the reference manuals do), so I'll re-add it with the proper addresses for everything, and upload something new when that's done. Might take a while.

I have tested accessing the Uid struct on a real F722 chip (that was all I needed); without this patch the code triggers a hard-fault, and with it, I get valid-looking signature data.

These Vref calibration and temperature sample registers do actually
exist for those chips, but aren't documented in the reference manuals
for any F7 chip.  (The registers are documented in the datasheets
instead.)

Add them back.
@BryanKadzban
Copy link
Contributor Author

OK, added the registers back for the other chips. It turns out the address in use does correspond to the same groups of chips as I had already -- F7x2, F7x3, and F730 have the same address as each other, and a different address from every other F7xx chip.

So I think this will work better.

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@eldruin eldruin merged commit eaa235c into stm32-rs:main Sep 13, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants