2016-08-01 11:27 PM
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 #!stm32f42016-08-09 08:15 AM
Hi akbari.hiren,
Is it possible for you to check the same using another board? Do you have the same behavior?-Mayla-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.
2016-08-22 09:28 PM
Hi akbari.hiren ,
Did you get any solution to your problem , cause i am also facing the similar problem.In spite of trying with 5 stm32f446 boards the problem is still persisting.2016-08-23 08:20 AM
Do you cycle the power?
Suggest you create a monitor/terminal type application to communicate from the STM32 to understand its internal state and be able to get it into and out of RDP levels interactively. You'll probably want to do this via a USART, and experiment until you are comfortable with how it all works.2016-08-23 08:26 AM
Hi agle.uday,
Please note that you have to perform a power on reset to be able to run the application when the device is protected with RDP level1. In fact, no debugger should be connected to the target.Try this way and let me know if it is OK.-Mayla-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.
2016-09-13 02:35 AM
Why should one cycle the power after RDP level 1 is set? I need a code to set the RDP 1 on first start, then self reset and run. Calling NVIC_SystemReset() causes it to hang, I tried also WD but no go - just hangs and does not start again. Is there a way to overcome this?
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
2018-05-07 01:03 PM
Ran into the very same problem recently with an STM32F303.
Its reference manual mentions:
'
If the read protection is set while the debugger is still connected through JTAG/SWD, apply a POR (power-on reset) instead of a system reset.
'The solution is therefore to turn off the power to the STM32, and then turn it back on. Your firmware will then run just as well as before.