Skip to main content
Senior III
June 2, 2023
Solved

Spontaneous setting of RDP 1 after reset when saving option bytes

  • June 2, 2023
  • 4 replies
  • 1705 views

Board: Nucleo-f756ZG and Nucleo-F767ZI

When i reset quickly board using reset button during execute below code, The board set RDP protection Level 1.

Below code contains only rootcause. I know that is not correct usage (missing OB lock, wait for busy flag etc) but i have an application that using 

FLASH->OPTCR |= FLASH_OPTCR_OPTSTRT

 and after quick 

reset

 few times, the application freezed (like after changed RDP). I checked the board using STM32CubeProgrammer and the board have set RDP level 1 after this case.

Larger gaps (above 1 second) between resets do not cause this problem.

My code:

int main(void)

{

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */

HAL_Init();

/* Configure the system clock */

SystemClock_Config();

BSP_LED_Init(LED_GREEN);

BSP_LED_On(LED_GREEN);

HAL_FLASH_OB_Unlock();

FLASH->OPTCR |= FLASH_OPTCR_OPTSTRT;

while (1)

{}

}

I also created issue on github F7:

Spontaneous setting of RDP 1 after reset when saving option bytes · Issue #96 · STMicroelectronics/STM32CubeF7 · GitHub

This topic has been closed for replies.
Best answer by STOne-32

Dear @Kamil Duljas​ ,

Writing to Options bytes is an operation of Erase/Program to embedded flash memory and should be done properly and safely, having a system reset or power down during that operation phase may lead to improper programming in the non-volatile memory and in this case the RDP byte is set to an unknowing data and so RDP1 is activated. this is a normal behavior . Hope it helps you.

Cheers

4 replies

STOne-32
STOne-32Best answer
ST Technical Moderator
June 4, 2023

Dear @Kamil Duljas​ ,

Writing to Options bytes is an operation of Erase/Program to embedded flash memory and should be done properly and safely, having a system reset or power down during that operation phase may lead to improper programming in the non-volatile memory and in this case the RDP byte is set to an unknowing data and so RDP1 is activated. this is a normal behavior . Hope it helps you.

Cheers

Pavel A.
June 4, 2023

@STOne-32​ But this is not deliberate? Say, as a counter-measure against assumed hardware attack to read-out the firmware?

STOne-32
ST Technical Moderator
June 5, 2023

Dear @kamil Duljas​ 

Here it is in STM32F7 Reference Manual


_legacyfs_online_stmicro_images_0693W00000dK21WQAS.pngIt would be interesting to read the content of the RDP byte and see its value : 0x00 , 0xFF or any other value in your case. Hope it helps you