Showing results for 
Search instead for 
Did you mean: 

after change the RDP of FLASH from lv0 to lv1, the target could not be detected on NUCLEO-C031C6

Associate II


as mentions on title,

my target board is NUCLEO-C031C6. and I change the read protection level of flash from 0 to 1(0xAA to 0xBB) by STM32CubeProgrammer.

after that, the target board can not be connect any more.(keil c/ cubeMX/ cubeProgrammer/ ST-Link Utility...)

the error message is as below:



I have read related issues on forums and tried some methods from forum, change [reset mode], [mode], or hold reset button and release followed by click [connect]...!

however that doesn't seem to be helpful for my situation.

any other advice will be very appreciate,



ST Employee

Hello @bvd ,


Normally on RDP level 1 the debug port should be available. However do you know if you configure other option byte like boot_lock ? 





hello Simon:

thanks so much for replying.

about "However do you know if you configure other option byte like boot_lock ?"...maybe!

I just selected [0xBB](level_1) and then click [APPLY]...on STM32CubeProgrammer.

after reconnect power, the board can not be connect any more as previous mention...

I can not check the values of register without connecting...

is there any way to recover ?

thanks very much!!


Hello @bvd ,


I'm asking this detail, because if you put RDP level 1 and boot_lock in the same time, the debug capability will be disabled and the device locked. 

Can you try to connect the product through the Cube Programmer power down option ?:


Best regards,




hello Simon:

I have try (hot plug/ normal/ under reset/ power down) mode, it still not work,...the target can not be detected and show message as below:


the only different is when I click [Connect] on power down mode, the error message appears 1 sec slower than other modes.

thanks so much ~

Associate III

I found this thread by searching. Is there any way to recover the board?

I wrote BOOT_LOCK and RDP level1 at same time. Now I'm unable to connect to nucleo board.

RM doc mentioned that it's possible to reset it back. But now I can't even connect to it using STM32CubeProgrammer.






i am sorry, this issue still exists, i can't do anything without connecting the mcu.

Associate III

Hi @bvd , so sorry the hear that, after so many months without solution


I think ST should be able to duplicate the problem since we're using same NUCLEO-C031C6 board.

Just now I tried on my own PCBA with STM32C031K6. Same thing happen. All possible connection modes tried, but all failed to connect (hot plug/normal/under reset/power down).


Below is the steps. Attached is the logs (using CLI commands):

1. Read option byte ( stm32_programmer_cli -c port=SWD freq=8000 mode=UR -ob displ )
2. Set boot lock ( stm32_programmer_cli -c port=SWD freq=8000 mode=UR -ob BOOT_LOCK=0x1 )
3. Read option byte ( stm32_programmer_cli -c port=SWD freq=8000 mode=UR -ob displ )
4. Set RPD to level 1 ( stm32_programmer_cli -c port=SWD freq=8000 mode=UR -ob RDP=0xBB ) --------------->>>>>>>>>>> FAILED
5. Read option byte ( stm32_programmer_cli -c port=SWD freq=8000 mode=UR -ob displ )


ST Employee



To lose debug capability when the RDP level 1 is set in association of BOOT_LOCK is the normal behavior.

This behavior is described in the FLASH security register (FLASH_SECR) page 78 via a caution note: 


After setting RDP level 1 and boot lock, re-enabling of debug capabilities is possible only by setting the DBG_SWEN bit by the application code.


Best regards,




Hello @FArdi.1 ,

BOOT_LOCK=0x1 and RDP=0xBB, as stated in the reference manual
3.7.13 FLASH security register (FLASH_SECR)
Caution: If the bit is set in association with RDP level 1, the debug capabilities are disabled,
except in the case of a bad OBL (mismatch).


So you will not able to connect, except if  you re-enable  the debug link in your code.

For example on button press :  

void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin) {

//This will reopen the debug




Then you can connect in hotplug mode and do a regression
stm32_programmer_cli -c port=SWD freq=8000 mode=hotplug -ob RDP=0xAA BOOT_LOCK=0
Take care any trial to connect a part in RDP1 will lock the flash and will request a power cycle to have the embedded software running again.