Skip to main content
harry anders
Associate III
October 1, 2018
Solved

STM32F777BIT6 OTP data reprogramming question?

  • October 1, 2018
  • 3 replies
  • 843 views

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

This topic has been closed for replies.
Best answer by Tesla DeLorean

>>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

3 replies

Tesla DeLorean
Guru
October 1, 2018

>>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.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
harry anders
Associate III
October 1, 2018

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.

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
October 1, 2018

>>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

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..