Hi @AndreVB
The last 8 bits you are modifying affects the FTFA_FSEC register.
Please look into 2.1.1 FSEC register and field settings from AN4507 or 45.3.3.3 Flash Security Register (FTFA_FSEC) from your reference manual.
As the appnote and the manual says, this configure features such as:
- Backdoor Key Security Enable
- Mass Erase Enable
- Factory Security Level Access Code
- Flash Security
Please check this chapters an read the register description.
Q1: Yes with the last one 0xFFFF3FFF you will secure the flash.
Q2: By changing the FTFA_FSEC register the flash will be secured, however, a method you can use to verify that the flash is secured by trying to initiate a debug session and it should return with an error.
Q3: According to the chapters I mentioned before, yes they are the same.
Please be carefull if you want to test this, I recommend you to keep the mass erase ENABLE, since combining security enable and mass erase DISABLE you will not be able to recover the board.
This method will secure all the flash, I will look for information to verify if it is possible to just secure a specified amount of bytes on the flash.
I hope this was a more informative for you.
Best Regards, Miguel.