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.

TMS320F28377S: CLA -> MPU communication

Genius 5910 points

Part Number: TMS320F28377S

I have the following problem:

When I have a bunch of variables the communication works fine between cla and MCU. Only If I put those variables in a struct, it doesn't work any more. All the variables are 32 bit .

 I assign the following:

typedef struct{
    uint32_t         res_iqangle_pu;
    uint32_t         res_anglelength;
    int32_t          res_speed_hz;
    int32_t          res_poserror_cnts;
    int32_t          res_zero_cnts;
    motorpos_t       res_pos_cnts;
} volatile resolver_result_t;

#pragma DATA_SECTION(resolver_result,"Cla1ToCpuMsgRAM")
#pragma DATA_ALIGN (resolver_result,4)
volatile resolver_result_t               resolver_result;

How do  solve this?

Thanks.

  • evs,

    What is the datatype of motorpos_t?  

    A couple of debug suggestions: 

    • Read this FAQ to see if the data type differences applies in any way. https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/795567
    • How does the code 'not work'? 
      • Does the CLA write to the wrong location? Stepping through the code, observe where values are being written vs what the C28x expects (or vice versa)
      • Or is the right location being written to but with the wrong value?
    • Take a look at the workshop - specifically section 5 for tips and tricks. This video deals with some of the common issues users face when writing code for the CLA. It is a compilation, and investigation, of some of the most commonly asked questions on the forums and should help you get to working code quickly. https://training.ti.com/control-law-accelerator-cla-hands-workshop

    More CLA FAQs and resources are available here 

    Regards

    Lori

  • Lori,

    As in my initial question all values are al  32 bit value's. Thanks,  I understand the basic's of debugging. "not work" is that the value written by CLA is not the same as read by the controller.

    So when I make all those variables individually defined  reading the values are correct. But if I make a struct out of them 32 bit alligned  for CLA it doesn't.

    Lori can you please forward my question to George Mock. Because I think it is a CLA <-> MCU struct offset issue.That is strange because there all all 32 bit values.

    Thanks

  • I'm sure the data layout of the struct matches.  But that is not the only possible problem.

    Global data that is shared between the C28x and CLA must be defined in the C28x code, and not the CLA code. The way data pages work on each device does not match.  It is more constrained on the C28x side.  Thus, data defined on the C28x side can be accessed on the CLA side, but not the other way around.

    Thanks and regards,

    -George