2013-01-10 01:49 AM
Hi,
I am not able to Erase/program the flash .FLASH_ErasePage : is returning FLASH_COMPLETE but I still see old data on flash.FLASH_FastProgramWord : inside this function first it is checking for last operation status but ''FLASH_WaitForLastOperation'' is always returning FLASH_ERROR_PROGRAM.Erase Code:FLASH_Unlock();FLASH_OB_Unlock(); fstatus = FLASH_OB_WRPConfig(OB_WRP_Pages64to79 | OB_WRP_Pages80to95 | OB_WRP_Pages96to111 | OB_WRP_Pages112to127 ,DISABLE); printf(''write protection=%x\n'',fstatus);for(i=0;i<64;i++) { printf(''page-addr=%x\n'', ((i*1024)+faddr) ); //faddr - 0x08010000 fstatus = FLASH_ErasePage( ((i*1024)+faddr) ); printf(''Erase status=%x\n'',fstatus); if(fstatus != FLASH_COMPLETE ) break;} fstatus = FLASH_OB_WRPConfig(OB_WRP_Pages64to79 | OB_WRP_Pages80to95 | OB_WRP_Pages96to111 | OB_WRP_Pages112to127 ,ENABLE); printf(''write protection=%x\n'',fstatus); FLASH_OB_Lock(); FLASH_Lock();Flash Program Code: flashaddr = 0x08010000FLASH_Unlock();FLASH_OB_Unlock();fstatus = FLASH_OB_WRPConfig(OB_WRP_Pages64to79 | OB_WRP_Pages80to95 | OB_WRP_Pages96to111 | OB_WRP_Pages112to127 ,DISABLE);printf(''dwrite protection=%x\n'',fstatus); /* FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP| FLASH_FLAG_PGAERR | FLASH_FLAG_WRPERR); - is always hitting assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG)); */ fstatus = FLASH_FastProgramWord(flashaddr,fword);if(fstatus != FLASH_COMPLETE){ printf(''write fstatus=%d\n'',fstatus); ASSERT(0);}fstatus = FLASH_OB_WRPConfig(OB_WRP_Pages64to79 | OB_WRP_Pages80to95 | OB_WRP_Pages96to111 | OB_WRP_Pages112to127 ,ENABLE);printf(''dwrite protection=%x\n'',fstatus);FLASH_OB_Lock();FLASH_Lock()