2020-04-08 10:51 PM
Hello,
I have a PCB with STM32F427, since a few days, I am having more and more problems with the MCU.
As stated in the title, every morning when I restart my board it is locked with RDP level 1, PCROP and R/W protection on all sectors, as stated in the option byte value (seems to have been reset...).
The embedded program modifies option bytes, but safely (I think ?) :
if ((((*(__IO uint32_t*)OPTCR_BYTE0_ADDRESS) & 0xFFFFFFFE) != (uint32_t)0x4FFFAAEC) || (*(__IO uint32_t*)OPTCR1_BYTE0_ADDRESS != (uint32_t)(0x0FFF0000))) {
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
*(__IO uint32_t*)OPTCR_BYTE0_ADDRESS = (uint32_t)0x4FFFAAEC;
*(__IO uint32_t*)OPTCR1_BYTE0_ADDRESS = (uint32_t)(0x0FFF0000;
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
}
And yesterday, it was suddenly also impossible to debug (I use openocd and stlinkV2 cut from a Nucleo board).
And also, I have to keep the board powered off for some hours before being able to modify option byte (using STLink Utility), otherwise the option byte setting takes much time then fails.
Any help appreciated, I do not understand the possible reason for these difficulties...