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.

TMS570LS0714: EEPROM Emulation block program return failure on check

Part Number: TMS570LS0714
Other Parts Discussed in Thread: HALCOGEN,

I am trying to use the eeprom emulation mode in bank 7. I  modified the program block API to work with bank 7. Also added additional flash sectors to the flash_Sectors array so that firmware can pull it. 

I try to erase address 0xF0201000 and am successful in doing so. 

However when i try to write the write fails on check condition. 

}
reg_ptr =(volatile uint32_t*) 0xfff87288;
*reg_ptr = 0x00000005;
*reg_ptr = 0x00040002;
*reg_ptr = 0x00000002;
status = Fapi_BlockProgram( FILE_BANK_LOCATION, write_address, (uint32_t)&file, sizeof(struct file_download_properties));
return status;

Blockprogram function looks something like this

register uint32_t src = Data_Start_Address;
register uint32_t dst = Flash_Start_Address;
register uint32_t bytes_remain = Size_In_Bytes;
uint8_t i, ucBank;
uint32_t status;
uint32_t bytes;
uint32_t Freq_In_MHz;

Freq_In_MHz = SYS_CLK_FREQ;

if (Size_In_Bytes < 16)
bytes = Size_In_Bytes;
else
bytes = 16;

for (i = 0; i < NUMBEROFSECTORS-1; i++){
if (Flash_Start_Address < (uint32_t)(flash_sector[i+1].start))
{
ucBank = flash_sector[i].bankNumber;
break;
}
}

if(( Flash_Start_Address == APP_START_ADDRESS ) || ( ucBank == 1 ) || ( Flash_Start_Address == 0 ) ||
(ucBank == 7)){
Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */

Fapi_setActiveFlashBank((Fapi_FlashBankType)ucBank);

if(Bank == 0) {
status= Fapi_enableMainBankSectors(0xFFFF); /* used for API 2.01*/
}
else {
status = Fapi_enableEepromBankSectors(0xFFFFFFFF,0xFFFFFFFF);
}

while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );
while( FAPI_GET_FSM_STATUS != Fapi_Status_Success );
}

while( bytes_remain > 0)
{
Fapi_issueProgrammingCommand((uint32_t *)dst,
(uint8_t *)src,
(uint32_t) bytes,
0,
0,
Fapi_AutoEccGeneration);

while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

src += bytes; //Size_In_Bytes;
dst += bytes; //Size_In_Bytes;
bytes_remain -= bytes; //Size_In_Bytes;
if ( bytes_remain < 16){
bytes = bytes_remain;
}
}

#ifdef DEBUG_MSG_L3
UART_putString(UART, "\r Programmed the flash: ");
UART_send32BitData(UART, Size_In_Bytes);
UART_putString(UART, " Bytes. \r ");
#endif
Fapi_flushPipeline();
status = Flash_Program_Check(Flash_Start_Address, Data_Start_Address, Size_In_Bytes);

return (status);

Any suggestions?

  • Hello Saurabh,

    Can you provide some more details on what you are trying to do? The Flash API is provided as a library and not source so how would you modify it other than with the parameters passed into it? The FEE drivers are included in HalCoGen for use with Bank 7, why is there a need to create your own functions? I would strongly advice to avoid modification of the FEE drivers (or anything related to the FAPI Library) as there are many traps and risks with pursuing this path.
  • Hi Chuck,

    I am trying to erase and write the EEPROM sector 0 and sector 1 using the Fapi_BlockProgram function. Now when i pass the address 0xF0200000
    the address is not present in the table flash_sector . so i had to include thoses addresses in there. Am i missing something or using the Wrong API to read and write? Block write is preceded by the erase operation.
  • Saurabh,

    Since you haven't stated which Flash API library you are using, I can't judge if it is correct or not. We have several including the F05 Flash API, F035 Flash API, and F021 Flash API. The later two come with Halcogen for use in the products that Halcogen supports. For the specific device you have mentioned, TMS570LS0714, it would use the F021 Flash API. However, for Flash Emulated EEPROM applications, it is best to use the FEE drivers included in HalCoGen. These drivers are designed to implement the emulated EEPROM in bank 7 of the Hercules devices. There is a user guide included in the halcogen Installation directory (C:\ti\Hercules\HALCoGen\v04.06.01\Docs). It has the necessary drivers to manage the writing and erasing of data to the emulated EEPROM and decide when to erase and copy blocks, etc.
  • Chuck,

    Apologies about that. I was using the F021 flash API and hence had to make changes mentioned above. I will try theFEE drivers. Thank you. Will post the result here son