Skip to main content
MProgrammer
Associate
October 19, 2021
Question

Is there any way to set write protect on flash memory for ever?

  • October 19, 2021
  • 4 replies
  • 1672 views

Hi,

I want to block flash memory for writng after programming it. It is important that write protect should not be possible to deassert.

I have read about RDP mechanism, but there is information that on level 2 write protection is permament, but only in case of programming flash from JTAG. I need to know how to block flash for programming from booth JTAG and internal program write access.

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
October 19, 2021

Don't have any of the flash write/unlock code in your app?

Often bits in Option Bytes, but don't recall an otp/fuse type method

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

Please include your chip number. Write protect options are chip specific, and there are thousands of STM32 chips, but typically they exist.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MProgrammer
Associate
October 19, 2021

Thank you for answer. The chip number is STM32L562​

Pavel A.
Super User
October 19, 2021

If you have a trusted "bootloader", it can disable access to the flash controller for the "application".

This protection will be effective until next reset, then the bootloader will get control and repeat.

MProgrammer
Associate
October 20, 2021

I found that sentence in RM:

"WRP areas can be modified through option byte changes while RDP level is less than 2."

Does it mean that WriteProtect is permament if I lock WriteProtect in OptionBytes and then I set RDP level 2?

TDK
Super User
October 20, 2021
Yes, setting RDP level 2 locks the option bytes.
"If you feel a post has answered your question, please click ""Accept as Solution""."