Showing results for 
Search instead for 
Did you mean: 

STM32F429 is stuck during applying RDP-1 if the user press reset button multiple times



I have the following problem with STM32F429ZI: When applying RDP level 1 protection, the board gets stuck if I press the reset button. More precisely, I can see from STM32CubeProgrammer that SPRMOD and BFB2 bits have risen and that the value of RDP becomes FF (not “55�? as I would expect for RDP level 1). The only way to make the board work again is to apply RDP level 0 manually using STM32CubeProgrammer.

To reproduce the error, download the “UART_Printf�? example for the STM32F429ZI-Nucleo (from Github STMicroelectronics/STM32CubeF4, unfortunately, I can not add the links) and modify main.c like this:

void TurnOnRDP() {
   FLASH_OBProgramInitTypeDef obConfig;
   if (obConfig.RDPLevel == OB_RDP_LEVEL_0) {
     printf("\n\r Applying RDP-1");
     // this is first time we run mcu after flashing firmware
     obConfig.RDPLevel = OB_RDP_LEVEL_1;
int main(void)
  /* STM32F4xx HAL library initialization:
     - Configure the Flash prefetch
     - Systick timer is configured by default as source of time base, but user 
      can eventually implement his proper time base source (a general purpose 
      timer for example or other time source), keeping in mind that Time base 
      duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
      handled in milliseconds basis.
     - Set NVIC Group Priority to 4
     - Low Level Initialization
  /* Configure the system clock to 180 MHz */
  /* Initialize BSP Led for LED2 */
  /*##-1- Configure the UART peripheral ######################################*/
  /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
  /* UART configured as follows:
    - Word Length = 8 Bits (7 data bit + 1 parity bit) : 
	          BE CAREFUL : Program 7 data bits + 1 parity bit in PC HyperTerminal
    - Stop Bit   = One Stop bit
    - Parity    = ODD parity
    - BaudRate   = 9600 baud
    - Hardware flow control disabled (RTS and CTS signals) */
  UartHandle.Instance     = USARTx;
  UartHandle.Init.BaudRate   = 115200;
  UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
  UartHandle.Init.StopBits   = UART_STOPBITS_1;
  UartHandle.Init.Parity    = UART_PARITY_NONE;
  UartHandle.Init.HwFlowCtl  = UART_HWCONTROL_NONE;
  UartHandle.Init.Mode     = UART_MODE_RX | UART_MODE_TX;
  if (HAL_UART_Init(&UartHandle) != HAL_OK)
   /* Initialization Error */
  /* Output a message on Hyperterminal using printf function */
  printf("\n\r UART Printf Example: retarget the C library printf function to the UART\n\r");
  printf("** Test finished successfully. ** \n\r");
  /* Infinite loop */
  while (1)

Then, program the board using STM32CubeProgrammer making sure “run after programming�? is not set. Then, click the reset button repeatedly very fast: the first reset will start the software execution, one of the other resets should happen when RDP level 1 is being applied, which results in the issue described above. 

ST Employee

Hello @sergei.nabatov​ and welcome to the Community 🙂,

According to the Google drive attached at this video, once we program the option byte RDP1, any execution from FLASH will be seen as an intrusion and FLASH will be locked.

So, the solution is described in the video.



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


Thank you for the answer, but unfortunately, I was able to reproduce the same error with this fix too.

My point was to put in place "the protection from the fool" meaning that if he presses the reset button multiple times during the application RDP-1, it won't fall into an error and block the board.

It looks like there's no good reliable solution for F4. The F4 family is very old, no improvement can be expected for it.

Just avoid the situation when the MCU resets before the firmware is fully configured.

After installing or updating, check the state ASAP and fix if needed.

Keep fools away from this process (discuss with your legal advisor how to do this).

/* Patient: Doctor, when I do this, it pains!

Doctor: Don't do this! */