Hello everybody!
I am using XET256,I have some problems about using P-Flash.
If I want to program P-Flash from 0x780002 to 0x780007, and P-Flash in address 0x780000 and 0x780001 have been programed, so I fill 0x780000 as 0xffff ,like that:
FCCOBIX=0;
FCCOB=0X0678;
FCCOBIX=1;
FCCOB=0X0000;
FCCOBIX=2;
FCCOB=0XFFFF;
FCCOBIX=3;
FCCOB=value1
FCCOBIX=4
FCCOB=value2
FCCOBIX=5
FCCOB=value3
FSTAT=0X80;
Whether this will generate a P-Flash Command Error? If it will set ACCERR FPVIOL MGSTAT1 or MGSTAT2?
I think you will get ECC error.
Thank you for your response. In this situation the data in 0x780002-0x780007 is correct?
If I fill 0x780000-0x780001 with their original data, will generate any errors?
I think it depeneds on the state of ECC bits. One time you may get you bytes matching data you were trying to program. Another time you may get verify errors. When you command flash to write 8 bytes, more than 8 bytes are written to flash, since additional ECC correction bits are written to the flash. When you write xx0-xx1 bytes, and others all FF, ECC correction pattern is programed exactly for that old xx0-xx7 byte pattern. It is obvious that when you later program xx2-xx7, ECC correction has almost no chances to be programmed properly. You need to erase all 8 bytes. Unfortunately you can erase only whole flash sector.
Yes, it will. Old ECC correction has to be erased .
Thank you! So I must restrict the program start address, to be sure it's bit[0:2] is zero.