cancel
Showing results for 
Search instead for 
Did you mean: 

Spontaneous setting of RDP 1 after reset when saving option bytes

Kamil Duljas
Senior III

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

Dudo
1 ACCEPTED SOLUTION

Accepted Solutions
STOne-32
ST Employee

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

View solution in original post

4 REPLIES 4
STOne-32
ST Employee

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

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

@STOne-32​  Could you point me any document/note/manual about this behaviour? I can't find any information about this.

Dudo
STOne-32
ST Employee

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