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.

TMS320F28P650DK: CLA function not executing properly

Part Number: TMS320F28P650DK
Other Parts Discussed in Thread: TIDA-010936

Tool/software:

Hello TI experts,

Hope you're doing well. I need help regarding the CLA and linker command file.

  1. when the scratchpad is used as a stack, What is the difference between the CLA scratchpad and the stack?

  2. I’m trying to port a function from the main CPU to the CLA, and the build completes successfully. However, when I run the code, only part of the function executes. To debug, I placed a test variable at different locations within the function, and I observed that it gets updated only up to a certain point.

    For simplicity, the function consists of 10 static inline function calls. To diagnose the issue, I commented out different function calls randomly and tested multiple times. Each time, the entire code worked fine, which indicates that the functionality of the individual functions is intact. Could this be a size-related issue? If so, is there a way to check whether the function exceeds any memory limitations?

  3. To fit the code in, in linker cmd file, I grouped two- two sections as one, memory allocation after build shows no segment occupies more than 50%. 

here test_var_1 is the test variable which I placed, this variable updates to the end when part of code is commented and gets stuck when i put the entire code. I'm suspecting it could be size issue. correct me if I'm wrong

Any insights would be greatly appreciated.

Thanks!

  • HI Raghu,

    To check if a memory section is exceeded, you can open the Memory Allocation window within CCS (View -> Memory Allocation).

    Check out this document for more information on different steps to consider when porting the main code to the CLA /cfs-file/__key/communityserver-discussions-components-files/171/CLAProjectStructureUG.pdf 

    Please ensure that the combining of memory sections is done correctly. This document explains how to properly combine memory sections: https://software-dl.ti.com/ccs/esd/documents/c2000_c28x-compiler-understanding-linking.html 

    See this document for an explanation on the CLA Scratchpad vs CPU stack: /cfs-file/__key/communityserver-discussions-components-files/171/scratchpad-link.pdf 

    Regards,

    Ozino 

  • Hi Ozino,

    Thanks for replying. those references are really helpful but I already had those.

    1. All variables initialed in CPU and shared to CLA using #pragma's and extern in CLA ISR file (NO STATIC variables) -CHECK
    2. All functions STATIC INLINE - CHECK
    3. only LS sections of RAM were allocated to CLA(refernec from TRM) - CHECK




    4. Memory allotment was correct , attached memory allocation window after build (when all the code was kept)

    When part of code was commented,, code was working correctly

    in the above snapshot, two test variables task3_cnt & task4_cnt were incrementing as expected.

    but when everything is kept and RUN, these variables would never increment.

    Thanks in advance,

    Raghu

  • Hi ,

    Update :  The issue is solved, the SECTIONS of RAM which were allocated to CLA as program memory and program data were to given access to CLA from main CPU.

    Thanks!

  • Hi Ozino,

    Following up on our previous discussion, I no longer have size constraints, so I'll try to explain my issue more clearly.

    I'm implementing position control for a BLDC motor using the FOC algorithm, referencing the TIDA-010936_GANHFMD from MCSDK. Initially, everything was working fine on CPU1. Then, I wanted to offload the entire FOC processing to the CLA , which was previously running on CPU1 so that I can make use of main CPU to other application related tasks.

    Using TI's references, I ported the entire FOC logic into the CLA as static inline functions. I can successfully read voltages and currents from the ADC and other parameters but there is no output the motor stalls and draws high currents. The same inline functions work fine when executed from the main CPU which convinces me that the functionality is intact. 

    Issues and Doubts:

    1. While the CLA task is running, several variables that worked fine when executed on CPU1 are behaving differently in the CLA. For example, CUR_LOOP_BANDWIDTH, which was 3500 in CPU1, does not work in the CLA; instead, a value of 10 works. This issue extends to several other variables.
    2. Do ENUMs not work properly in the CLA? I had to replace them with MACROs to make them work.
    3. When using uint16_t, I observed incorrect variable values. To avoid this, I am currently using only uint32_t and float32_t. Is there a known issue with uint16_t in the CLA?

    Any insights or recommendations would be greatly appreciated.

    Thanks & Regards,
    Raghu

  • HI Raghu,

    Please ensure that you've updated your linker command file to allocate a section for ClaProg and the scratchpad.

    Additionally, check out the CLA user's guide for more information on the data type differences: https://software-dl.ti.com/C2000/docs/cla_software_dev_guide/faq.html 

    You will find more information on the restricted data types.

    Regards,

    Ozino