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.

TMS570LC4357: Issue while accessing FEE of TMS570LC4357

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

I'm working on accessing FEE of TMS570LC4357. I have attached the file (TI_FEE_Test.txt) of with required functions. The requirement is of 5 blocks, each of size 3KB. I'm writing following data into FEE in each block.

Block Data
1 0x11
2 0x22
3 0x33
4 0x44
5 0x55

The setting of halcogen is as below:

1. No. of EEPS: 1

2. Data Select Bits: 0

3. No. of unconfigured blocks to copy: 0 

4. Number of 8 bytes writes: 1

5. Number of FEE Blocks: 5

6. Size of each Block: 3072 bytes

7. No. of virtual sectors: 10

8. Virtual sectors of EEP1: 0

With the setting given above, the code in the attached file is used to write & read the data from FEE. But only block 1 & block 5 are verified successfully rest of the blocks are not verified. Please let me know if i'm making any mistake in the setting of halcogen or anything wrong in the attached code. Please help!

/* Inclusion files */
#include "FEE_IF.h"
#include "ti_fee.h"

/* macros */
#define BUF_SIZE_BLOCK_1        3072U
#define BUF_SIZE_BLOCK_2        3072U
#define BUF_SIZE_BLOCK_3        3072U
#define BUF_SIZE_BLOCK_4        3072U
#define BUF_SIZE_BLOCK_5        3072U
#define BLOCK_NUM_1             1U
#define BLOCK_NUM_2             2U
#define BLOCK_NUM_3             3U
#define BLOCK_NUM_4             4U
#define BLOCK_NUM_5             5U
#define BLOCK_OFFSET            0U

/* Declaration of variables */
uint8_t Ui_FEE_WrDataBuff_B1[BUF_SIZE_BLOCK_1] = {0U};
uint8_t Ui_FEE_RdDataBuff_B1[BUF_SIZE_BLOCK_1] = {0U};

uint8_t Ui_FEE_WrDataBuff_B2[BUF_SIZE_BLOCK_2] = {0U};
uint8_t Ui_FEE_RdDataBuff_B2[BUF_SIZE_BLOCK_2] = {0U};

uint8_t Ui_FEE_WrDataBuff_B3[BUF_SIZE_BLOCK_3] = {0U};
uint8_t Ui_FEE_RdDataBuff_B3[BUF_SIZE_BLOCK_3] = {0U};

uint8_t Ui_FEE_WrDataBuff_B4[BUF_SIZE_BLOCK_4] = {0U};
uint8_t Ui_FEE_RdDataBuff_B4[BUF_SIZE_BLOCK_4] = {0U};

uint8_t Ui_FEE_WrDataBuff_B5[BUF_SIZE_BLOCK_5] = {0U};
uint8_t Ui_FEE_RdDataBuff_B5[BUF_SIZE_BLOCK_5] = {0U};

uint8 Ui_GetFeeSts = 0;

/**************************************************************************************************
**                                      FUNCTIONS                                                **
**************************************************************************************************/
/**************************************************************************************************
** Function name    : FEEIF_Test
**
** Description      : To write data into internal FEE
**
** Parameter        : Ui_DummyTaskParam
**
** Return value     : Enm_Ret
**
** Remarks          : None
**************************************************************************************************/
uint32_t FEEIF_Test(uint32_t Ui_DummyTaskParam)
{
    FEE_WR_RetCode_t Enm_Ret = FEE_WR_INVARG;

    uint32_t FeeWrBuffIndex = 0U;

    uint8_t Ui_WrRetSts = 0U, Ui_RdRetSts = 0U;

/********************* Write all blocks *********************************/

    /* Block 1*/
    for(FeeWrBuffIndex = 0U; FeeWrBuffIndex < BUF_SIZE_BLOCK_1; FeeWrBuffIndex++)
    {
        Ui_FEE_WrDataBuff_B1[FeeWrBuffIndex] = 0X11;
    }

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);

    Ui_WrRetSts = TI_Fee_WriteAsync(BLOCK_NUM_1, Ui_FEE_WrDataBuff_B1);



    /* Block 2*/
    for(FeeWrBuffIndex = 0U; FeeWrBuffIndex < BUF_SIZE_BLOCK_2; FeeWrBuffIndex++)
    {
        Ui_FEE_WrDataBuff_B2[FeeWrBuffIndex] = 0X22;
    }

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);

    Ui_WrRetSts = TI_Fee_WriteAsync(BLOCK_NUM_2, Ui_FEE_WrDataBuff_B2);



    /* Block 3*/
    for(FeeWrBuffIndex = 0U; FeeWrBuffIndex < BUF_SIZE_BLOCK_3; FeeWrBuffIndex++)
    {
        Ui_FEE_WrDataBuff_B3[FeeWrBuffIndex] = 0X33;
    }

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);

    Ui_WrRetSts = TI_Fee_WriteAsync(BLOCK_NUM_3, Ui_FEE_WrDataBuff_B3);


    /* Block 4*/
    for(FeeWrBuffIndex = 0U; FeeWrBuffIndex < BUF_SIZE_BLOCK_4; FeeWrBuffIndex++)
    {
        Ui_FEE_WrDataBuff_B4[FeeWrBuffIndex] = 0X44;
    }

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);

    Ui_WrRetSts = TI_Fee_WriteAsync(BLOCK_NUM_4, Ui_FEE_WrDataBuff_B4);


    /* Block 5*/
    for(FeeWrBuffIndex = 0U; FeeWrBuffIndex < BUF_SIZE_BLOCK_5; FeeWrBuffIndex++)
    {
        Ui_FEE_WrDataBuff_B5[FeeWrBuffIndex] = 0X55;
    }

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);

    Ui_WrRetSts = TI_Fee_WriteAsync(BLOCK_NUM_5, Ui_FEE_WrDataBuff_B5);


