2023-04-25 10:46 PM
2023-04-26 12:12 AM
Welcome, @DXu.4, to the community!
I've translated your question with a web-based translation tool to increase the chances that you will get an answer from our experts and community members, as the majority communicate in English:
The MCU model is STM32G061F8Y6TR, the option byte in the code is set to read/write protected, and the MCU cannot be connected after repeated burning, what is the solution to this problem?
Well, if you have the option bytes set to RDP Level 2, it's a one-way street and no one can
can do anything about it. You will find more details in RM0444, e.g. section 3.5.1.
Does it answer your question?
Regards
/Peter
2023-04-26 12:38 AM
Well, if you have the option bytes set to RDP Level 2, it's a one-way street and no one can
can do anything about it. You will find more details in RM0444, e.g. section 3.5.1.
Thank you for your reply.
I have had the option bytes set to RDP Level 1,after burning again and again,the burning tool cannot contact with MCU.I cannot do anything with it and have to replace the MCU to a new one.
How can I do instead of replacing to a new one?
2023-04-26 01:42 AM
How did you set the remaining option bytes?
JW
2023-04-26 02:51 AM
void Flash_EnableReadProtection(void)
{
FLASH_OBProgramInitTypeDef OBInit;
__HAL_FLASH_PREFETCH_BUFFER_DISABLE();
HAL_FLASHEx_OBGetConfig(&OBInit);
if(OBInit.RDPLevel == OB_RDP_LEVEL_0)
{
OBInit.OptionType = OPTIONBYTE_RDP;
OBInit.RDPLevel = OB_RDP_LEVEL_1;
HAL_FLASH_Unlock();
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
HAL_FLASH_OB_Unlock();
HAL_FLASHEx_OBProgram(&OBInit);
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
}
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
}
2023-04-26 06:12 PM
OK so this should have left all other option bytes as they were previously.
So now the question is, did you change BOOT_LOCK previously?
JW