cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the STM32C5 with Segger J-Link

Maxime_BELAVAL
ST Employee

Summary

This article provides a step-by-step guide explaining how to transition a development setup from STM32C5 + ST-LINK to STM32C5 + Segger J-Link. It focuses on the complete RDP life cycle and including RDP regression with password based on OEM keys.

This guide also showcases the setup for the NUCLEO-C542RC, NUCLEO-C562RE, and NUCLEO-C5A3ZG boards.

image 1.png

Introduction

Hello developer, and welcome to this article. If you’re working with STM32C5 and planning to move from an ST-LINK–based setup to a J-Link–based setup, this article is for you! Here, we guide you through the full RDP life cycle, including OEMKEY provisioning, flashing your binary image, closing the chip, and finally performing the password-based RDP regression.

This article assumes prior knowledge of STM32C5 security. All these prerequisites are covered in the STM32C5 security wiki using STM32CubeProgrammer and the STLINK interface: How to set the RDP password keys and levels on STM32C5 MCUs 

This article complements the wiki by focusing on the J-Link–based workflow and the specific steps required to manage RDP and OEM keys:

  • Software prerequisites
  • Setting up the Nucleo board with the Segger J-Link probe (default state: RDP Level 0)
  • Provisioning the regression password key (OEMKEY)
  • Verifying the OEMKEY (new C5 feature, available in RDP level 0)
  • Programming the binary image
  • Closing the chip: transition from RDP level 0 to RDP level 2
  • Performing the regression from RDP level 2 to RDP level 0

 

1. Software prerequisites

The Segger J-Link software version 9.32 or later is required.

You can download the J-Link software here: https://www.segger.com/downloads/jlink/ 

The J-Link software package contains several utilities. Two of them are used in this article:

 

2. Setting up the Nucleo board with the Segger J-Link probe

On an STLINK setup, both powering the board and debug signals are provided through the STLINK connector.

On a J-Link setup, that is, with an external probe, the debug signals are available through the "External Debug Interface" of the board. Its power supply remains available through the STLINK interface with the 5V selector jumper set to STLINK.

The next three sections showcase the setup for the following boards:

  • NUCLEO-C542RC
  • NUCLEO-C562RE
  • NUCLEO-C5A3ZG

2.1 NUCLEO-C542RC setup

https://www.st.com/resource/en/schematic_pack/mb2213-c542rc-b02-schematic.pdf

image 2.pngimage 3.jpgimage 4 - editedv2.png

2.2 NUCLEO-C562RE setup

https://www.st.com/resource/en/schematic_pack/mb2213-c562re-b02-schematic.pdf

image 5.pngimage 6.pngimage 7 - edited v2.png

2.3 NUCLEO-C5A3ZG setup

https://www.st.com/resource/en/schematic_pack/mb2213-c562re-b02-schematic.pdf

image 8.pngimage 9.jpgimage 10 edited.png

Note: Ensure that the MIPI‑20 ribbon cable is correctly oriented: the keyed notch on the connector must align with the key on the board header. Refer to the arrow at the bottom of the picture.

3. Provisioning the regression password key

Once our setup is functional, the first thing to do is to provision the OEMKEY.

The OEMKEY has a 128-bit length (16 bytes).

In this article, the key used is: 00112233445566778899AABBCCDDEEFF.

Important note:

  • If the RDP level 2 is set without provisioning the OEMKEY, the device remains locked in the RDP level 2 state.
  • It is impossible to retrieve the regression OEMKEY in RDP level 2, so make sure to store this key safely and do not lose it.

image 11.png

For all STM32C5 devices, the provisioning command to be executed is the same:

DevPro.exe -operation SetOEMKEY -SetConfigVal "Key=00112233445566778899AABBCCDDEEFF" -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32C5.pex

Log output:

image 12.png

4. Verifying the OEMKEY

For all STM32C5 devices, the verify command to be executed is the same:

DevPro.exe -operation VerifyOEMKEY -SetConfigVal "Key=00112233445566778899AABBCCDDEEFF" -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32C5.pex

Log output if successful:

image 13.png

Log output if the key is not the one provisioned:

image 14.png

5. Programming the binary image

To program our binary image, we use a .jlink file, named “flash_c5.jlink” that contains all the information needed by J-Link Commander.

The content of this file is:

loadfile C5-Software.bin, 0x08000000
Reset
Go
Exit

 

The available options are all here: https://kb.segger.com/J-Link_Commander#Commands

  • Reset performs a reset of the CPU.
  • Go starts the CPU if it was halted.
  • Exit closes the J-Link connection, allowing us to execute the next command.

5.1 Programming the NUCLEO-C542RC

Execute the following command:

JLink.exe -device STM32C542RC -if SWD -speed 4000 -autoconnect 1 -CommandFile flash_c5.jlink

5.2 Programming the NUCLEO-C562RE

Execute the following command:

JLink.exe -device STM32C562RE -if SWD -speed 4000 -autoconnect 1 -CommandFile flash_c5.jlink

5.3 Programming the NUCLEO-C5A3ZG

Execute the following command:

JLink.exe -device STM32C5A3ZG -if SWD -speed 4000 -autoconnect 1 -CommandFile flash_c5.jlink

Log output:

image 15.pngimage 16.png

6. Closing the chip: transition from RDP level 0 to RDP level 2

For all STM32C5 devices, the lock command to be executed to set the RDP level to 2 is the same:

DevPro.exe -operation SetRDP -SetConfigVal “Level=RDP2” -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32C5.pex

Important note:

  • If the RDP level 2 is set without provisioning the OEMKEY, the device remains locked in the RDP level 2 state.
  • It is impossible to retrieve the regression OEMKEY in RDP level 2, so make sure to store this key safely and do not lose it.

Log output:

image 17.png

7. Performing the regression from RDP level 2 to RDP level 0

In this article, the key used is: 00112233445566778899AABBCCDDEEFF.

For all STM32C5 devices, the unlock command to be executed to perform the RDP regression from Level 2 to Level 0 is the same:

DevPro.exe -operation Unlock -SetConfigVal "Key=00112233445566778899AABBCCDDEEFF" -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32C5.pex

Important note:

  • The regression performs a mass erase of the chip.
  • After closing the chip, before executing the Unlock command, you must perform a power-off/power-on cycle to ensure that the regression completes successfully.

Log output when successful:

image 18.png

Log output when the key is correct but a power-off / power-on cycle is missing:

image 19.png

Related links

 

Version history
Last update:
‎2026-04-09 8:07 AM
Updated by: