cancel
Showing results for 
Search instead for 
Did you mean: 

How can i disable WRP with RDP is active? STM32F103RGT6

misha-zvukovik
Associate

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

0 REPLIES 0