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.

Can't use FEE after flashing main program from a bootloader

Other Parts Discussed in Thread: TMS570LS1224

Hi,

I am using the TMS570LS1224.  I have a bootloader on it which is functional and can flash a main program and then jump to the main program.

 

 

I use the FEE area for a few things: to store a checksum, the bootloader version, and also a reset reason.  The idea is that if the main program is running and is told that it needs to be updated, it sets the reset reason to a specific value, and then reboots.  The bootloader then reads the reset reason from FEE and if it is set to the value meaning to stay in the bootloader so the main can be updated, then it stays in the bootloader.

 

I have the FEE working in the bootloader, and it also seems to work if I download the main code and debug it.  However, if I run the bootloader, flash the main application and then try to access the FEE I get an undef exception.

 

I am properly flushing the pipeline when using the fapi.  Currently I initialize FEE at the beginning of the bootloader, and then initialize it again at the beginning of the main program.

 

Do I not need to initialize it twice?  Is there something else I need to initialize in order to use the FEE in the main app after using it in the bootloader?

 

Thanks,

David

  • I noticed the TI_Fee_Shutdown function, so now I am calling that in my bootloader before I go to the main function, then initializing FEE in my main function.

    However, I am seeing my call to read from the FEE resulting in an E_NOT_OK error.
  • Hello:

    I'm directing your question to our FEE driver expert. He'll get back to you soon.

    Regards,

    Enrique
  • Thank you.  I have narrowed down where it is failing.  It looks like it is failing in the call to TI_Fee_Read, specifically u16BlockIndex is 0xFFFF at the check

    /* Determine the Block number & Block index */
    	/* From the block number, remove data selection bits */
    	u16BlockNumber = TI_FeeInternal_GetBlockNumber(BlockNumber);
    	/* Get the index of the block in Fee_BlockConfiguration array */
    	u16BlockIndex = TI_FeeInternal_GetBlockIndex(u16BlockNumber);	
    	/* If block index is not found, report an error */
    	if(u16BlockIndex == 0xFFFFU)
    	{
    	  TI_Fee_GlobalVariables[u8EEPIndex].Fee_oStatus = TI_FEE_ERROR;
    	  TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = JOB_FAILED;
    	  TI_Fee_GlobalVariables[u8EEPIndex].Fee_Error = Error_InvalidBlockIndex;
    	}


    However, if I just download and debug through CCS it is ok, so I am assuming I am not doing some  initialization / re-initialization correctly.

  • Hi David,

    The situation you mentioned in FEE Read API will happen when invalid block number is passed to the API. Are you passing correct block number?

  • Hi,

     

    Yes, the block number I am passing should be fine.  I am passing

     

    bootVersionFEE.blockNumber = 3;
    bootVersionFEE.blockOffset = 0;
    bootVersionFEE.length = 4;

     In my bootloader I am able to write to this location fine.  I also seem to be able to read from it OK if I download my main code from CCS and run it through the debugger (so the bootloader isn't run), but if the bootloader runs and then jumps to main I see the error.

     

    The bootloader and main both access the FEE areas.  I have common source so that I know the block numbers, etc are the same for each piece of information I am writing / reading.

     

    David

  • Hi David,

    In case of an error, can you let me know what you see in TI_Fee_GlobalVariables.Fee_au16BlockOffset[]?

    Also, we have seen a similar use case of FEE usage in boot loader and application. However, in this case, there were two instances off FEE, one for boot loader and other for main application.
  • Hi Vishwanath,

    I set an assert in the code so when the read fails it sits in a while(1) loop, then connected and loaded symbols only, and looked at the variable you mentioned through a watch expression, the values are below.

     

    Thanks,

    David

     

     For what it's worth, while I have enabled 16 blocks, I currently only use 3.  If I download the main code through CCS and run it, I get the following values, which are the same if I download and run the bootloader.

     

  • Hi David,

    From the screenshots, it seems like the FEE initialization is not happening correctly. Ideally, if there are blocks written in Bank7, after FEE int, I would expect the values in arrays not to be 0x0BAD(2989).

    In case of error, could you place a breakpoint immediately after FEE init and provide following values:

    TI_Fee_GlobalVariables.Fee_oStatus, TI_Fee_GlobalVariables.Fee_ModuleState, TI_Fee_GlobalVariables.Fee_u16JobResult, TI_Fee_GlobalVariables.Fee_Error

  • After I flash the main app from the bootloader and run the values for those variables are

    Compared to when I download the main code from CCS and run I get

     

     

    So after initializing and using FEE in my bootloader, it's failing to initialize in main. 

    If I want to add error checking to FEE functions that don't have a return value (like TI_Fee_Init), what variables should I check?  It looks like I might need to check all the variables you mentioned except for module state.  Is that correct?

  • Hi David,

    Once TI_Fee_Init is called, Fee_ModuleState should read IDLE. In case of error, what values do you see at 0xF0200000, 0xF0204000, 0xF0208000, 0xF020C000? Could you send 16 byte info from the addresses I mentioned?

  • 0xF0200000 - 000000000000FFFF 00000000FF000001
    0xF0204000 - 0000FFFFFFFFFFFF FFFFFFFFFF000011
    0xF0208000 - FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
    0xF020C000 - FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
      
     

    I have added the following assert checks after calling TI_Fee_Init.  Can you verify that the values I am checking are the correct values that would indicate there is no error? 

     

    	configASSERT((TI_Fee_GlobalVariables[0].Fee_u16JobResult == JOB_OK) ||
    				(TI_Fee_GlobalVariables[0].Fee_u16JobResult == JOB_PENDING) ||
    				(TI_Fee_GlobalVariables[0].Fee_u16JobResult == JOB_CANCELLED));
    
    	configASSERT(TI_Fee_GlobalVariables[0].Fee_oStatus == TI_FEE_OK);
    
    	configASSERT(TI_Fee_GlobalVariables[0].Fee_Error == Error_Nil);

  • Hi David,

    Your assert's are correct. Were you able to nail down the reset issue?

  • It seems the reset only occurs if I have calls to any FEE function in the code (even if they are never hit).  The asserts I put in should prevent further operation, and do when I comment out FEE calls, but with the FEE calls in the system continually resets...

     

    [EDIT]   I am also seeing the system continually reset when  modify code that isn't related to FEE.  I'm hoping the issues are related, but they may not be.  
     
    Still trying to figure out why the FEE init is failing in the main app after initializing OK in the bootloader or when I just run the main from CCS.

    David

  • It seems that some of the main app isn't actually being programmed and we are getting an Fapi_Error_AsyncIncorrectDataBufferLength that our error checking wasn't picking up. I'm looking for the cause of this, and hoping it is the reason FEE isn't working.