after read out protection stm32f4xx stop working
i am using stm32f429 development board and st-link debugger and keil uvision for firmware writing. (for programming i use both st-link utility and keil).
My code is working fine untill i set read out protection(ROP) in option byte at level-1. As soon as i set ROP to level-1 code don't work anymore not even on board LEDs.
After that if i set ROP to level-0 back and reprogram my board it works correctly without any problem at level-0.
Itried to set ROP level in st-link utility. but didn't worked. then i write it in my firmware to do the same, but still it is not working. Below is my code.
//**************** optionbyte set code for stm32f4xx
FLASH_OBProgramInitTypeDef pObStruct;
HAL_StatusTypeDef status;
send(''Locking process initialized'');
HAL_FLASH_Unlock();
send(''Flash unlock done'');
HAL_FLASH_OB_Unlock();
send(''Option bytes unlock done'');
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGAERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGPERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGSERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_BSY);
send(''all flgs are cleared'');
HAL_FLASHEx_OBGetConfig(&pObStruct);
if (pObStruct.RDPLevel == OB_RDP_LEVEL0)
{
send(''RDP level 0 found'');
pObStruct.OptionType = OPTIONBYTE_RDP;
pObStruct.RDPLevel = OB_RDP_LEVEL1;
send(''set level-1 process initialized'');
status = HAL_FLASHEx_OBProgram(&pObStruct);
send(''RDP memory flags updated'');
if(status == HAL_OK)
{
LED_YELLOW_ON;
send(''Optionbyte launch process initiated for RDP change'');
HAL_FLASH_OB_Launch();
send(''Optionbyte sucessfully launched'');
HAL_FLASH_OB_Lock();
send(''Option byte locked'');
HAL_FLASH_Lock();
send(''Flash locked'');
LED_YELLOW_OFF;
send(''System reset initialized'');
NVIC_SystemReset();
send(''blank check'');
LED_RED_OFF;
}
}
/
/************ and this is the result in hyperterminal
controller is initialized
Locking process initialized
Flash unlock done
Option bytes unlock done
all flgs are cleared
RDP level 0 found
set level-1 process initialized
RDP memory flags updated
Optionbyte launch process initiated for RDP change
After this nothing happen ...and if i press reset button nothing happens, nothing received on hyperterminal. after this if i check in st-link software's option byte menu, it shows RDP level is 1.
My objective is to make read out protection so no one can read my code using st-link or from flash code whatever works.
Please let me know if any other information is require. Thank you.
i am using stm32f429 development board and st-link debugger and keil uvision for firmware writing. (for programming i use both st-link utility and keil).
My code is working fine untill i set read out protection(ROP) in option byte at level-1. As soon as i set ROP to level-1 code don't work anymore not even on board LEDs.
After that if i set ROP to level-0 back and reprogram my board it works correctly without any problem at level-0.
I tried to set ROP level in st-link utility. but didn't worked. then i write it in my firmware to do the same, but still it is not working. Below is my code.
//**************** optionbyte set code for stm32f4xx
i am using stm32f429 development board and st-link debugger and keil uvision for firmware writing. (for programming i use both st-link utility and keil).
My code is working fine untill i set read out protection(ROP) in option byte at level-1. As soon as i set ROP to level-1 code don't work anymore not even on board LEDs.
After that if i set ROP to level-0 back and reprogram my board it works correctly without any problem at level-0.
I tried to set ROP level in st-link utility. but didn't worked. then i write it in my firmware to do the same, but still it is not working. Below is my code.
//**************** optionbyte set code for stm32f4xx
i am using stm32f429 development board and st-link debugger and keil uvision for firmware writing. (for programming i use both st-link utility and keil).
My code is working fine untill i set read out protection(ROP) in option byte at level-1. As soon as i set ROP to level-1 code don't work anymore not even on board LEDs.
After that if i set ROP to level-0 back and reprogram my board it works correctly without any problem at level-0.
I tried to set ROP level in st-link utility. but didn't worked. then i write it in my firmware to do the same, but still it is not working. Below is my code.
//**************** optionbyte set code for stm32f4xx
#keil #!stm32 #!stm32f4-disco #!stm32f4