2021-06-03 06:39 AM
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");
Solved! Go to Solution.
2021-06-03 07:14 AM
Try connecting under reset, or connecting with BOOT0 held high. Probably your code is crashing shortly after the code starts and is causing connection issues with the debugger.
Locking prior to calling HAL_FLASH_OB_Launch will stop the function from working.
2021-06-03 07:14 AM
Try connecting under reset, or connecting with BOOT0 held high. Probably your code is crashing shortly after the code starts and is causing connection issues with the debugger.
Locking prior to calling HAL_FLASH_OB_Launch will stop the function from working.