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.

TMS570LS3137 - cant change the eeprom values

I have this ee write function to write my configuration to the TMS50ls3137 eeprom

this function runs in privileged mode under freeRTOS - it does not return any errors (only using Block 1 currently (2 are configured)) ..so checking with the debugger the results are E_OK

but the contents of the data are not updated - they are the same as what the original write stored

neither erase of format work...

void eepromWrite (uint16_t BlockNumber, uint8_t inv)  //inv is set to 1 by the caller of this function
{
    //Std_ReturnType t_er =  E_OK;
    if (inv)
    {
        TI_Fee_EraseImmediateBlock(BlockNumber);
        //TI_Fee_Format(0xA5A5A5A5U);
        EEtestIdle();
    }
    TI_Fee_WriteAsync(BlockNumber, &eepromRamBlock[0]);

  EEtestIdle();
  TI_Fee_Shutdown();
  EEtestIdle();
}

static uint8_t EEtestIdle(void)
{
  uint16_t dummycnt=0x0000FFU;
  uint16_t timeout = 0;
  uint16_t Status;
  uint8_t flag = 1;

  do
      {
        TI_Fee_MainFunction();
        do
        {
          dummycnt--;
        }
        while(dummycnt>0);
        Status=TI_Fee_GetStatus(0 );
        timeout++;
        if (timeout == 100)
        {
            flag = Status;
            break;
        }
      }
      while(Status!= IDLE);
        return flag;

}

FEE init is called first

  • Steven,
    Fundamentally I don't see anything wrong, forgive me if I ask some basic questions. Does the array eepromRAMBlock has different data each time you call your eepromWrite function? It is not necessary to call TI_Fee_EraseImmediateBlock() when changing data in a block. The second write to the same block will check if the data is different. If it is, it will write the new data at a higher address in the virtual sector and then mark the original data as invalid. It keeps doing this as the data changes until the virtual sector is full. Then it copies the latest values of each block into the second virtual sector and erases the first virtual sector. When you check the data, are you using the TI_FEE_Read or TI_FEE_ReadSync functions? Just looking at bank 7 memory in the debugger will not show that the data has changed. Your original data will be in the same place, but the block header will be changed to mark that copy of the block as invalid with a pointer to a more recent copy of the data.
  • yes, the new data is vastly different than the old one (fyi the block size is set to 64)

    Im using this function to read the data:

    int8_t eeprom_read(uint16_t BlockNumber, uint16_t BlockOffset, uint16_t Length)
    {
      Std_ReturnType oResult;
      uint8_t *Read_Ptr = eepromRamBlock;

      oResult=TI_Fee_Read(BlockNumber,BlockOffset,Read_Ptr,Length);
      if (oResult != E_OK)
      {
        return -1;
      }
      else
      {
        return 0;
      }

    }

    it appears that Im always reading the first block I ever wrote

  • Do you get the same result with TI_Fee_ReadSync()? (This one does not need to call TI_FEE_MainFunction() to do the actual read? Can you send a screen shot of the bank 7 contents? Just want to check if more than one copy of the block was ever written.
  • I got the same results using the TI_Fee_Readsync - I read the first block I ever wrote
    can you give me details on how to read block 7 ?
  • Just do a memory window starting at address 0xF0200000:

  • That is an empty virtual sector, the first 8 words:
    00000000 ] --- 64 bit virtual sector status word = 0xx000000000000FFFF or Active Sector
    0000FFFF ]
    00000000 ] --- Backup Status also indicates it's the active sector
    FF000001 ] -- FF = Reserved, 0000000 = erase count, 1 = version
    00000000 ] -- 64 bit Virtual Sector Erase Status, Erase of Other Virtual Sector Completed.
    FFFFFFFF ]
    FFFFFFFF ] -- 64 bits reserved
    FFFFFFFF ]

    You're looking for something to show up now at 0xF020 0020 when you write your first block...
  • I check 0xF0200000 after the execution of TI_Fee_WriteAsync and see my new data

    after I reset the board and go back into debug

    I read the eeprom (same block ) and get different data

    and a read of memory shows this - Its not writing to the flash at all ?

    the eeprom read shows old data which was an incrementing byte pattern

  • The first picture shows the data programmed into the flash. The second picture shows that the data was erased and the sector re-initialized. You aren't by accident erasing and reprogramming the flash when you re-connect the debugger are you?
  • Also beware of erasing the FEE array when you download your program again.  

    You said "after I reset the board and go back into debug" but if this includes downloading the program again,

    you might be erasing the FEE array.

    For example if you have 'Entire Flash' selected under Erase Options every time you download your program it's also going to erase bank7 as part of the process..    You could change to 'Necessary Sectors Only (for Program Load)' to avoid this.

    See this screen in the CCS Project Properties: