Is your feature request related to a problem? Please describe.
#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.
@acassis @liam-geotab @mykhailosopiha
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
Is your feature request related to a problem? Please describe.
#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.
@acassis @liam-geotab @mykhailosopiha
Describe the solution you'd like
Add a word read/write API, which can use the following approach to prevent data corruption:
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