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.

TMS320F28069: Defining shared variables in CLA code

Part Number: TMS320F28069

Hi All,

I have a query about the CLA implementation.
Based on cla_software_dev_guide chapter 4.5, it is recommended to define shared variables in C28x.c code instead of CLA code.
https://software-dl.ti.com/C2000/docs/cla_software_dev_guide/faq.html

I am just wondering what will happen if the shared variables are defined in the C28x code.
to share from my perspective, my code defines the shared variables in the C28x code. It can work on most produced boards (a few thousand in quantity), however, I found some boards (around 20) that show some variables (ClaToCpu1MsgRam) turned to 0.

My concern is in the consistency of the MCU, why if it's not recommended practice it can still work on most MCUs, and why it does not work in some MCUs.

Thanks and cheers!
Luiz



  • Hi Luiz,

    Variables defined in .cla file is only accessible to CLA and cannot be initialized. You need to initialize it within a CLA task.

    Regarding the issue with only selected boards, is it reproducible all the time, or are they random behavior?

    Regards,

    Veena

  • Hi Veena,
    sorry, what I mean above in the question is what will happen when I define shared variables in the cla code.

    So far, my implementation is to define the shared variables in the cla, something like this.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /********************************************************************
    test.cla
    CLA C-code Source File
    ********************************************************************/
    #pragma(X,"CpuToCla1MsgRam") // Assign X to section CpuToCla1MsgRam
    float X;
    #pragma(Y,"Cla1ToCpuMsgRam") // Assign Y to section Cla1ToCpuMsgRam
    float Y;
    __interrupt void Cla1Task1 ( void )
    {
    float f1;
    Y = f1 * X;
    }
    /********************************************************************
    shared.h
    C28x and CLA Shared Header File
    ********************************************************************/
    extern float X;
    extern float Y;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Out of a few thousand normal boards, some boards (~20) have Cla variables issue.

    In these few boards, one or two ClaToCpu1MsgRam variables will return ZERO value. This is reproducible all time.

    it makes me wonder if my implementation is not recommended practice, why it can still work and return normal values on most of MCUs.

    Regards,
    Luiz

     

  • The issue in defining shared variables in .cla code, is that you may not be able to refer to these variables from the c28x code. 

    Note from the CLA examples :

    // Note that the globals defined in the .cla source are global to the cla source
    // file. i.e. they may be shared across tasks. All of the data shared between
    // the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
    // CLA code.

    Let me check with the hardware experts on why you face issue with some boards.

    Regards,

    Veena

  • Thanks, Veena 

    All of the data shared between
    // the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
    // CLA code.

    I can confirm when shared variables are defined in C code, all shared variables return the correct value in several board samples.

    may not be able to refer to these variables from the c28x code.

    so, I believe there is a probability on this matter, It can not be said that the definition in CLA code will certainly block access to shared variables.


    for reference, I attached the part number that can be classified into:
    1. normal: return shared variables are all normal, even with variables defined in CLA code.
    2. CLA issue: one or two shared variables return ZERO values, with variables defined in CLA code.

    all serial number is the same, showing they are from the same reel/batch.


  • Hi Veena, any news from hardware experts?

    regards,
    Luiz

  • Hi,

    Apologies for the delay.

    Ref the compiler guide www.ti.com/lit/spru514

     

     

    It is recommended to keep shared variables in C28x source file, and not in the CLA source file.

    Hope this helps.

    Regards,

    Veena

     

  • Hi Veena,
    I understand the guidelines from Ref the compiler guide www.ti.com/lit/spru514.
    But it does not explain the inconsistencies between boards.
    let me know if there's any enlightenment from hardware experts.

    Let me check with the hardware experts on why you face issue with some boards.

    Thanks a lot,
    Luiz