This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Setting OTP LOCK bit

uC: STR912

I am having trouble programmatically setting the OTP lock bit (ie not using JTAG/CAPS to set the lock, but by using firmware running on the STR912 itself). I can read and write the OTP fine, but I cannot set the OTP lock bit.

The ST-supplied library does not provide this function, but the FLASH programming manual downloaded from ST shows the following steps:

1. write 0xC0 to any word address in bank 1 (eg FMI_BANK_1)
2. write 0x01 to any word address in bank 1 whose LSB is 0x08 (eg FMI_BANK_1 | 0x08)
3. poll PECS until operation complete
4. read status
5. write 0x50 to any word address in bank 1 to clear status
6. write 0xff to any word address in bank 1 to return to READ mode

This procedure does not seem to set the LOCK in that I can still further program OTP after doing this. The really odd thing is that the sequence above is exactly the same sequence of operations as to program the value 0x0001 into OTP locations 0x08 and 0x09 (and I do indeed seem to have 0x0001 in locations 0x08 and 0x09) so this documented procedure must be wrong (or I have misinterpreted it).

Can anyone tell me the correct procedure?

Christopher Hicks
==