Clear OEM1Key and/or OEM2KEY by writing 0xFFFFFFFF 0xFFFFFFFF in both OEM1KEY and OEM2KEY flash memory option bytes.
The OEM1_LOCK and/or OEM2_LOCK bits in FLASH_NSSR [19:18] are consequently cleared. They can be checked as described in Step 3 - Check if OEMxKEYs are provisioned (FLASH_NSSR [19:18] = 00).
CAUTION: When OEM2KEY is cleared or not provisioned at all, RDP level 2 to level 1 regression is not possible.
Clear OEM1KEY
Use the following command in the STM32CubeProgrammer CLI interface:
> STM32_Programmer_CLI.exe -c port=swd mode=hotplug -lockrdp1 0xFFFFFFFF 0xFFFFFFFF
Device name : STM32U575/STM32U585
Flash size : 2 MBytes
Device type : MCU
Device CPU : Cortex-M33
BL Version : 0x30
Debug in Low Power mode enabled
Lock RDP1 password successfully done
Clear OEM2KEY
Use the following command:
> STM32_Programmer_CLI.exe -c port=swd mode=hotplug -lockrdp2 0xFFFFFFFF 0xFFFFFFFF
Device name : STM32U575/STM32U585
Flash size : 2 MBytes
Device type : MCU
Device CPU : Cortex-M33
BL Version : 0x30
Debug in Low Power mode enabled
Lock RDP2 password successfully done
The user can check that the OEM1LOCK and OEM2LOCK bits are cleared by reading the content of the FLASH_NSSR register as in Step3 (Step 3 - Check if OEMxKEYs are provisioned).