darrylring opened a new issue, #20188:
URL: https://github.com/apache/nuttx/issues/20188

   ### Is your feature request related to a problem? Please describe.
   
   https://github.com/apache/nuttx/pull/20144 added STM32H5 OTP read/write 
support. This implementation uses the block locking feature to prevent 
overwriting previously written OTP memory, which causes data corruption. 
However, this means that writing a single word to OTP will lock the entire 
block, and the rest of the block is unusable.
   
   ### Describe the solution you'd like
   
   Add a word read/write API, which can use the following approach to prevent 
data corruption:
   
   * read will do the read, check the flash ECC error register, and use a 
return code to indicate the error
   * write will first do a read, and only attempt a write if the read returns 
0xFFFF and an ECC error, and then do a read and check the result
   
   Read can return one of OK, ERR_READ_UNWRITTEN, or ERR_READ_BAD_ECC (or 
something along those lines).
   Write can return one of OK, ERR_WRITE_ALREADY_WRITTEN, or 
ERR_WRITE_CORRUPTION (or something along those lines).
   
   In addition, this word read/write can be connected to the eFuse driver to 
allow OTP to be read (and optionally written) from userspace.
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Verification
   
   - [x] I have verified before submitting the report.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to