30.5.3.9 “Software” Protections
The User area can be protected against read accesses and/or modifications.
To enable read protection of the User data (OTPC_DR) and header (OTPC_HR) registers, OTPC_MR.RDDIS must be set. Clearing RDDIS allows read access again. When the OTPC_DR and OTPC_HR registers are read-protected, any read returns 0.
To enable write protection of the OTPC_DR registers, the WRDIS bit of OTPC_MR should be set. Clearing the WRDIS bit allows write access again.
To enable write protection of the User area, the write protection of the User data registers must be enabled.
The OTPC_MR can be locked until the next reset by setting the LOCK bit of OTPC_MR. Once locked, the current protection configuration of the OTPC_DR and OTPC_HR registers applies, it is then also impossible to update, program, invalidate, hide or read a packet (the OTPC_MR.ADDR field is then locked too preventing to select a packet).