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.

Problem initializing FEE on TMS570

Other Parts Discussed in Thread: HALCOGEN, TMS570LS1227, TMS570LS3137

Hello All,

I'm trying to use the Flash EEPROM Emulation (TI FEE) with a Hercules development board (TMS570LS1227ZWT).

We're using HALCoGen version 03.08.01 and the F021 Flash API version 02.00.01 and the FreeRTOS version 7.4.0 (included in this version of HALCoGen).

One change we had to make to the generated code is to use hal_stdtypes.h in ti_fee.h to prevent conflicting type definitions.

We're also using the prvRaisePrivilege() and portRESET_PRIVILEGE() definitions from FreeRTOS to enter and leave the Cortex-R4F Supervisor mode in order to access the protected flash settings registers.

After running the TI_Fee_Init(), the error code as returned by TI_FeeErrorCode(0) is ErrorNoActiveVS.  I've looked at bank 7 (address 0xF0200000) and it is all erased (0xff).

I am under the impression that the TI_Fee_Init() should initialize the flash sectors appropriately.  It isn't clear to me when exactly the TI_Fee_Format() should be called though.

I've also tried disabling and enabling the interrupts around each call to the FEE API.

Here's some screenshots from HALCoGen.  I've also attached the contents of the .hcg and .dil files if that is helpful.

Best Regards,

