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.

How to resolve Flash STATUS_FAIL_PRECONDITION with software.

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

Hi,

hope you can help me with an issue I have with the TMS320F28335 Processor Flash2833x_API library.

I have written a J1939 bootloader that uses the flash API to erase and program applications into flash.

The API worked perfectly until I started to really test the resilience of the software and the programming.

If I turn the power off while the API is erasing I get the STATUS_FAIL_PRECONDITION which we would expect.

After an erase failure the software calls the Flash28335_DepRecover() Function which returns SUCCESS.

 Trying to erase after the Flash28335_DepRecover() SUCCESS result still fails with the error code STATUS_FAIL_PRECONDITION.

 To recover the situation I need to re-connect the C2000 emulator from Code Composer (not reloading the code) reset the processor

and run the code and the flash recovers from its failed state.

Obviously we are missing an action that needs to be done to recover the Flash from its failed state after the Flash28335_DepRecover() has succeeded.

Power-cycling the board does not recover the Flash…. Only re-connecting the emulator with code composer.

Please help

 thanks

  • When you power off the device during flash erase operation, it will put the flash in depletion. You can find more information about depletion in the link below:

    http://processors.wiki.ti.com/index.php/C2000_Flash_Common_Issues/FAQs#Depletion

    You should never power off the device during flash erase (or) compaction (or) program operation. There is not guarantee that you will be able to bring the flash from depletion.However, I should say I don't have any idea why re-connecting the emulator enables the flash to be erased properly. I am pretty sure reconnecting the emulator will not bring the flash out of depletion on all the devices.

    Regards,

    Manoj

  • Thankyou for the information, since the orginal posting i have done some more investigation work and found the following.

    I changed the software and placed debug variables in memory which i can look at after a failed erase due to the PRECONDITION_FAIL.

    by re-connecting the emulator to view in the memory window.

    I changed the erase function to erase each sector individually and log it's result to see which sectors failed.

    It was found all sectors I tried to erase failed and not just one.

    Is there a reason for all sectors failing?

    The fact that re-connecting the emulator, resetting the processor and running the code with the emulator (not flashing the code or reloading symbols) cures the flash issue still points to something the emulator is doing and my code is not.

    Has anybody any ideas??

    This issues is now urgent as the PCB is in a sealed unit and cannot release beta test units to our customers knowing they might be returned due to this issue.

    thanks

     

     

     

  • I am going to answer this old post because I had a similar problem yesterday.

    The problem is that Flash_CPUScaleFactor has not been initialized in the code. This variable is set by the emulator and therefore the erase commands succeeds after programming, but not after a reset.

    On newer processors the Flash API is placed in ROM memory and the variables Flash_CPUScaleFactor and Flash_CallbackPtr are EALLOW protected. I was porting a bootloader for an 2812 processor to a 28069 and was missing EALLOW / EDIS around the variable assignments.

    I found the problem by running the flash_programming example from controlSuite and calling the function Example_ToggleTest(). This function calls Flash_ToggleTest() to check that the Flash API is properly configured.

  • Thanks for this information Anders, this saved me hours of headache.

  • Anders P. Nielsen thank you very much.

    You make me happy, you solve my problem.

    Best Regards From Türkiye