STMicroelectronics / STM32CubeF7

STM32Cube MCU Full Package for the STM32F7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
331 stars 193 forks source link

Spontaneous setting of RDP 1 after reset when saving option bytes #96

Closed KamilDuljas closed 1 year ago

KamilDuljas commented 1 year ago

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)
  {}
}
TOUNSTM commented 1 year ago

Hello @KamilDuljas,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With regards,

TOUNSTM commented 1 year ago

Hello @KamilDuljas,

Thank you again for your contribution.

Regarding the point for which you opened the issue, this is a normal behavior due to a failure of option byte programming following reset during the option byte change sequence. Upon an option byte programming failure for any reason, mismatched values of the option bytes are loaded after reset. Those mismatched values force a secure configuration that might permanently lock the device. To prevent this, only program the option bytes in a safe environment – safe supply, no pending watchdog, and clean reset line.

Please let me know if you still need help. Thank you again for your report.

With Regards,