This FAQ is used to write/read data in general purpose memory of public area. The ADSP-BF51x processors include an on-chip, one-time-programmable memory array which provides 64k-bits of non-volatile memory.
The one-time-programmable memory is divided into two main regions. A 32-k bit “public” unsecured region which has no access restrictions and a 32-k bit “private” secured region with access restricted to authenticated code when operating in Secure Mode. OTP memory programming is done serially under software control. Since the unprogrammed OTP memory value defaults to zero, only bits whose value is intended to be “1” have to be programmed.OTP memory can only be written once (changing a bit from 0 to 1). Once a bit has been changed from a 0 to a 1, it cannot be changed back to 0. The flag, OTP_CHECK_FOR_PREV_WRITE should always be used by default/recommended when performing write accesses to OTP with the bfrom_OtpWrite() function.If the flag OTP_CHECK_FOR_PREV_WRITE is specified in the call, a write to a previously programmed page causes dedicated error messages and will not be undertaken. We have attached a tested code, which will write a data in page 0x1C of unsecured general purpose space and the data can be verified using read operation. The "bfrom_OtpRead" and "bfrom_OtpWrite" API are used to write and read from OTP public general purpose space. For testing purpose write data used as 32bit data and "OTP_CHECK_FOR_PREV_WRITE" is not used in one of the write call.
Please Refer "Chapter-3,OTP", "OTP Programming Examples" from ADSP-BF51x HRM from below link. https://www.analog.com/media/en/dsp-documentation/processor-manuals/ADSP-BF51x_hwr_rev1.2.pdf
OTP_Write_Read.zip