PEmicro Blog

STMicroelectronics STM32C5 RDP Regression Guide

Jun 23, 2026

STMicroelectronics: Securing and Recovering STM32C5 Devices with RDP Regression

PEmicro's development tools and production programmers support life-cycle management with readout protection (RDP) on STM32C5 devices. This article explains the STM32C5 security model and walks through provisioning regression passwords and performing RDP regression using PROGACMP and related PEmicro utilities.

Tool support note: PEmicro tools support OEMKEY-based RDP regression from RDP2 to RDP0. Boundary scan operations are not currently supported — this includes the BSKEY transition from RDP2 with boundary scan to RDP2, and OEMKEY regression from the RDP2 with boundary scan state. If you use PEmicro tools for life-cycle management, plan to transition directly between RDP0 and RDP2.

For background on STM32 families that support OEM-password RDP regression, see our earlier article on [STM32U-series RDP regression]. The STM32C5 workflow is similar, but there are important differences in RDP levels, key sizes, and tool configuration that are covered below.

STM32C5 Security Background

The STM32C5 series introduces a simplified but hardened product life cycle focused on secure boot and password-protected regression. Unlike many other STM32 families, the STM32C5 does not have an RDP level 1. The device operates in one of three readout protection states set by the RDP value in the FLASH_OPTSR option byte. The following states are listed below with their correlating RDP values:

RDP StateValueDebug Access
RDP0 (open)0xEDFull debug access
RDP2 with Boundary Scan0xD1Boundary scan only; OEMKEY can regress to RDP0 (not supported by PEmicro tools)
RDP2 (closed)0x72No debug access; OEMKEY can regress to RDP0 (supported by PEmicro tools)

The STM32C5 device supports two password keys, provisioned while the device is in RDP0:

  • OEMKEY (128 bits / 16 bytes): Required to perform regression from RDP2 back to RDP0. Regression triggers a full mass erase of device memory. This is the regression path supported by PEmicro tools.
  • BSKEY (32 bits / 4 bytes): Used by the device to transition from RDP2 with boundary scan to RDP2 (closing boundary scan access). Factory default is 0xAAAAAAAA if not customized in RDP0. PEmicro tools do not support this boundary scan transition.

Important warnings

  • Provision OEMKEY before closing the device. If RDP2 (or RDP2 with boundary scan) is set without first provisioning an OEMKEY, the device is permanently locked. Even STMicroelectronics cannot recover it.
  • Store keys securely. Once the device is in RDP2, the OEMKEY cannot be read back from the device — the `FLASH_OEMKEYR` registers always read as zero.
  • OEMKEY cannot be erased, only changed. After the first programming, OEMLOCK remains set permanently. The key can be reprogrammed in RDP0, but never cleared. To lock a device with no regression path, do not program an OEMKEY.
  • Regression always mass-erases flash — including write-protected pages — and resets security-related user options. SRAM is also erased.
  • Do not store secrets in OTP. The OTP area is preserved during regression, which means any secrets stored there become readable once the device returns to RDP0.
  • Invalid RDP option-byte values are interpreted as L2. A corrupt or incorrect RDP level in option bytes causes the device to behave as closed.
  • One unlock attempt per power cycle. Per RM0522, password-based unlocking can only be attempted once between power-on resets. Power-cycle before retrying after a failure.

For full technical details, refer to:

- [ST Wiki: How to set the RDP password keys and levels on STM32C5 MCUs]

- [ST Wiki: Getting started with STM32C5 security]

- [RM0522 STM32C5 Series Reference Manual] — Chapter 3, Product Life Cycle

How to Program the OEM Password with PEmicro Tools


Unlike the STM32CubeProgrammer approach described on the ST wiki, PEmicro tools configure the regression password through option bytes using a user options (`.OPT`) file.

Step 1: Load the option bytes algorithm

In PROGACMP, use CM (Choose Module) to load the option bytes algorithm for your target STM32C5 device.

Step 2: Create the user options file

Select CU (Create/modify user options file) to open the option bytes configuration window. Scroll to the security key registers for your device. On STM32C5, configure the OEMKEY registers (four 32-bit values comprising the 128-bit key).

The workflow is the same as for other STM32 families; the register names differ on STM32C5.

Enter your desired password values as hexadecimal register contents. For example, a 128-bit OEMKEY of 00112233445566778899AABBCCDDEEFF would be programmed across four 32-bit registers:

RegisterValue
OEMKEYR1[31:0]
0x00112233
OEMKEYR2[63:32]
0x44556677
OEMKEYR3[95:64]
0x8899AABB
OEMKEYR4[127:96]
0xCCDDEEFF

