Skip to main content
DXu.4
Associate
Apr 26, 2023 5:46 AM UTC
Question

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

..

This topic has been closed for replies.

5 replies

Peter BENSCH
ST Technical Moderator
Apr 26, 2023 7:12 AM UTC

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
DXu.4Author
Associate
Apr 26, 2023 7:38 AM UTC

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?

waclawek.jan
Super User
Apr 26, 2023 8:42 AM UTC

How did you set the remaining option bytes?

JW

DXu.4
DXu.4Author
Associate
Apr 26, 2023 9:51 AM UTC

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

}

waclawek.jan
Super User
Apr 27, 2023 1:12 AM UTC

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