This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28P650DK: FLASH_API

Part Number: TMS320F28P650DK

Tool/software:

Hello expert,I have a few questions to ask you.?

1. May I ask why I keep failing the verification?

2Fapi_issueProgrammingCommand---------If the data written is 0xFF, does this function allow for any number of writes?Or is it that only 8 units can be programmed each time?If I want to write in one address, how should I do it?

The code is as follows

Buffer[0] = 0x1122;
Buffer[1] = 0x3344;
Buffer[2] = 0x5566;
Buffer[3] = 0x7788;
Buffer[4] = 0x99AA;
Buffer[5] = 0xAABB;
Buffer[6] = 0xBBCC;
Buffer[7] = 0xDDEE;

EALLOW;
oReturnCheck = Fapi_initializeAPI(FlashTech_CPU0_BASE_ADDRESS,
DEVICE_SYSCLK_FREQ/1000000U);//Flash初始化
if(oReturnCheck != Fapi_Status_Success)
{
//
// Check Flash API documentation for possible errors
//
Example_Error(oReturnCheck);
}
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);// 检测flash的扇区是否为初始化状态
if(oReturnCheck != Fapi_Status_Success)
{
//
// Check Flash API documentation for possible errors
//
Example_Error(oReturnCheck);
}
EDIS;
EALLOW;
ClearFSMStatus();
Fapi_setupBankSectorEnable(FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTA, 0xFFFFFF00);
Fapi_setupBankSectorEnable(FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTB, 0x00000003);
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,(uint32*)Bzero_Sector1_start);
// Wait until FSM is done with erase sector operation
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}

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
// erase command to see if there are any erase operation related errors
oFlashStatus = Fapi_getFsmStatus();
if(oFlashStatus != 3)
{
// Check Flash API documentation for FMSTAT and debug accordingly
// Fapi_getFsmStatus() function gives the FMSTAT register contents.
// Check to see if any of the EV bit, ESUSP bit, CSTAT bit or
// VOLTSTAT bit is set (Refer to API documentation for more details).

}
// Verify that Sector0 is erased
//
oReturnCheck = Fapi_doBlankCheck((uint32 *)Bzero_Sector1_start,
Sector2KB_u32length,
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
//
// Check Flash API documentation for error info
//
Example_Error(oReturnCheck);//Example_CallFlashAPI
}
EDIS;
EALLOW;
ClearFSMStatus();
Fapi_setupBankSectorEnable(FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTA, 0xFFFFFF00);
Fapi_setupBankSectorEnable(FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTB, 0x00000003);
oReturnCheck = Fapi_issueProgrammingCommand((uint32*)Bzero_Sector1_start,Buffer,8,0,0,Fapi_AutoEccGeneration);//flash烧写(在给定的地址烧写内同)
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady);
{}
if(oReturnCheck!=Fapi_Status_Success)
{
Example_Error(oReturnCheck);
}
oFlashStatus = Fapi_getFsmStatus();
oReturnCheck = Fapi_doVerify(((uint32*)Bzero_Sector1_start),8,(uint32*)Buffer,&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
Example_Error(oReturnCheck);
}
}
EDIS;