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.

Compiler/TMS320F280049C: 280049 CLA can handle structures of data ?

Part Number: TMS320F280049C

Tool/software: TI C/C++ Compiler

Hello,

I continue with Adca trigerring CLA.

It sounds that CLA doen not handle registers located in structures.

For the same location and code, if I put registers in structures, data are not transfered correctly to main CPU.

(I've used integer type) Is that real or do I make a mistake ?

Best regards

francois 

  • Hi Francois,

    Not all registers are accessible by CLA. Please refer to the device data sheet for more details. The section Peripheral Registers Memory Map in the datasheet lists out all the register sets and whether CLA has access to it or not

    Regards,

    Veena

  • Hello Veena,

    I've put the registers in the correct definition section

    #pragma DATA_SECTION(ClaOut, "Cla1ToCpuMsgRAM");
    StructClaOut ClaOut;
    #pragma DATA_SECTION(Temp, "Cla1ToCpuMsgRAM");
    uint Temp;

    But just putting a register in a stucture ant it's not more recognized ?

    (Same section controlled in .map file, And it doesn't return any compilation error)

    Best regards 

    francois

  • Hi Francois,

    Let me know if I got your question right.

    You have a user defined struct StructClaOut  and you are declaring an instance and mapping it to CLA-CPU MSGRAM. CLA is writing some data to this struct and it is not getting reflected in the MSG RAM. Is that right?

    Can you check at what address the ClaOut is allocated? It will be mentioned in the map file.

    Regards,

    Veena

  • Hello Veena,

    Yes, good, you got exactly my question.

    I've checked the map file and it's at the correct location for CLA to RAM.

    00001480      52 (00001480)     _TempPp
    00001482      52 (00001480)     _ClaOut

    1     00001482  _ClaOut        

    If I just move my register into a structure, value doesn't seems to be transfered.

    Regards,

    francois                    

  • Hi Francois,

    After CLA writing the data to the struct, can you check the memory contents (using Memory Browser) at 0x1480 from CLA and from CPU?

    Regards,

    Veena

  • Hello Vienna,

    Humm …..

    Not so easy because my system (280049 DSP) is connected to 400 VAC  3 phases and I don't work with debugger ….

    I'll check if my software could run on eval board

    francois

  • Hi Francois,

    I believe it should be an issue in CLA writing to the MSG RAM. I think there might be some issue in getting the correct address to write to. If CLA has written the data in the correct address, I do not see any reason why it is not getting reflected at CPU.

    Regards,

    Veena

  • Hi Veena,

    I've tested on my smell evan board, here are my results :

    Structure ClaOut

    typedef struct
      {
      int IIn[3];
      int UIn[3];
      int VIn[3];
      uint Temp;
      } StructClaOut;

    ClaOut is at correct location (in .map file)

    1     00001480  _ClaOut                            

    CLa Task 1

    __attribute__((interrupt)) void Cla1Task1 ( void )
    {
    __mdebugstop();
    ClaOut.Temp = AdcbResultRegs.ADCRESULT7 + 11;  /* Should be ~3300 + 11 = ~3011 */
    }

    Value of ClaOut at end of CLA Task1 return interrupt (breakpoint in debugger)

    0x00001480 ClaOut
    0x00001480 00000000 00000000 00000000 00000000

    Best regards,

    francois

  • Confirm that the shared global struct is defined in the C28x code (not the CLA code). 

    See this FAQ:

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/795553?tisearch=e2e-sitesearch&keymatch=faq%3Atrue

    The latest compiler tool has a diagnostic to help identify this issue:

    Please also see these two threads:

    https://e2e.ti.com/support/tools/ccs/f/81/t/900270?tisearch=e2e-sitesearch&keymatch=10462

    https://e2e.ti.com/support/tools/ccs/f/81/t/897582?tisearch=e2e-sitesearch&keymatch=10462

    Regards

    Lori

  • Hello,

    Yes, the definition of the Structure is located in the C28x side.

    I've put in parallel 3 types with exactly the same déclarations :

    - single register (uint)
    - array(uint)
    - structure

    Declaration c28x side

    typedef struct
      {
      int IIn[3];
      int UIn[3];
      int VIn[3];
      uint Temp;
      } StructClaOut;

    #pragma DATA_SECTION(ClaOut, "Cla1ToCpuMsgRAM");
    StructClaOut ClaOut;
    #pragma DATA_SECTION(Temp, "Cla1ToCpuMsgRAM");

    uint Temp;
    #pragma DATA_SECTION(TempT, "Cla1ToCpuMsgRAM");
    uint TempT[2];

    Load of CLA registers in CLA task 1 (value of temp sensor B14)

    ClaOut.Temp = AdcbResultRegs.ADCRESULT7 + 10; //AdcaResultRegs.ADCRESULT0 + AdcaResultRegs.ADCRESULT1;
    TempT[1] = AdcbResultRegs.ADCRESULT7 + 20;
    Temp = AdcbResultRegs.ADCRESULT7 + 30;

    Result when Breaking in CLA task1 interrupt return

    0x00001480 Temp
    0x00001480 0000101D 00001013 00000000 00000000
    0x00001488 00000000 00000000 00000000 00000000
    0x00001490 00000000 00000000 00000007 00000000
    0x00001498 00000000 00000000 00000000 00000000
    0x000014A0 00000000 00000000 00000000 00000000

    Map file sounds correct

    00001480      52 (00001480)     _Temp
    00001481      52 (00001480)     _TempT

    00001483      52 (00001480)     _ClaOut

    Single register and array value are transfered correcly, structure is not. If this can give you more informations ….

    Best regards

    francois

  • Francois,

    Apologies for the few days delay in getting back.  I wanted to check and see if you are still having the same issue. 

    I noticed the code uses uint - which is different sizes on the C28x and the CLA. 

    Please see this faq on using c99 datatypes:

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/795567

    and sharing global variables:

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/795553

    Thank you

    Lori

  • Hello Lori,

    Thank you for your response.

    I think my problem comes from int : it has different size in C28x and in CLA and it was the source of my issue.

    I've declared long everywhere and it's better.

    If I've always the same problem, I'll ga with an array but I think it'll be OK with structures

    (not yet fully tested, lot of days off in May here in France …)

    Best regards

    francois