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.

CCS/LAUNCHXL-F280049C: When run code from flash, sci RX stop working.

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

I wrote sci(uart) code for launchapd F280049C.

My code works fine when I run from RAM. But when I set active to Flash_Lib, TX still working, RX stop working.

When run from Flash, call function SCI_getRxFIFOStatus always get zero. But it works fine when run from RAM.

Appreciate for any suggestion.

Best,

Zong

  • Zong,

    Did you try to use a scope and check if the incoming data on the RX pin is as expected or not?

    Also, please try mapping your ISRs to RAM (load to flash and run from RAM) and see if that helps to fix the issue.

    Thanks and regards,

    Vamsi

  • Hi Vamsi,

    Thanks for you help.

    I did check incoming data using scope.

    Can you more specific how to mapping ISRs to RAM? I don't know how to do that. Is there any document?

    Best,

    zong

  • Zong,

    In the flash based linker cmd files in C2000Ware, you can notice that there is a section called .TI.ramfunc - this has a different load address and run address. You can use flash as the load address and RAM as the run address.  By mapping the ISRs to this section, you can load the ISRs to flash, but execute them from RAM - Linker uses the run RAM address for the execution.  User application should call memcpy() to copy the contents from flash to RAM before calling/using those functions in the application.  This way you can eliminate the flash wait-state penalty while executing the ISRs - and this allows more bandwidth for CPU to execute all ISRs (suggested this in case other ISRs are occupying most of the CPU bandwidth).    

    Please take a look at C2000Ware examples.  Ex: C000Ware_3_02_00_00\driverlib\f28004x\examples\flash\flashapi_ex1_program_autoecc.c

    In this file, you can see that Example_CallFlashAPI(void) is mapped to .TI.ramfunc section as shown below:

    #ifdef __cplusplus
    #pragma CODE_SECTION(".TI.ramfunc");
    #else
    #pragma CODE_SECTION(Example_CallFlashAPI, ".TI.ramfunc");
    #endif
    void Example_CallFlashAPI(void)

    In the linker cmd file, you can see that the .TI.ramfunc section has different LOAD (flash) and RUN (RAM) addresses.  

    GROUP
    {
    .TI.ramfunc
    { -l F021_API_F28004x_FPU32.lib}

    } LOAD = FLASH_BANK0_SEC1,
    RUN = RAMLS03,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    RUN_SIZE(_RamfuncsRunSize),
    RUN_END(_RamfuncsRunEnd),
    PAGE = 0, ALIGN(4) 

    And in the example main(), you can see that Device_init() calls memcpy() to copy the .TI.ramfunc contents from flash to RAM.  

    //
    // Main
    //
    void main(void)
    {

    //
    // Initialize device clock and peripherals
    // Copy the Flash initialization code from Flash to RAM
    // Copy the Flash API from Flash to RAM
    // Configure Flash wait-states, fall back power mode, performance features and ECC
    //
    Device_init();

    You can also take a look at https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/878674

    Thanks and regards,

    Vamsi