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.

F28M36P63C2: C28 flashAPI partially working

Part Number: F28M36P63C2
Other Parts Discussed in Thread: CONTROLSUITE

I am using the FlashAPI on the concerto C28 core and the erase command results in ILLEGAL_ISR()

I am executing commands in this order:

Fapi_initializeAPI  - works, returns success

Fapi_getDeviceInfo() - works, returns device info

FlashGainPump() - no error

 Fapi_setActiveFlashBank(Fapi_FlashBank0) - works returns success

Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,Bzero_SectorG_start); FAILS.

Here is the output up to the error:

Fapi_issueAsyncCommandWithAddress(enum <unnamed>, unsigned long *)() at Async.c:24 0x00A74B
Fapi_issueAsyncCommandWithAddress(enum <unnamed>, unsigned long *)() at Async.c:25 0x00A74E
Fapi_issueAsyncCommandWithAddress(enum <unnamed>, unsigned long *)() at Async.c:28 0x00A74F
Fapi_issueAsyncCommandWithAddress(enum <unnamed>, unsigned long *)() at Async.c:32 0x00A752
Fapi_issueAsyncCommandWithAddress(enum <unnamed>, unsigned long *)() at Async.c:41 0x00A759
_Fapi_issueFsmCommand(enum <unnamed>)() at FlashStateMachine.c:39 0x00A00B
_Fapi_issueFsmCommand(enum <unnamed>)() at FlashStateMachine.c:40 0x00A00D
_Fapi_issueFsmCommand(enum <unnamed>)() at FlashStateMachine.c:41 0x00A018
ILLEGAL_ISR() at F28M36x_DefaultIsr.c:87 0x13E4D1

  • From disassembly:

    _Fapi_issueFsmCommand():
    00a00b: FE02 ADDB SP, #2
    00a00c: 9641 MOV *-SP[1], AL
    00a00d: 761F029E MOVW DP, #0x29e
    00a00f: 8F000144 MOVL XAR4, #0x000144
    00a011: 0602 MOVL ACC, @0x2
    00a012: 560100A4 ADDL @XAR4, ACC
    00a014: CCC4FFF8 AND AL, *+XAR4[0], #0xfff8
    00a016: 5005 ORB AL, #0x5
    00a017: 96C4 MOV *+XAR4[0], AL
    00a018: 0000 ITRAP0
  • Regis,

    (1) Based on the output that you mentioned, looks like your application executes the Flash API functions from Flash. Is that correct? Please check and let me know. As you may already know, Flash API functions should be executed from RAM on this device (mentioned in section 2.3.3 Key Facts for Flash API Usage of www.ti.com/.../spnu595) .

    Please check the example provided at ti\controlSUITE\device_support\f28m36x\vx\F28M36x_examples_Dual\flash_prog.
    You will notice in the linker command file that the Flash API library is allocated to .TI.ramfunc section, which has a Flash load address and RAM run address. In the example code, you will notice that memcpy() is called to copy the ramfunc content from Flash to RAM.

    (2) Also, gain the pump before calling any Flash API function.

    Let me know what you observe.
    Flash API wiki: processors.wiki.ti.com/.../C2000_Flash_FAQ

    Thanks and regards,
    Vamsi
  • Thank you for your help.
    The API is running from L2 RAM (A000-AFFF).

    Findings...
    I moved the API to run from L3 RAM (B000-BFFF) and it seems to have corrected the issue.
    There seems to be a linker conflict when using our custom libraries and FlashAPI in my application.

    It is odd that sharing L2 RAM would be an issue without any complaints from CCS.
    Are there any linker tags to assure parts of the flashAPI dont get written over?

    BAD---- (itrap0 at a018):
    _Fapi_issueFsmCommand():
    00a00b: FE02 ADDB SP, #2
    00a00c: 9641 MOV *-SP[1], AL
    00a00d: 761F029E MOVW DP, #0x29e
    00a00f: 8F000144 MOVL XAR4, #0x000144
    00a011: 0602 MOVL ACC, @0x2
    00a012: 560100A4 ADDL @XAR4, ACC
    00a014: CCC4FFF8 AND AL, *+XAR4[0], #0xfff8
    00a016: 5005 ORB AL, #0x5
    00a017: 96C4 MOV *+XAR4[0], AL
    00a018: 0000 ITRAP0

    GOOD---- moved to L3 RAM:
    _Fapi_issueFsmCommand():
    00b00b: FE02 ADDB SP, #2
    00b00c: 9641 MOV *-SP[1], AL
    00b00d: 761F02DE MOVW DP, #0x2de
    00b00f: 8F000144 MOVL XAR4, #0x000144
    00b011: 0602 MOVL ACC, @0x2
    00b012: 560100A4 ADDL @XAR4, ACC
    00b014: CCC4FFF8 AND AL, *+XAR4[0], #0xfff8
    00b016: 5005 ORB AL, #0x5
    00b017: 96C4 MOV *+XAR4[0], AL
    00b018: 8F000106 MOVL XAR4, #0x000106
    00b01a: 0602 MOVL ACC, @0x2
    00b01b: 560100A4 ADDL @XAR4, ACC
    00b01d: 9241 MOV AL, *-SP[1]
    etc....
  • Regis,

    May be the application or your custom library is overwriting the Flash API library in RAM during runtime execution? Please check.

    Or Do you call memcpy() twice to copy two sets of contents from Flash to RAM?

    Thanks and regards,
    Vamsi
  • I call memcpy twice in my application. I have also tried using the group tag in the linker file. It did not help.

    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
    memcpy(&F021APIRunStart, &F021APILoadStart, (size_t)&F021APILoadSize);

    linker command file:

    #ifdef __USE_F28M36x__

    FLASH_API:
    {
    -lF021_API_C28x_FPU32.lib
    } LOAD = FLASHD,
    RUN = RAML3,
    LOAD_START(_F021APILoadStart),
    LOAD_SIZE(_F021APILoadSize),
    RUN_START(_F021APIRunStart),
    PAGE = 0

    #endif //__USE_F28M36x__
  • Regis,

    Please share your linker cmd file showing both Flash API and Ramfuncs section allocation - you can hide details that you don't want to publicize.

    Thanks and regards,
    Vamsi

  • I am currently using 4 linker files.

    F28M36H63C2_generic_wshared_C28_FLASH.cmd
    F28M36x_Headers_nonBIOS.cmd
    2 custom ones.

    Only one place RamFuncs is used...


    #if__TI_COMPILER_VERSION__ < 15009000
    #error "Wrong TI compiler version"
    #endif

    .TI.ramfunc : {} LOAD = FLASHD,
    RUN = RAML0,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    RUN_SIZE(_RamfuncsRunSize),
    RUN_END(_RamfuncsRunEnd),
    PAGE = 0, ALIGN(4)
  • Regis,

    Based on the two snaps that you shared up to now, you load Ramfuncs and Flash API in different RAM blocks without grouping them and it worked for you - which is good.

    You should be able to group them if you want to use the same RAM block/s (provided they fit).
    What is the issue that you faced when you tried grouping them? I can ask our compiler team to help you if you want to debug that. Please let me know.

    Thanks and regards,
    Vamsi
  • Is it an issue to run them from different ram blocks?
  • Regis,

    No, it is not an issue.  I summarized the discussion - on what is working and what is not working for you.

    Let me know if you need further help on this thread.  If not, we can close this.

    Thanks and regards,

    Vamsi

  • Please close the thread.
    thanks for the help.