for(i=0, u32Index = Bzero_Sector0_start;
(u32Index < (Bzero_Sector0_start + WORDS_IN_FLASH_BUFFER)) &&
(oReturnCheck == Fapi_Status_Success); i+= 8, u32Index+= 8)
{
oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index, Buffer+i, 8,
0, 0, Fapi_AutoEccGeneration);
// Wait until the Flash program operation is over
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Example_Error(oReturnCheck);
}
// Read FMSTAT register contents to know the status of FSM after
// program command to see if there are any program operation related errors
oFlashStatus = Fapi_getFsmStatus();
if(oFlashStatus != 0)
{
//Check FMSTAT and debug accordingly
FMSTAT_Fail();
}
// Verify the programmed values. Check for any ECC errors.
// The program command itself does a verify as it goes.
// Hence program verify by CPU reads (Fapi_doVerify()) is optional.
oReturnCheck = Fapi_doVerify((uint32 *)u32Index,
4, Buffer32+(i/2),
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Example_Error(oReturnCheck);
}
}
上述的例子中Fapi_doVerify((uint32 *)u32Index,
4, Buffer32+(i/2),
&oFlashStatusWord)
函数是对写入Flash8个words进行校验,现在它的长度是4个word,还是4个32-bit?地址后面为什么是i/2,不应该是Buffer32+i?
Green Deng:
你好,还请提供一下使用的是哪款芯片?上述例程的位置在哪里?
user5234251:
回复 Green Deng:
c2000\C2000Ware_3_01_00_00\driverlib\f28004x\examples\flash,这个里面的flashapi_ex1_program_autoecc.C例程
user5234251:
回复 user5234251:
你好:
请问下有没有什么结果不?
Green Deng:
回复 user5234251:
Fapi_doVerify()以32-bit words进行验证。因此,使用了i / 2。Flash程序命令的长度为16-bit words。用户可以在1到8个16-bit words之间的任意位置编程。
user5234251:
回复 Green Deng:
你好:Buffer32+(i/2)是buffer的起始地址,那么每次写入i个word,地址也应该是Buffer32+i;如果是Buffer32+(i/2)那么这地址对应不上,问下为什么?还是我哪里理解不对