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: TMS570LS07 problem in read data from eeprom using TI_Fee_Read function

Part Number: TMS570LS0714
Other Parts Discussed in Thread: HALCOGEN

I am using halcogen 

example_TI_Fee_Write_Read.c  to read and write data intto eeprom 
my writing operation is fine and i can see the data in memory browser and when i use read function after write function i can see the same data in read buffer but the problem is when i use read function alone all what i got is 0 so what i have to do if i want to read the data from eeprom without rewriting  the data ??
all what i need is write the data for once then read it whetever i want  
i will be waiting for help from all 
have a good day

  • #include "ti_fee.h"
    
    #include "sys_common.h"
    #include "system.h"
    
    uint16 u16JobResult,Status;
    Std_ReturnType oResult=E_OK;
    unsigned char read_data[100]={0};
    
    uint8 SpecialRamBlock[100]={1};
    
    unsigned char pattern;
    uint16 u16writecounter;
    
    unsigned int  FeeVirtualSectorNumber;
    unsigned char VsState, u8EEPIndex;
    unsigned char u8VirtualSector;
    uint8 Test_Recovery;
    uint8 Test_Cancel;
    
    void delay(void)
    {
        unsigned int dummycnt=0x0000FFU;
        do
        {
            dummycnt--;
        }
        while(dummycnt>0);
    }
    
    void main(void)
    {
    /* USER CODE BEGIN (3) */
        unsigned int BlockNumber;
        unsigned int BlockOffset, Length;
        unsigned char *Read_Ptr=read_data;
    
        unsigned int loop;
    
        /* Initialize RAM array.*/
        for(loop=0;loop<100;loop++)SpecialRamBlock[loop] = loop;
    
        /* Initialize FEE. This will create Virtual sectors, initialize global variables etc.*/
        TI_Fee_Init();
        do
        {
            TI_Fee_MainFunction();
            delay();
            Status=TI_Fee_GetStatus(0);
        }
        while(Status!= IDLE);
    
        /* Write the block into EEP Asynchronously. Block size is configured in ti_fee_cfg.c file. Default Block size is
           8 bytes */
    //    BlockNumber=0x1;
    //    TI_Fee_WriteAsync(BlockNumber, &SpecialRamBlock[0]);
    //    do
    //    {
    //        TI_Fee_MainFunction();
    //        delay();
    //        Status=TI_Fee_GetStatus(0);
    //    }
    //    while(Status!=IDLE);
    
    
    //    //here block number is our start block to write then our buffer will fill the blocks which after him untill
    //    //our buffer write all its data
       BlockNumber=0x1;
        /* Write the block into EEP Synchronously. Write will not happen since data is same. */
    //    TI_Fee_WriteSync(BlockNumber, &SpecialRamBlock[0]);
    
        /* Read the block with unknown length */
        //here our read function will only read the block we determined and never pass to block after him
        //mean here we only read block 0x1
         BlockOffset = 0;
         Length = 0xFFFF;
         oResult=TI_Fee_Read(BlockNumber,BlockOffset,Read_Ptr,Length);
         do
         {
             TI_Fee_MainFunction();
             delay();
             Status=TI_Fee_GetStatus(0);
         }
        while(Status!=IDLE);
    
         /* Read the block with unknown length */
         //here our read function will only read the block we determined and never pass to block after him
         //mean here we only read block 0x2
          BlockOffset = 0;
          Length = 0xFFFF;
          oResult=TI_Fee_Read(0x2,BlockOffset,Read_Ptr,Length);
          do
          {
              TI_Fee_MainFunction();
              delay();
              Status=TI_Fee_GetStatus(0);
          }
         while(Status!=IDLE);
    
    
        /* Invalidate a written block  */
        TI_Fee_InvalidateBlock(BlockNumber);
        do
        {
            TI_Fee_MainFunction();
            delay();
            Status=TI_Fee_GetStatus(0);
        }
        while(Status!=IDLE);
    
        /* Format bank 7 */
        //TI_Fee_Format(0xA5A5A5A5U);
    
        while(1);
    /* USER CODE END */
    }
    
    

  • You can read the block from eeprom any time. You don't have to rewrite the block before reading it.

    I checked your screenshot. The block #1 in the EEPROM is a invalid block. This is why your read returns zero.

    Please comment out the TI_Fee_InvalidateBlock(BlockNumber) in your code, then try.

  • thank you very much for replying i tried it and all things is fine but i have another question how to select which adress to read and write?

  • for example if i want to read those different data because i could only write data to blockno 0x1 and read from but every time i read it just show me the last data i have been wrote . 

    so can you inform me please how to select which block/adress to write and read and which ones is available to use  

  • Hi,

    The Data Block is used to define where the data within a Virtual Sector is mapped. When you write data to FEE, only block# and data source address are needed. If the block# exists in EEPROM, and the writing data is same as the data in EEPROM, the write operation will be ignored. If data is different, the block  header of block# and new data will be written to a new location, and marked as valid block. Another block# is marked as invalid block.

    When you read the block, the FEE API will the data from the valid block#.  

    The # of blocks and block size should be defined before using them. Refer to the ti_fee_cfg.c for virtual sector definition, and block definition.