‎2019-12-12 01:18 AM
here's my code for RDPprotection:
void Flash_SetRDPLevel(uint8_t ReadProtectLevel) //level 1 (0xBB)
{
uint32_t tmp_reg;
Unlock();
OB_unlock();
/* Read RDP level bits */
tmp_reg = (FLASH->OBR & (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2));
//if (tmp_reg == 0U)
{
/* proceed to erase the option bytes */
FLASH->CR |= FLASH_CR_OPTER;
FLASH->CR |= FLASH_CR_STRT;
/* If the erase operation is completed, disable the OPTER Bit */
FLASH->CR &= ~FLASH_CR_OPTER;
/* Enable the Option Bytes Programming operation */
FLASH->CR |= FLASH_CR_OPTPG;
OB->RDP = ReadProtectLevel;
/* if the program operation is completed, disable the OPTPG Bit */
FLASH->CR &= ~FLASH_CR_OPTPG;
}
Flash_OB_launch();
OB_lock();
Lock();
}
at the moment Flash_OB_launch() is called debugger stops,nothing to do further.
void Flash_OB_launch(void)
{
/* Set the OBL_Launch bit to launch the option byte loading */
SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH);
}.
in main i called Flash_SetRDPLeve() before any other peripheral initialization.
please help asap. thanks in advance.
‎2019-12-12 02:08 AM
Most RDP levels can be undone by booting into system mode (BOOT0/BOOT1 pins), and doing a Flash mass erase.
Cube should come with a tool that supports the system bootloader protocol, and do exactly that.
I'm no Cube user, so check the documentation, or wait for people more proficient in Cubism...
‎2019-12-12 02:41 AM
hey I solved that issue.
thanks for reply:)
‎2020-04-01 09:11 AM
Hi, can you post the solution?