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/TMS320F28075: Structure size of CLA

Part Number: TMS320F28075
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hi,

I'd like to know the max size of structure in CLA?

Compiler version can be V18 or newer one.

Another doubt, in CLA, can we define a point, which is pointed to PWM module? I think yes. 

Thanks a lot.

Br, Jordan

  • Jordan Zhou said:
    I'd like to know the max size of structure in CLA?

    This would be limited by the amount of data RAM available for the structure.

    Jordan Zhou said:
    Another doubt, in CLA, can we define a point, which is pointed to PWM module? I think yes. 

    Yes.  Are you having some difficulty doing this?

    Regards

    Lori

  • Lori,

    Thanks a lot.

    We faced some issues. The structure size now is 220 words. If new variables are placed at the end, it's not possible to assign a value in CLA. If not at the end, it can be. 

    If it's not the limitation of structure size, let me try some others ways.

    Thanks again.

    Br, Jordan

  • Jordan - ok let me know what you find. 

  • Lori,

    Do you have any example code on how to use point for PWM registers, in CLA?

    What should be the type of the variable? Uint32 or Float?

    volatile structure EPWM_REGS *pPWM; Is it OK?

    Thanks a lot.

    Br, Jordan

  • It doesn't look like our basic examples in C2000ware have this.  Give me a day to put something simple together. 

    The type would correspond to the content of the register being pointed-to which would be uint32_t.   i.e. pointer to type uint32_t.

    -Lori

  • Thanks Lori.

    In our demo code, the absolute address of the PWM module is used, with the offset to access the rigister, like

    HWREGH(base + registerOffset + 0x1U) = compCount;

    But, we'd like to use point instead. Please help to provide the official way.

    Thanks again.

    Br, Jordan

  • Jordan,

    My suggestion is to leverage the bit-field structures we already support.  To add this to a driverlib project these would be the steps:

    I started with the following project - cla_ex1_asin (C:\ti\c2000\C2000Ware_3_03_00_00\driverlib\f2837xd\examples\cpu1\cla).  For my example I used the F2837xD device.  Change this as applicable.

    1. Add directory for device_support bit-field structs to the project properties: Resource -> linked resources

    • Add C200WARE_DEVICESUPPORT_ROOT with location ${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INSTALL_DIR}\device_support\f2837xd
    • Apply and close before adding the next two properties

    2. under C2000 Compiler -> Include Options add these two directories

    • ${C2000WARE_DEVICESUPPORT_ROOT}/common/include
    • ${C2000WARE_DEVICESUPPORT_ROOT}/headers/include

    3. Add these support files to the project.  (right click on project, add file)

    Note – for this step I suggest “link to file” when prompted. This keeps the file in its original location.  

    • C:\ti\c2000\C2000Ware_3_03_00_00\device_support\f2837xd\headers\cmd \F2837xD_Headers_nonBIOS_cpu1.cmd
    • C:\ti\c2000\C2000Ware_3_03_00_00\device_support\f2837xd\headers\source\F2837xD_GlobalVariableDefs.c

    4. Add #include F28x_Project.h to the .cla file.  This in-turn includes the typedefs for the CLA. 

    In file asin.cla 
    
    //
    // Included Files
    //
    #include "cla_ex1_asin_shared.h"
    #include "F28x_Project.h"
    

    That's it.  I added a few experimental writes in Cla1Task1() to test it out:

        EPwm1Regs.TBCTR = 0x1234;
        EPwm1Regs.CMPA.all = 0x9ABCDE00;
        EPwm1Regs.CMPB.bit.CMPB = 0x2233;
        EPwm1Regs.CMPB.bit.CMPBHR = 0x4400;
        __meallow();
        EPwm1Regs.DCBLTRIPSEL.all = 0x5432;

    Regards

    Lori

  • Edited my last response to fix formatting.

  • Lori,

    Thanks a lot.

    Yes, you are right. This works. I also suggested them to do in this way.

    But, they'd like to defeine a structure (named as user_parameter), and a ePWM point inside: struct EPWM_REGS * pEpwmW, which is pointed to ePWM 1.

    They'd like to use in this way: user_parameter.pEpwmW.CMPA.all=0x123;

    How to do it?

    Thanks a lot.

    Br, Jordan

  • Jordan,

    Just create a pointer to the struct and assign the address of EPwm1Regs to that pointer. 

    i.e. 

    __interrupt void Cla1Task1 ( void )
    {
    
    //
    // Create a pointer (myPwm) to a struct (EPWM_REGS - defined in our header file) 
    // and assign the address of EPwm1Regs to the pointer.
    // This assumes the device support headers have been added to the
    // project as described in the previous post.
    //
    
        volatile struct EPWM_REGS *myPwm = &EPwm1Regs;
    
        myPwm->TBCTR = 0x1234;
        myPwm->CMPA.all = 0x9ABCDE00;
        myPwm->CMPB.bit.CMPB = 0x2233;
        myPwm->CMPB.bit.CMPBHR = 0x4400;
        __meallow();
        myPwm->DCBLTRIPSEL.all = 0x5432;

  • Lori,

    Today I did some tests on customer's code, and found that, it should not be an issue of point, but compiler.

    After defining a point, like float *avalue, the length of the point in memory map is 16bit. It should be 32bit, my point of view. Then, other parameters under avalue's value was copied to avalue. 

    It's closed here.

    Thanks for your support.

    Br, Jordan

  • Jordan Zhou said:
    After defining a point, like float *avalue, the length of the point in memory map is 16bit. It should be 32bit, my point of view. Then, other parameters under avalue's value was copied to avalue. 

    Hi Jordan,

    For CLA the size of the pointer itself will be16-bits.  The CLA only has a 16-bit address bus.  

    Regards

    Lori

  • Lori,

    If CLA has 16-bit address, can float *avalue be used inside CLA?

    float *avalue is a shared value between C28 and CLA. Inside C28, it's 32-bit, but 16-bit in CLA.

    Is it conflict?

    Br, Jordan