2018-10-01 06:44 AM
Hi,
It says on page 107 of stm32f777bit6 manual that:
"Each OTP data block can be programmed until the value 0x00 is programmed in the corresponding OTP lock byte."
I understand that OTP is supposed to be one time programmable but the above statement seems to imply that I can reprogram the OTP data until I write 0x00 in the lock byte.
I haven't programmed the lock byte but I cannot reprogram the OTP. I used these commands:
HAL_FLASH_Unlock();
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, 0x1FF0F3A0, 0x55555555);
HAL_FLASH_Lock();
It worked the first time but if I change 0x55555555 it doesn't write the new value.
So what's the problem? And if the OTP is only one time programmable then why create a separate lock-byte if you can't reprogram it anyway?
Thanks
Solved! Go to Solution.
2018-10-01 09:27 AM
>>However, it stays at that value no matter what new value I try to write to it.
Correct, you get to write to zero, not to one. It starts at 0xFFFFFFFF
They are fuses, you get to blow them once, it's not like an EPROM you can expose to UV light. You've got several decades of precedence here on the mechanics
2018-10-01 07:54 AM
>>It worked the first time but if I change 0x55555555 it doesn't write the new value.
Ok, but to what have you changed it?
I haven't looked at the F7, but typically you can program bits to zero, so you could write
0x55555555
0x55555500
0x55550000
0x55000000
0x00000000
in consecutive passes. You cannot make a low bit high again, it is basically a fuse. And you can lock any writes with the lock bit.
2018-10-01 08:31 AM
Thanks Clive. I wrote a 0x00000000 to it and the value of the OTP section changed to 0x00000000 in a single pass. However, it stays at that value no matter what new value I try to write to it. It seems you are right and once changed to 0 a bit will never become 1 again. I think the datasheet should be clarified to show this, unless there is another way to reprogram the OTP section that I am unaware of.
2018-10-01 09:27 AM
>>However, it stays at that value no matter what new value I try to write to it.
Correct, you get to write to zero, not to one. It starts at 0xFFFFFFFF
They are fuses, you get to blow them once, it's not like an EPROM you can expose to UV light. You've got several decades of precedence here on the mechanics