Skip to main content
Associate II
December 10, 2025
Question

Prevent manual power cycle after updating with RDP level 1

  • December 10, 2025
  • 1 reply
  • 498 views

Hi,

I am currently trying to update my STM32L433 on my custom board and I am having some issues with the RDP level 1.

When receiving the blank boards (not programmed yet), I use a RPI with OpenOCD and a JTag to update the chip. When I set the RDP level 1, I can't seem to find a way to restart the device with having to do a manual power cycle. I am missing something?

This is what I do :

init
reset init
stm32l4x mass_erase 0
sleep 50
flash write_image "$name"
sleep 50
reset run

After first programming, I am trying to update through USB dfu using a custom application in C# based on CubeProgrammerApi. I am able to boot the device in the Bootloader (I have control over the Boot0 and Reset pins), to connect to it, remove the readout protection (using connectDfuBootloader2) and flash the new firmware.

I am unable after that to set the readout protection using sendOptionBytesCmd("-ob rdp=0xbb") (gives me an error) and if I set it in the application itself, my STM32 cannot restart unless I do a manual power cycle...

Is there a solution that I am missing to prevent having to do a manual power cycle?

Thank you.

1 reply

antoinejAuthor
Associate II
December 10, 2025

Sorry, this is what I actually do with OpenOCD :

init
reset init
stm32l4x mass_erase 0
sleep 50
flash write_image "$name"
sleep 50

stm32l4x lock 0
reset run

 

Also stm32l4x unlock 0 does not seem to work.

Bob S
Super User
December 10, 2025

Setting RDP level to non-zero via the SWD/JTAG interface will always require a power cycle.  There is a note to this effect in the reference manual.  The old RM0394 that I have (revision 4, for L41xxx/42xxx/43xxx, etc.) has only a short mention of this in section 3.5.1.  The F4 reference manual makes it more obvious.

antoinejAuthor
Associate II
December 11, 2025

What about when doing it from USB bootloader with CubeProgrammerApi?

I can see here that : If the read protection is programmed by software (executing from SRAM), perform a POR to
reload the option byte and clear the detected intrusion. This can be done with a transition
Standby mode followed by a wake-up.

 

How can I do this Standby mode and wake-up? Can I do it without a full POR?