MCU crashes after using HAL_OB function.
I have tried the HAL_OB function.
No change was good.
So I ran the code below.
After that, ST LINK connection is not possible.
MCU is not responding.
Is there no way to get it back?
MCU : STM32G07x
CODE :
FLASH_OBProgramInitTypeDef OBInit;
if(HAL_FLASH_Unlock() == HAL_OK)
{
if(HAL_FLASH_OB_Unlock() == HAL_OK)
{
PRINT("HAL_FLASH_OB_Unlock OK\r\n");
OBInit.OptionType = OPTIONBYTE_USER;
// OBInit.USERType = OB_USER_nRST_STDBY|OB_USER_IWDG_STOP|OB_USER_nRST_STOP;
OBInit.USERType = OB_USER_ALL;
OBInit.USERConfig = 0;
PRINT("HAL_FLASH_Unlock OK\r\n");
HAL_FLASHEx_OBProgram(&OBInit);
if(HAL_FLASH_OB_Lock() == HAL_OK)
{
HAL_FLASH_Lock();
HAL_FLASH_OB_Launch();
}
else
PRINT("HAL_FLASH_OB_Lock ERROR\r\n");
}
else
PRINT("HAL_FLASH_OB_Unlock ERROR\r\n");
}
else
PRINT("HAL_FLASH_Unlock ERROR\r\n");
