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.

TMDSPREX28335: The DCL library does not work properly after the program is loaded to Flash

Part Number: TMDSPREX28335


Hi TI team,

I used to use the digital control library (DCL) to realize a simple PI control algorithm. It worked when I used the 28335_RAM_Ink.cmd file to load the program in RAM. It also worked when I used the "F28335.cmd" while debugging with my computer. However, after I unplugged the emulator and powered it back on, the function "DCL_runPI(PI *p, float rk, float yk);" didn't work. And The program was stuck. Below is part of my cpu timer0 ISR program where the PI control command is used. When the program runs to the underlined sentence, it will be stuck and the serial communication will stop.

I checked the .cmd file and .map file, it seems OK and shows no error on CCS. 

.cmd file:" dclfuncs : > RAML2,     PAGE = 0"

and the .map file: "  RAML2                 0000a000   00001000  0000003a  00000fc6  RWIX" which shows 58 word-size as suggested in the DCL User's Guide.

“0 0000a000 _DCL_runPI ”

Can anyone help me figure out what possibly caused this issue? Thank you so much !

Best,

Chang

  • The issue has been resolved by copying the corresponding code section (dclfuncs) from Flash to RAM. The modified .cmd file is:

    " dclfuncs : LOAD = FLASHE,
    RUN = RAML2,
    LOAD_START(_dclfuncsLoadStart),
    LOAD_END(_dclfuncsLoadEnd),
    RUN_START(_dclfuncsRunStart),
    LOAD_SIZE(_dclfuncsLoadSize),
    PAGE = 0"

    and in main.c file, a memory copy code is used:

    "

    InitPieVectTable();
    MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    MemCopy(&dclfuncsLoadStart, &dclfuncsLoadEnd, &dclfuncsRunStart);
    InitFlash();

    "

    Also, the relevant variables need to be declared at the beginning:

    "

    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;

    extern Uint16 dclfuncsLoadStart;
    extern Uint16 dclfuncsLoadEnd;
    extern Uint16 dclfuncsRunStart;

    "

    If anyone encounters a similiar issue, hope this will be helpful !