/********************* Read all blocks *********************************/

    /* Read Block 1 */

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);


    Ui_RdRetSts = TI_Fee_Read(BLOCK_NUM_1, BLOCK_OFFSET, Ui_FEE_RdDataBuff_B1, BUF_SIZE_BLOCK_1);


    /* Read Block 2 */

    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);


    Ui_RdRetSts = TI_Fee_Read(BLOCK_NUM_2, BLOCK_OFFSET, Ui_FEE_RdDataBuff_B2, BUF_SIZE_BLOCK_2);


    /* Read Block 3 */


    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);


    Ui_RdRetSts = TI_Fee_Read(BLOCK_NUM_3, BLOCK_OFFSET, Ui_FEE_RdDataBuff_B3, BUF_SIZE_BLOCK_3);



    /* Read Block 4 */


    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);


    Ui_RdRetSts = TI_Fee_Read(BLOCK_NUM_4, BLOCK_OFFSET, Ui_FEE_RdDataBuff_B4, BUF_SIZE_BLOCK_4);


    /* Read Block 5 */


    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);


    Ui_RdRetSts = TI_Fee_Read(BLOCK_NUM_5, BLOCK_OFFSET, Ui_FEE_RdDataBuff_B5, BUF_SIZE_BLOCK_5);


    do
    {
       TI_Fee_MainFunction();
       delay();
       Ui_GetFeeSts = TI_Fee_GetStatus(0);
    }
    while(Ui_GetFeeSts != IDLE);


    Enm_Ret = FEE_WR_SUCCESS;

    return (uint32_t)Enm_Ret;
}

void delay(void)
{
    unsigned int dummycnt=0x0000FFU;
    do
    {
        dummycnt--;
    }
    while(dummycnt>0);
}

  • Hi Harshal,

    The emulated EEPROM is divided into two or more Virtual Sectors. Each Virtual Sector is partitioned into several Data Blocks. A Virtual Sector can contain one or more contiguous physical flash sectors. A minimum of 2 Virtual Sectors are required to support the TI FEE Driver.

    The size of a virtual sector MUST be larger than the size of all the Data Blocks. 

    But your configuration uses 10 virtual sectors and each virtual sector is 4kB only which is much smaller than the size of the data blocks.

    When programming data to EEPROM, the data is written to the first empty location in the Active Virtual Sector. If there is insufficient space in the current Virtual Sector to update the data, it switches over to the next Virtual Sector and copies all the valid data from the other Data Blocks in the current Virtual Sector to the new one. After copying all the valid data, the current Virtual Sector is marked as ready for erase and the new one is marked as Active Virtual Sector. Any new data is now written into the new Active Virtual Sector and the Virtual Sector which is marked as ready for erase will be erased in background. 

    You have 5 data blocks and each is around 3KB long. I suggest to use 2 Virtual sectors, and each virtual sector contains 16 contiguous physical flash sectors.

  • Hi,

    Done the configuration as suggested by you, now it's working fine & all blocks are verified. Thanks for your help !