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.

TMS320F28374S: Fapi_setActiveFlashBank blocked with different RWAIT or optimize level

Part Number: TMS320F28374S
Other Parts Discussed in Thread: C2000WARE

Hi Team,

Issue Description:

TMS320F28374s can’t execute the application code and found some clues that the application code blocked while executing the Fapi_setActiveFlashBank prototype, also found that the RWAIT setting would cause this issue, and also found that the issue also reproduced with different ccs project configuration.

 

Configuration and test result:

Using CCS7.2.0 with cgt version 16.9.3, configured the TMS320F28374s CPU clock to 150Mhz, and test result shown as table 1;

RWAIT Setting

Opt_level

Opt_for_speed

Fapi_setActiveFlashBank

2

Off

0

Blocked

2

Off

2

Normal

3

Off

2

Blocked

3

Off

0

Normal

Table 1: Test Result with related configuration

 

Support Needs:

  1. The RWAIT calculation forum shown as below figure in TRM, but not with detailed description, could you kindly help to provide more details for RWAIT setting description how to identify the related FLASH clock configuration is correct or not?

 

  1. Fapi_setActiveFlashBank prototype is for active the FLASH BANK, but not with detailed description for how it worked, could BU side provide the source code for this prototype and give comments for which registers are affected, especially for RWAIT value?

 

  1. Different configuration for CCS project caused the Fapi_setActiveFlashBank blocked or normal, could BU side give comments on how the configuration affect the results? And could BU side kindly suggest a valid configuration for Opt_level/Opt_for_speed?

Expect for your reply, thanks.

Best Regards

Benjamin

  • Benjamin,

    Please answer below questions so that we can help you better.

    1) What do you mean by blocked?  Did Fapi_setActiveFlashBank() return Fapi_Error_InvalidHclkValue error?

    2) Do you use InitFlash_Bank0()?  If yes, did you enable CPU_FRQ_150MHZ configuration to select RWAIT as 0x2?

    3) Could you confirm that the parameters that you pass to the below functions are as below?

         oReturnCheck = Fapi_initializeAPI(F021_CPU0_W0_BASE_ADDRESS, 150);

         oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);

    4) Did you claim pump semaphore for Bank0? before executing any Flash API functions?

    5) Could you confirm that you execute all the Flash API functions from RAM and not from Flash?

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

     1) What do you mean by blocked?  Did Fapi_setActiveFlashBank() return Fapi_Error_InvalidHclkValue error?

    Benjamin:  Blocked means that the CPU jump to unknown address , and there is no return for the Fapi_setActiveFlashBank() operation,  the JTAG can't trace anything, so the FMC related registers can't be read from JTAG;

    2) Do you use InitFlash_Bank0()?  If yes, did you enable CPU_FRQ_150MHZ configuration to select RWAIT as 0x2?

    Benjamin:  Yes, the Init_Flash_Bank0() is called in customer's source code,  and configured the RWATI to 0x02.  but the when configure the opt-for-speed to 0,  the FLASH blocked issue happened.

    3) Could you confirm that the parameters that you pass to the below functions are as below?

        oReturnCheck = Fapi_initializeAPI(F021_CPU0_W0_BASE_ADDRESS, 150);

        oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);

    Benjamin: Yes, customer code use same configure of the 2 API prototypes;

    4) Did you claim pump semaphore for Bank0? before executing any Flash API functions?

    Benjamin:  As only Bank0 been used in F28374s, customer's source code didn't call any pump semaphore related prototypes.

    5) Could you confirm that you execute all the Flash API functions from RAM and not from Flash?

    Benjamin:  Before the FLASH API prototype called, the memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize) is called for coping the source code from FLASH to RAM which would run at RAM;

    Could you give comments that FLASH API prototypes used "#pragma CODE_SECTION("ramfuncs");" or not? if not, how to execute the FLASH API functions from RAM?

    Also could you kindly give comments for the Opt_level and opt_for_Speed which could not affect the FLASH API prototypes?

    Expect for your reply, thanks.

     

    Best Regards

    Benjamin

  • Benjamin,

    Regarding your question on ramfuncs mapping, please take a look at the flash_programming_cpu1_FLASH.cmd file at C2000Ware_1_xx_xx_xx\device_support\f2837xs\examples\cpu1\flash_programming\cpu01.

    As shown in the linker cmd file, Flash API can be mapped to Flash for load and RAM for execution.
    You already confirmed that memcpy() is called before executing Flash API functions.
    Can you confirm whether Flash API functions are executed from RAM or not (by checking customer's linker cmd file)?

    I need few more clarifications from you:
    1. Can you try disabling ECC (ECC_ENABLE register) before using Flash API functions?
    2. When you say unknown address, is it BootROM's ITRAP ISR address?

    Flash API was compiled with zero optimization.

    Thanks and regards,
    Vamsi
  • FYI for folks that may read this post: This issue is closed offline with our debug help. User is executing Flash API from Flash and that caused this failure. Once Flash API is mapped to load to Flash and execute from RAM, user's application worked fine. Also, note that .TI.ramfunc section should be used instead of ramfuncs section, for compiler versions >= 15.9.

    Thanks and regards,
    Vamsi