Showing results for 
Search instead for 
Did you mean: 

How to enable write protection using I2C bootloder protocol

Associate III

Hi all,

I wanted to enable the write protection option byte using I2C bootloader ( Bootloader given by stm32). This can be done using the stm32 debugger also. but in my case requirement is using I2C bootloader only.
communication protocol: I2C
previously I have updated the user configuration option bytes using the same method(i2c bootloader). in which I have given the register address and the value. in that case, the option byte was updated as per the expectation.

For the write protection option byte, I tried multiple times with the same method and checked the write protection option byte using a debugger, but it is not updated(it remains as default).
below is the snapshot of the option byte register address. I am using the 0x1FFF7818 address to protect the first two pages.



1) Are there any additional steps I have to perform to enable the write protection?

2)does anyone have any idea how to do that?

If anyone has any ideas, please let me know. Applying this feature is a priority for us. and currently, we are blocked with this.  



See how the updating and configuration of option bytes works via STM32 Cube Programmer, and the UART/COM connectivity method, see if you can apply that knowledge vs the I2C method.

>>..we are blocked with this.  

Then consider other approaches, you have code running on the MCU, you can have it detect that the Option Bytes aren't set the way you want, and change them. Think about ways you can solve or understand the problem..

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

Hi @Tesla DeLorean

Thanks for your quick response,
>> Then consider other approaches...
 My code running on MCU can do this updation. But that will not fulfill the actual requirement.

>> ..see if you can apply that knowledge vs the I2C method.
I have gone through the method UART/COM connectivity method.
the below snapshot shows the write protection command using the I2C system bootloader. Which can be achieved by three steps.



1) Send the write protection command (0x63 + 0x9C)
2) Send the number of sectors to be protected and checksum (0x01 + 0xFE).
3) Sector code and checksum.(0x01 + 0xFE)
I performed these three steps. I have received the ACK response from a device for the first two steps.
For the third step, I am not getting any response from the device.

Do you/anyone have any idea why the device is not responding for the last step? Am I missing anything?

Note: I am trying to write protect the first page of flash memory.


Associate III

Hi Team,
Does anyone have any idea about my issue with write protection using the system bootloader in stm32G0?
I want to apply write protection using the system bootloader, which is not happening.
your valuable input will be much appreciated.