I am trying to protect lower region of the flash where I configured it to be for bootloader software.
As per datasheet, I have to set the configuration in register FPROT.
I succeeded to configure FPROT register to protect lower region till 8 KBs as when I tried to access the flash within the 8 KBs using flash commands, Flash driver has responded with error associated with flag "Region is protected".
So all of that till now is OK.
Now, I need to save this configuration in the flash so that I do not need to reconfigure FPROT register every time at startup.
When I searched for this topic, I've seen that the protection configuration can be programmed in address 0x40D so that just after reset, the needed configuration for the protection will be loaded in FPROT register automatically from address 0x40D.
MY ISSUE is here; I could not do the programming of this byte in the flash (I.e. address 0x40D).
When I write the configuration of FPROT register, data has not been transferred to address 0x40D which means it has not been programmed so I don't know how to program it in address 0x40D after writing this register (FPROT).
I also tried to use another mechanism which is trying to direct access the flash within sector that includes address 0x40D only (Erase this sector and re-write the sector but with changing byte in address 0x40D) which means hard code it by the needed configuration. This method totally ignored the FPROT register configuration.
Also this method unfortunately did not let me to connect to the controller using the debugger.
I believe that there is something fault happened !!.
Any help please to program the byte from register FPROT to address 0x40D safely.
Thank you in advance.