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.

TI FEE usage - confilct between doc and code

Other Parts Discussed in Thread: HALCOGEN

Looking over the FEE doc http://www.ti.com/lit/ug/spnu518/spnu518.pdf , it appears that the status function TI_FEE_getStatus is not spelled correctly according to the code, as well it requires an argument of type u8EEPIndex.

So, do I have old docs, old code, or ???

Also, TI_Fee_GetStatus returns an object of type TI_FeeModuleStatusType instead of TI_FeeStatusCodeType as in the docs.

And, if I do indeed have good code (in ti_fee.h the last rev is 00.01.11), what number do I use for u8EEPIndex?

  • Hello Tonyo,

    I have forwarded your comments/qestions to one of our FEE development engineers so they can respond to your concerns. They should get back with you in a short time.


  • Hello Tonyo,

    The document you are referring is valid for TMS470 FEE driver. If you are using FEE driver on TMS570 device, please use the user guide which is attached to HALCoGen.(C:\ti\Hercules\HALCoGen\v03.xx.00\Docs)

    If TI_FEE_NUMBER_OF_EEPS = 1U, then the argument should always be 0.

    Regards,

    Vishwanath Reddy.

     

  • ok, well I am trying to use the FEE code, some questions:

    - I keep getting a 1 from TI_FeeJGetJobResult(0) , which means that the job failed.

    Then I call TI_Fee_ErrorCode(0), which is 16.

    I then feed that into TI_Fee_ErrorRecovery(16, 0) to correct the error.

    Is this the correct procedure to recover from an error?

    Also, does calling TI_Fee_Init() initialize the flash? I can never seem to get data to persist between resets.

    Does loading new code from CCS affect storage?

  • Hello Tonyo,

    Could you let me know what is the FEE API called before calling TI_Fee_GetJobResult API? Error code 16 (Error_InvalidBlockIndex) can come from many API's.

    The error 16 is a valid error code. TI_Fee_ErrorRecovery API may be used only for following error's:

    Error_TwoActiveVS(deprecated) , Error_TwoCopyVS(deprecated), Error_SetupStateMachine, Error_CopyButNoActiveVS(deprecated), Error_NoFreeVS, Error_NoActiveVS, Error_EraseVS.

    If EEPROM bank is blank, then TI_Fee_Init API will initialize configured EEPROM sectors. It will create one Active Virtual Sector. Other sectors will be erased and marked as EMPTY by TI_Fee_MainFunction API.

    Could you elaborate more on "I can never seem to get data to persist between resets"?

    While downloading code from CCS, you need to select the option "Necessary Sectors Only(for Program Load)" in the tab "On-Chip Flash".

    Regards,

    Vishwanath Reddy.

  • I call the function NV_wait() before and after calling each read/write:

    void NV_wait(void)

    {

    TI_FeeModuleStatusType status;							
    	TI_FeeJobResultType result;
    	TI_Fee_ErrorCodeType errors;
    
    	TIMER update_timeout;
    	TIMER_SET(update_timeout);
    
    	for(;;) // wait for FEE state machine to complete
    	{
    		TI_Fee_MainFunction();								// process current request
    		status = TI_Fee_GetStatus(0);						// check to see if done
    		result = TI_Fee_GetJobResult(0);
    		errors = TI_FeeErrorCode(0);
    
    		if(errors)
    		{
    			TI_Fee_ErrorRecovery(errors, 0);
    		}
    
    		if(status == IDLE && !errors && result == JOB_OK) break;		// all done
    		if(TIMER_ELAPSED(update_timeout) > MILLISECONDS_TO_TICKS(100)) break;	// timed out, exit
    	}
    
    	if(result != JOB_OK)
    	{
    		dbEprintf((db_buf, "NV_wait: status=0x%04x result=0x%04X errors=%ld %lu ticks\n", status, result, errors, TIMER_ELAPSED(update_timeout)));
    	}
    }
    
    
    So then to do a read, I set a uint8_t pointer p to my nonvolatile params and call:

    NV_wait();
    Std_ReturnType retval = TI_Fee_Read(0, 0, p, sizeof(NVPARAMS)); // schedule a read
    NV_wait();

    dbEprintf((db_buf, "NV_read: retval=0x%04x\n", retval));

    And a write:

    NV_wait();
    TI_Fee_WriteSync(0, p); // schedule a write
    NV_wait();

    So then I initialize my nonvolatile params and write them using the above code.

    
    

  • Hello Tonyo,

    You would see "16"(Error_InvalidBlockIndex), when application tries to write/read a block which is not configured in ti_fee_cfg.c.

    Also for writing data, I would advice you to use TI_Fee_WriteAsync. There is a known issue in TI_Fee_WriteSync. It does not write the first 8 bytes of data.

    Also, in for loop, I would only check for IDLE state.You can check for error condition(only for error's I have mentioned in my previous post) and job result out side of for loop.

    Regards,                                                                                                                                                                   Vishwanath Reddy.