cancel
Showing results for 
Search instead for 
Did you mean: 

MCU型�?�是STM32G061F8Y6TR,代�?中option byte设值为读写�?护,多次烧录�?�MCU无法连接,请问这个问题有什么解决方法?

DXu.4
Associate II
 
5 REPLIES 5
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
DXu.4
Associate II

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?

How did you set the remaining option bytes?

JW

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();

}

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