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.

TMS320F28379D: Question about Flash API

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi 

When calling Fapi_setActiveFlashBank API, it is toggled between following address and finally stop on ESTOP.

0x8a730: D008 MOVB XAR0, # 0x8

0x8a740: D008 MOVB XAR0, # 0x8

#attached file is the capture of Disassembly in this situation.

Do you have any idea of the cause?

Best regards

Naoki

  • Naoki,

    What is the ESTOP address?

    Is flash API executing from RAM or flash?  Please note that it should be executed from RAM only.

    Thanks and regards,

    Vamsi

  • The symptom does not change even if changing to RamFunc.

    Loop at the same location in Fapi_setupFlashStateMachine () in Fapi_setActiveFlashBank ().
    → Please look at following picture

    It may end the loop and end normally, but it may also stop at ESTOP0.
    →Please look at following picture

    (Question1)

    About RamFunc, I modified the cmd file as shown below and confirmed that Fapi was expanded to RAM. Is the cmd description method correct? -> Please look at following document

    [RAM load NG]
    #ifdef __TI_COMPILER_VERSION__
       #if __TI_COMPILER_VERSION__ >= 15009000
            #if defined(__TI_EABI__)
    		    .TI.ramfunc : {} LOAD = FLASHD,
                          		 RUN = RAMD0_1,
    							 /*RUN = RAMD0,*/
                    	         LOAD_START(RamfuncsLoadStart),
                     	         LOAD_SIZE(RamfuncsLoadSize),
                     	         LOAD_END(RamfuncsLoadEnd),
                      	         RUN_START(RamfuncsRunStart),
                      	         RUN_SIZE(RamfuncsRunSize),
                       	         RUN_END(RamfuncsRunEnd),
    							 PAGE = 0, ALIGN(4)
    		#else
    			.TI.ramfunc : {} LOAD = FLASHD,
                          		 RUN = RAMD0_1,
    							 /*RUN = RAMD0,*/
                    	         LOAD_START(_RamfuncsLoadStart),
                     	         LOAD_SIZE(_RamfuncsLoadSize),
                     	         LOAD_END(_RamfuncsLoadEnd),
                      	         RUN_START(_RamfuncsRunStart),
                      	         RUN_SIZE(_RamfuncsRunSize),
                       	         RUN_END(_RamfuncsRunEnd),
    							 PAGE = 0, ALIGN(4)
    		#endif
       #else
       ramfuncs         : LOAD = FLASHD,
                          RUN = RAMD0_1,
                          LOAD_START(_RamfuncsLoadStart),
                          LOAD_SIZE(_RamfuncsLoadSize),
                          LOAD_END(_RamfuncsLoadEnd),
                          RUN_START(_RamfuncsRunStart),
                          RUN_SIZE(_RamfuncsRunSize),
                          RUN_END(_RamfuncsRunEnd),
                          PAGE = 0, ALIGN(4)
       #endif
    #endif
    
    [RAM load OK]
    #ifdef __TI_COMPILER_VERSION__
        #if __TI_COMPILER_VERSION__ >= 15009000
            GROUP
            {
                .TI.ramfunc
                { -l F021_API_F2837xD_FPU32.lib}
    
            } LOAD = FLASHD,
              RUN  = RAMD0_1,
              LOAD_START(_RamfuncsLoadStart),
              LOAD_SIZE(_RamfuncsLoadSize),
              LOAD_END(_RamfuncsLoadEnd),
              RUN_START(_RamfuncsRunStart),
              RUN_SIZE(_RamfuncsRunSize),
              RUN_END(_RamfuncsRunEnd),
              PAGE = 0
        #else
            GROUP
            {
                ramfuncs
                { -l F021_API_F2837xD_FPU32.lib}
    
            } LOAD = FLASHD,
              RUN  = RAMD0_1,
              LOAD_START(_RamfuncsLoadStart),
              LOAD_SIZE(_RamfuncsLoadSize),
              LOAD_END(_RamfuncsLoadEnd),
              RUN_START(_RamfuncsRunStart),
              RUN_SIZE(_RamfuncsRunSize),
              RUN_END(_RamfuncsRunEnd),
              PAGE = 0
        #endif
    #endif

    On the other hand, we have found one way to avoid the problem.
    Running the InitFlash function after EALLOW doesn't seem to cause the freeze problem.
    The content of the InitFlash function is the same as the TI sample code.

    (Question2)

    When repeatedly executing the Fapi_initialize API and Fapi_setActiveFlashBank function,
    Do I have to run the InitFlash function each time?

    Also, does the InitFlash function need to be executed after EALLOW?

    Following document is the implementation contents of failure case and success case.

    [Fail case]
    #pragma CODE_SECTION(flash_init, ramFuncSection);
    void flash_init(void)
    {
        InitFlash();
    
        EALLOW;
    
        Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
        Fapi_setActiveFlashBank(Fapi_FlashBank0);
    
        EDIS;
    
        return;
    }
    
    [Success case]
    #pragma CODE_SECTION(flash_init, ramFuncSection);
    void flash_init(void)
    {
        EALLOW;
    
        InitFlash();
    
        Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
        Fapi_setActiveFlashBank(Fapi_FlashBank0);
    
        EDIS;
    
        return;
    }
    

    Best regards

    Naoki

  • Naoki,

    1) Thank you for the address - it is the ITRAP ISR in bootROM (see 4.9.2 Wait Points in TRM).  Your linker cmd file is including the flash API lib correctly now for flash load and RAM run.  Did you call memcpy() to copy the .TI.ramfunc from flash to RAM before executing any code that is mapped to .TI.ramfunc? 

    Are you saying that the issue got fixed now with an EALLOW?  EALLOW is needed before calling flash API functions - this is mentioned in flash API guide and API usage FAQ (https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/951668/faq-faq-on-flash-api-usage-for-c2000-devices)

    Please take a look at flash programming example in C2000Ware at: C2000Ware_3_04_00_00\device_support\f2837xd\examples\dual\flash_programming

    I would also suggest you to take a look at this FAQ that details flash based execution:  https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/878674/faq-flash---how-to-modify-an-application-from-ram-configuration-to-flash-configuration 

    2) Why are you calling Fapi_initialize API() and Fapi_setActiveFlashBank() functions repeatedly?  Are you changing the operating frequency at run time?

    InitFlash() would have an EALLOW in it as needed.  You need EALLOW before calling flash API functions as mentioned above.

     

    Thanks and regards,
    Vamsi