Flash RDP activate
Hello everyone,
I have board and I used STM32G071 MCU on this board. I want to activate RDP Level 1. There is my code:
Hello everyone,
I have board and I used STM32G071 MCU on this board. I want to activate RDP Level 1. There is my code:
Hello
Try to disable Prefech before programming your OB.
Please refer to my test code :
FLASH_OBProgramInitTypeDef OptionsBytesInit= {0};
HAL_RCC_DeInit();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
__disable_irq();
__HAL_FLASH_PREFETCH_BUFFER_DISABLE();
/* Unlock Flash Control register and Option Bytes */
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
HAL_FLASHEx_OBGetConfig(&OptionsBytesInit);
if(OptionsBytesInit.RDPLevel!=OB_RDP_LEVEL_1){
/* First step: Choose option byte type.*/
OptionsBytesInit.OptionType =OPTIONBYTE_RDP;
OptionsBytesInit.RDPLevel = OB_RDP_LEVEL_1;
/* Program Option Bytes */
HAL_FLASHEx_OBProgram(&OptionsBytesInit);
/* Launch Option Bytes Loading */
HAL_FLASH_OB_Launch();
Regards
DianeP
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.