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

Implement flash read un/protection per PM0075 #299

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TheRealBluesun
Copy link

Abstract

This PR exposes the Read protection feature offered by STMF1xx series MCUs. This feature is implemented as described in the PM0075 Programming manual Doc ID 17863 Rev 2.

Please do review the comments and formatting -- I'd love some feedback there.

Side note -- this was a very fun first contribution to the Rust embedded community; long overdue.

@TheRealBluesun TheRealBluesun changed the title [WIP] Implement flash read un/protection per PM0075 Implement flash read un/protection per PM0075 Dec 27, 2020
while self.flash.sr.sr().read().bsy().bit_is_set() {}

// First we must erase the Option Bytes
self.erase_opt()?;
Copy link
Author

Choose a reason for hiding this comment

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

Taking a second look -- this needs to retain the USER byte value and others. Maybe we can get away without erasing them entirely? The documentation is a little ambiguous.

Copy link
Author

Choose a reason for hiding this comment

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

Update on this:

Writing the RDP value will fail if we haven't erased the Option Bytes first. I've tried saving off the upper half-word and writing it with the new RDP value, but I can't get it to accept it. Will have to investigate more.

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.

1 participant