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: Add PI Controller using CLA to FreeRTOS project running on C28x CPU 1

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi,

I have a FreeRTOS project running on CPU 1. I would like to add a PI controller using CLA from DCL library to it.

Is there an example project for F2837xD that I can follow?

Regards,

Rashmitha

  • Hi Rashmitha,

    We do not have a F2837xD based example. Here is a CLA based PI example in F28069 device in C2000ware

    C:\ti\c2000\C2000Ware_4_01_00_00\libraries\control\DCL\c28\examples\F28069_PI_CLA

    Best regards,

    Han

  • Hi ,

    Thanks for your reply.

    I am referring to the example that you suggested and also referring to CLA example given for F2837xD to understand the linker file changes needed.

    I see that DCLCLA.h file gives below prototypes for implementing 2 parallel PID loops

    extern float32_t DCL_runPID_L1(DCL_PID_CLA *p, float32_t rk, float32_t yk, float32_t lk);

    extern float32_t DCL_runPID_L2(DCL_PID_CLA *p, float32_t rk, float32_t yk, float32_t lk);

    I would like to know if its possible to use 3 PI loops at the same time.

    Also, are there any examples for multiple PI loops running simultaneously?

    Regards,

    Rashmitha

  • Hi Rashmitha,

    The L1 and L2 have slightly different topology, and is not designed for implementing multiple PI loop. Please refer to the DCL user's manual Figure 7 and 8 for more details.

    To implement multiple PI loop, you can create multiple instance of DCL_PID_CLA construct for each loop, and point to the corresponding one when running the loop. Thanks.

    Han

  • Hi 

    Thanks for your reply. Sure I will use multiple instances instead of L1/L2.

    I am getting some warnings w.r.t. the changes made in the linker file as below.

    My linker file is as given below, I added parts of the linker file from the CLA included projects into my original linker file

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #ifdef CLA_C
    // Define a size for the CLA scratchpad area that will be used
    // by the CLA compiler for local symbols and temps
    // Also force references to the special symbols that mark the
    // scratchpad are.
    CLA_SCRATCHPAD_SIZE = 0x100;
    --undef_sym=__cla_scratchpad_end
    --undef_sym=__cla_scratchpad_start
    #endif //CLA_C
    MEMORY
    {
    PAGE 0 : /* Program Memory */
    /* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */
    /* BEGIN is used for the "boot to Flash" bootloader mode */
    BEGIN : origin = 0x080000, length = 0x000002
    RAMM0 : origin = 0x000123, length = 0x0002DD
    RAMD0 : origin = 0x00B000, length = 0x000800
    RAMLS0 : origin = 0x008000, length = 0x000800 //2kb
    RAMLS1 : origin = 0x008800, length = 0x000800
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Could you please guide me to get rid of the warnings above? Is there some other .cmd file that needs to be included for CLA support?

    The .out file generated with this linker file is unable to show any symbols when loaded on the processor. 

    Could you also point out if there is any mistake in the linker file which has resulted in symbols missing? Because the original linker file before adding CLA related lines was working fine and showing symbols.

    Regards,

    Rashmitha

  • Hi ,

    Thanks for your response. I defined the symbol in Command File preprocessing and even tried removing the #ifdefs.

    The symbols are still missing. When I load the code I see below screen in the debug window

    Regards,

    Rashmitha

  • Hi Rashmitha,

    1. Please check if the application is being built for debug with debug symbols enabled in the compiler settings

    2. Can you try loading symbols from CCS menu?

    Thanks,
    Ashwini

  • Hi ,

    1. 

    2. When I loaded separately from the CCS menu, I can see the symbols. Why is this happening? The project was loading the symbols on it own before adding the CLA

    Although I don't see any symbols for the CLA

    Regards,

    Rashmitha

  • Hi Rashmitha, the CLA is at this time pointing to a location where there is no code hence no symbols are appearing. When the CLA starts executing and if it halts at a location where there is real code, symbols should show up.

    Thanks,

    Ashwini

  • Hi ,

    I am now using 2837xD_FLASH_CLA_lnk_cpu1.cmd from C:\ti\c2000\C2000Ware_4_00_00_00\device_support\f2837xd\common\cmd

    I have added a few lines in this to add my sections.

    I am using below functions to configure the CLA

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //
    // configClaMemory - Configure CLA memory
    //
    void configClaMemory(void)
    {
    #ifdef _FLASH
    extern uint32_t Cla1funcsRunStart, Cla1funcsLoadStart, Cla1funcsLoadSize;
    //
    // Copy over code from FLASH to RAM
    //
    memcpy((uint32_t*) &Cla1funcsRunStart, (uint32_t*) &Cla1funcsLoadStart,
    (uint32_t) &Cla1funcsLoadSize);
    #endif //_FLASH
    #ifdef CPU2
    //
    // Enable CPU2 clocking at the sys clock level
    //
    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CLA1);
    #endif //CPU2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And then in a .cla file I have the CLA Task defined as below

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    __interrupt void Cla1Task1(void)
    {
    __mdebugstop();
    // run the PI controller
    uk1 = DCL_runPI_L1(&pi1, rk1, yk1);
    uk2 = DCL_runPI_L1(&pi2, rk2, yk2);
    uk3 = DCL_runPI_L1(&pi3, rk3, yk3);
    __mnop();
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I can compile the project without any errors or warnings. I can see CPU and CLA running. The control reaches the CLA Task and stops there on every run even when there is no breakpoint.

    How to get past this inbuilt breakpoint like behavior?

    Regards,

    Rashmitha

  • Hi Rashmitha,

    IN the Cla1Task1 C code snippet above I see that the code includes _mdebugstop() instruction. This is a software breakpoint instruction and hence the CLA task is halting each time it executes.

    Thanks,
    Ashwini