2020-12-11 11:44 AM
void Set_Option_Byte( void )
{
FLASH_OBProgramInitTypeDef OBInit;
/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
/* Clear OPTVERR bit set on virgin samples */
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
/* Unlock the Options Bytes *************************************************/
HAL_FLASH_OB_Unlock();
OBInit.OptionType = OPTIONBYTE_USER;
OBInit.UserType = OB_USER_IWDG_STOP;
OBInit.UserConfig = OB_IWDG_STOP_FREEZE;
HAL_FLASHEx_OBProgram(&OBInit);
/* Start the Option Bytes programming process */
if (HAL_FLASH_OB_Launch() != HAL_OK)
{
/* User can add here some code to deal with this error */
while (1)
{
}
}
/* Prevent Access to option bytes sector */
HAL_FLASH_OB_Lock();
/* Disable the Flash option control register access (recommended to protect the option Bytes against possible unwanted operations) */
HAL_FLASH_Lock();
}
Note: I had forgot to call HAL_FLASHEx_OBGetConfig(&OBInit); thus OBInit might have few members uninitialized. How I can recover WB55 board.
2020-12-12 03:42 PM
hello.
"Error: Data read failed" >> what gives this error?
Run StLink utility and try to manipulate the option bytes from the utility.
2020-12-13 09:27 PM
STM32 Cube Programmer Utility :
Snapshot of Error STM32 Cube Programmer : Connect event
I am able to read option bytes:
But I am not able to erase or download
2020-12-13 11:06 PM
STLink Utility :
Able to connect but getting read error :
I am able to read option bytes :
Error in erase and download :