2023-06-02 06:00 AM
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:
Solved! Go to Solution.
2023-06-04 07:13 AM
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
2023-06-04 07:13 AM
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
2023-06-04 08:31 AM
@STOne-32 But this is not deliberate? Say, as a counter-measure against assumed hardware attack to read-out the firmware?
2023-06-04 08:36 AM
@STOne-32 Could you point me any document/note/manual about this behaviour? I can't find any information about this.
2023-06-05 05:03 AM - edited 2023-11-20 04:06 AM
Dear @kamil Duljas
Here it is in STM32F7 Reference Manual
It 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