Save the configuration to a `.OPT` file.

The screenshot below shows the configuration window for the OEM1KEY, OEM2KEY, OEM3KEY, and OEM4KEY registers:

Step 3: Program the user options

1. Select SU (Specify user option files) and choose the `.OPT` file you created.

2. Select PU (Program User Options) to write the option bytes to the device.

3. Select LO (Launch Options) to load the configuration.

Note: `FLASH_OEMKEYR` and `FLASH_BSKEYR` always read as zero, so VU (Verify user options) cannot confirm the key values. 

Step 4: Set the RDP level

After setting and launching the OEMKEYS, the next step is to program the RDP level. Select CU (Create/modify user options file) again to create an RDP specific option byte configuration. Set the RDP value to 0x72 and save the new `.OPT` file. 

Repeat the same steps above to program the user options except with the RDP option bytes. Once the LO (Launch Options) command is run, the target will lose connection as it is now debug secured.

How to Regress the RDP Level with the OEM Password

Regression on STM32C5 is a single-step process: RDP2 → RDP0, conditioned on the correct OEMKEY and a full mass erase. This is simpler than the STM32U workflow, which may require an additional step to move from RDP level 1 to RDP level 0.

Configure security settings in the Connection Manager

To perform regression with PROGACMP:

1. Close PROGACMP completely and reopen it to return to the Connection Manager. This is required to access the security settings for regression.

2. In the Connection Manager, select your STM32C5 target device.

3. Open Security settings and enter the OEMKEY password (128-bit value) in the password field.

4. Enable the Mass erase upon connection to target checkbox. Regression performs a full flash mass erase, so this option must be selected.

Security settings with OEM key password and "Mass erase upon connection to target" enabled. Shown here on PROGACMP Connection Manager; the same security settings are available in the Cyclone Image Creation Utility Power & Communications tab when STM32C5 is selected. For SAP images, the STM32C5 target only needs a power on reset to proceed with the regression.

Connect to perform regression

With the security settings and mass erase option configured, connect to the target under reset (or run a SAP image with the same settings on a Cyclone programmer). Per RM0522, the 128-bit OEMKEY is shifted through JTAG/SWD under reset as four 32-bit words into the debug authentication register. Upon a successful connection with the correct key, hardware launches the regression sequence and flash memory is mass-erased.

On STM32C5, no additional user commands are needed after connection — the regression from RDP2 to RDP0 completes in a single step when the OEMKEY is correct. Apply a power-on reset after successful regression (cycle VDD off and on) before further debug or programming operations, as required by RM0522. If there is a failure connecting with to the target (i.e. $0007 error), then perform a power-on reset before retrying the regression.

Using Cyclone Image Creation Utility

For production programming with a Cyclone, the same security settings apply on the Power and Communication tab of the Image Creation Utility:

1. Select the STM32C5 target device.

2. Open Security settings and enter the OEMKEY password.

3. Enable Mass erase upon connection to target.

4. Build and run the SAP image.

Troubleshooting

If regression fails for any reason:

  • Power-cycle the target device (remove and reapply power).
  • Verify the OEMKEY password is correct — the full 128-bit value must match what was provisioned in RDP0.
  • Confirm Mass erase upon connection to target is enabled.
  • Close and reopen PROGACMP to ensure the Connection Manager security settings are applied fresh.
  • Retry the connection.

If regression continues to fail, double-check that the OEMKEY was provisioned before the device was set to RDP2. A device closed to RDP2 without a provisioned OEMKEY cannot be recovered.

Summary

Task PEmicro Tool / CommandKey Requirement
Provision OEMKEYCU → SU → PU → LODevice must be in RDP0
Set RDP levelRP (Read Protection)— 
Regress RDP2 → RDP0Connection Manager security settings + connect under resetCorrect OEMKEY, mass erase enabled
After successful regressionPower-on reset targetRequired by RM0522 before further use
Recover from failed attemptPower-cycle target then retryOne unlock attempt per power cycle

PEmicro tools provide a workflow for STM32C5 life-cycle management — from provisioning the OEMKEY regression password through option bytes, to closing the device at RDP2, to recovering it with password-protected regression from RDP2 to RDP0 — without requiring STM32CubeProgrammer. Boundary scan life-cycle operations are outside the scope of PEmicro tool support.

References

- [PEmicro Blog: STM32U RDP Regression (post 374)]

- [ST Wiki: RDP password and regression on STM32C5]

- [ST Wiki: Getting started with STM32C5 security]

- [RM0522 — STM32C5 Series Reference Manual (PDF)]

Tags related to this Blog Post

Device Support     STMicroelectronics