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.

EEPROM empty after restart

Other Parts Discussed in Thread: HALCOGEN

Hi,


i have a problem with the FEE unit of the Lanchxl2 TMS57012.
I want to save the data of the example code of HalCoGen 4.05.01 into the eeprom and read it out after a restart of the controller.

The read and write operations work and while the mcu is active i can read the correct stored data.
But when i want to read the data directly after a restart, the storage is empty.

What am i doing wrong?

 

/* USER CODE BEGIN (0) */
#include "ti_fee.h"
/* USER CODE END */

/* Include Files */

#include "sys_common.h"

/* USER CODE BEGIN (1) */


uint16 u16JobResult,Status;
Std_ReturnType oResult=E_OK;
unsigned char read_data[100]={0};

uint8 SpecialRamBlock[100];

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);
}
/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
/* USER CODE END */

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 Synchronously. Write will not happen since data is same. */
//	TI_Fee_WriteSync(BlockNumber, &SpecialRamBlock[0]);

	/* Read the block with unknown length */
	 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);

        /* data on position 87 */
	int dummy = read_data[87];

	int count = 0;

    while(1)
    {
    	count++;

    	if (count == 1000)
    	{
    		/* 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);
    	}

    	if (count > 1000)
    	{
    		/* Read the block with unknown length */
    			 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);

                /* data on position 87 */
    		dummy = read_data[87];
    	}
    }
/* USER CODE END */
}

and my settings in HalCoGen are: