2019-03-22 04:03 AM
Hi!
When switching RDP from level 0 to level 1, the program stops working. Switched using code in the program, as well as using the ST Visual Programmer. The result is the same.
Code such
FLASH-> OPTKEYR = FLASH_OPTKEY1;
FLASH-> OPTKEYR = FLASH_OPTKEY2;
while (FLASH-> SR & FLASH_SR_BSY);
* (((__ IO uint8_t *) & FLASH-> OPTCR) +1) = uint8_t 0x55U;
FLASH-> OPTCR | = FLASH_OPTCR_OPTSTRT;
__DSB ();
while (FLASH-> SR & FLASH_SR_BSY);
FLASH-> OPTCR | = FLASH_OPTCR_OPTLOCK;
The code is written according to the processor manual. In X-CUBE-PCROP, everything seems to be the same, except that they additionally remove the flash lock. Unlocking the flash does not help, checked.
Maybe in what system register the flag should be set, or what other settings to make?