Skip to main content
DXu.4
Associate
April 26, 2023
Question

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

  • April 26, 2023
  • 4 replies
  • 1651 views

..

This topic has been closed for replies.

4 replies

Peter BENSCH
Technical Moderator
April 26, 2023

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

DXu.4
DXu.4Author
Associate
April 26, 2023

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
April 26, 2023

How did you set the remaining option bytes?

JW

DXu.4
DXu.4Author
Associate
April 26, 2023

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
April 27, 2023

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