James Graves

  • Hello:

    We will forward your question to our expert and get back to you soon.

    Regards.

  • Hi James,

    TI_Fee_Init API should initialize once of the  sectors as Active. Your configuration seems to be correct. Can you share your HALCoGen project?

    Regards,

    Vishwanath Reddy.

  • Hi Vishwanath,

    Since I could only attach one file to my original post, I had just combined the .dil and .hcg files together into a text file and attached that.

    Best Regards,

    James Graves

  • Hi James,

    I made .dil and .hcg files from the .txt file you have sent but I do not get the FEE configuration similar to the one you have shown in this thread. Could you zip your project and attach it?

    Regards,

    Vishwanath Reddy.

     

  • Hi Vishwanath,

    I created a small project using FreeRTOS for the TMS570LS1227, and copied in some of our code which tries to use the TI FEE API, and also the TI F021 Flash API.  It is attached to this post.

    When you run it, open up the serial port for the development board.  Most of the characters you type will just print "G: " and the character you typed.  The 'e' character will start the FEE API test, and print out the progress.  The 'f' character will start the F021 Flash API test, which normally gets a data abort when running the init function.

    I just put all the flash code in the main_app/console.c file for convenience... it does not normally belong there. :-)

    As you will be able to see, I do wrap each call to either of the APIs with calls to disable / enable the interrupts, and also to enter / exit supervisor mode on the processor.

    Note that the linked resources point to the F021 Flash stuff in c:\ti\Hercules\F021 Flash API\02.00.01\ so if you have that installed in another location you'll need to fix that in the build properties.

    On a suggestion from a coworker, I did try to increase the stack size of the task running the flash API stuff, but that didn't seem to help.

    Best Regards,

    James Graves

    flash_freertos_test.zip
  • Hello All,

    Stepping through the code for the Fapi_initializeFlashBanks(), we're getting a data abort on the instruction at 0x19ab8 (the darkest green which is about to be executed).

    This instruction is accessing the OTP at 0xF0080154.

    On the theory that this data abort is caused by invalid ECC (I don't know how that might have happened, I haven't messed with the OTP at all), I set the FEDACCTRL1 to be 0x00050005, which should ignore the error, if I'm reading the documentation correctly.

    However, that didn't seem to help.

    I can't seem to read the OTP from CCS either, I'm not sure if that is a clue as to what is going on.

    Best Regards,

    James Graves

  • Hi James,

    Regarding the data abort in Fapi_initializeFlashBanks(), it's because your project is enabliong MPU (using prvMpuEnable(); in os_port.c). If you disable this call, then there would be no data abort. You can disable OTP and EEPROM address map from MPU.

    After doing above, we got in to other problem in Fapi_setActiveFlashBank( ). We get "undefEntry" because of BFI.W instruction.

    Also, TI_Fee_Init call's TI_FeeInternal_GetVirtualSectorParameter( ). In this API, the RHS of following condition should read "0". However,we are observing it is reading F0, which means the read is getting offset by 4 bytes.(It's reading F0 of 0x F0200000.) Please check why is the read not correct.

    if(oSector  ==  Device_FlashDevice.Device_BankInfo[u16Bank].Device_SectorInfo[u16LoopIndex].Device_Sector)

    Regards,

    Vishwanath Reddy.

  • Hi Vishwanath,

    Thank you for the comment about the MPU.  I have created macros for use when calling the Flash API functions like so:

    #define enter_flash_critical() \
    portDISABLE_INTERRUPTS();\
    xRunningPrivileged = prvRaisePrivilege();\
    prvMpuDisable();

    #define leave_flash_critical() \
        prvMpuEnable();\
        if( xRunningPrivileged == 0 ) portSWITCH_TO_USER_MODE();\
        portENABLE_INTERRUPTS();


    So now I am able to read / write to the Flash bank 7 using the F021 Flash API.  I have attached the updated test project, in case anyone is interested.  It just reads a 32-bit integer at the beginning of flash, increments it, and writes it back.

    I have not figured out the problems using the TI FEE library though.  However, I am just going to re-write our application to use the F021 Flash API instead of using FEE.

    Thanks for all your help, we do appreciate it!

    Best Regards,

    James Graves

    flash_fee_freertos_test.zip
  • Hi James, Hi Vishwanath,

    Right now I just try the example code which just he post 2 years ago. I use CCS 6.1.3. And I just try to compile the code on attached file above.
    But I meet error about 'cannot open source file "f021.h" '& 'cannot open source file "Std_Types.h". The compiler RTS provides(outdated) AUTOSAR 3.1 heder files, causing problems for applications which need a later version of AUTOSAR.' I am wondering how to update the AUTOSAR? Is there any solutions for those errors?

    I appreciate your help.

    Lukman
  • Hi Lukman,

    Is this the first time you are trying out the FEE example in CCS 6.1.3 or have you already tried it on different CCS versions? Regarding errors 'cannot open source file "f021.h" '& 'cannot open source file "Std_Types.h", you need to provide include paths for F021 headers(By default, F021 library gets installed in C:\ti\Hercules\F021 Flash API\02.01.01\include) and standard library headers(In my PC, it's C:\ti\ccsv6\tools\compiler\ti-cgt-arm_5.2.2\include.). You also need to add necessary F021 library(*.lib are available in C:\ti\Hercules\F021 Flash API\02.01.01) file to CCS project for successful compilation.
  • Dear Vishwanath,

    Yes it is my first time try FEE example in CCS 6.1.3, and I just try TI FEE right now. After I follow your instruction, the error before is solved but I meet another error "Cannot find file "C:/ti/Hercules/F021 Flash". Actually I don't have those file because I just have F021 Flash API folder.
    After I check in ARM Compiler->Include Options & ARM Linker->File Search Path, I never include C:/ti/Hercules/F021 Flash. I only include C:/ti/Hercules/F021 Flash API, I am wondering where this error come from? Could you help me again?

    Thank you very much
    Best Regards,

    Lukman
  • Lukman,

    Can you let me the device you are trying to build the FEE example? I will create a sample CCS project for you and attach it.
  • Dear Vishwanath,

    Right now I am trying to build on TMS570LS3137 HDK, Thank you for your fast response.
    Please kindly help attached the Halcogen generate setting also if you don't mind.
    I appreciate your help.

    Thank you very much.
    Best regards,

    Lukman
  • Lukman,

    Attached is the CCS project+HALCoGen project. sys_main.c file contains the FEE example supplied along with HALCoGen. I have used CCS v 6.1.2.00015 and HALCoGen v 04.06.00.

    3806.FEE_E2E_3137ZWT.7z

  • Dear Vishwanath,

    Thank you for your help, I have import it in my CCS and no problem, right now I will try to save the data using this source code.
    If in the furture I have another problem I will asking in this post.
    Hopefully you will help me in the future.

    Thank you very much.

    Best Regards,

    Lukman