Question
Hardfault in RDP Level Change
Hello, I am writing code for changing the RDP Level, but I am facing a hard fault trigger in the code:
this is the line after unlocking the FLASH_CR_LOCK, and FLASH_CR_OPTLOCK. After unlocking able to change the RDP level to 1 or 2 but as soon the debugger goes to line 2 (below), the hard fault is triggered.
while((FLASH->SR & FLASH_SR_BSY1) != 0x00);
FLASH->CR = FLASH->CR | FLASH_CR_OPTSTRT; // this line triggers the hard fault
Can anybody suggest any solution?
