2019-08-29 09:51 PM
I am use this code for write page with disabling WRP:
FLASH_Unlock();
if( FLASH->WRPR != 0xFFFFFFFF ) //WRP is active for any pages
{
FLASH_EraseOptionBytes();
NVIC_SystemReset(); //according to the manual
}
if( FLASH_ErasePage( address ) != FLASH_COMPLETE )
{
printf( "FAIL" );
}
FLASH_ProgramWord( address, value );
FLASH_EnableWriteProtection( FLASH_WRProt_Pages0to1 );
FLASH_Lock();
If RDP is not active or WRP is not active, it work successfull,
but if RDP and WRP is active, printf( "FAIL" ) is called, and write is impossible