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: 28XX CLA function call in CLA task

Part Number: TMS320F28377S
Other Parts Discussed in Thread: MATHLIB, C2000WARE

I'm using 28377S .  in Cla task i want to call  func0, then in  func0 ,I call func1-5.

__interrupt void Cla1Task1()

{

...

func0()

...

}

func0()

{

...

func1(a,b,c)

...func2()

}

if func1 has a return value, egg,if i write a= func1func1(a,b,c) in func0(),the prog fleet.  why, functions in the cla are not allowed to have return values?

  • Please confirm which version of the compiler you are using. There have been enhancements made to the compiler over time. The latest version is 22.6.0.LTS. 

    All restrictions and limitations are listed in the CLA section of the compiler reference guide: www.ti.com/lit/spru514.

    Regards

    Lori

  • thanks for your reply.

    I'm using CCS 8.3.1,I change the compiler for V18 to  22.6.0.LTS.  it  still didn't work. dan it come out several warnings(below)

    in my clatask1 prog , it calls  VgPLLCal(&alg_data_grid, &VgPLL); the prog runs to VgPLLCal(&alg_data_grid, &VgPLL), but it fleet 

    I put pData->Vgab = 10X.0 symbols to get where the prog runs, then  i can see pData->Vgab = 103.0(means it runs to  the line before calling abc_to_d(p->Vga_pu, p->Vgb_pu, p->Vgc_pu, p->Theta_grid,p->Vgpd_pu0);)

     

    considering the warning(related to sin cos sqrt ...  mathlib),  and the  abc_to_d()func used sin cos func , is it possible the reason is using sin cos funcs, so the prog fleet?  and how to solve the warning related to mathlib(sin cos sqrt)?

    wish to get your reply.

  • It looks like the code is making calls to the C28x math routines which is not allowed. For CLA there is a math library located in this directory:

    C:\ti\c2000\C2000Ware_<version>\libraries\math\CLAmath

    Regards

    Lori

  • Yes, I use CLAsin cos and inclueded CLAmath.h,then it works.  but func CLAsqrt() still don‘t work.  i open the CLAmath.h  and found that sqrt() don’t have a table(just sqrt func prototype), unlike sincos funcs.   

    I refer to the docu  CLA Math Library USER’S GUIDE,but  i still fail to cope with it.

  • but func CLAsqrt() still don‘t work. 

    Please provide more detail on how it is not working.

    Does the compiler issue an error/warning? If so, what is the error/warning?

    or is the result incorrect?

    Does the example project work as expected?

    C:\ti\c2000\C2000Ware<version>\libraries\math\CLAmath\c28\examples\sqrt\ccs

    i open the CLAmath.h  and found that sqrt() don’t have a table(just sqrt func prototype)

    The CLAsqrt routine does not use a lookup table. You can view the algorithm in the source code comments. 

    C:\ti\c2000\C2000Ware<version>\libraries\math\CLAmath\c28\source

  • in the clatask1() interrupt func, I call VgPLLCal(), and in VgPLLCal() I use CLAsin\ CALcos and CLAsqrt,  CLAsin\ CALcos works well,but when calling  CLAsqrt, the prog fleet. in the VgPLLCal() below:

    I can see in the watch expression   pData->Vgab = 138.0,  which prove that the prog runs to  Line1340 and then fleet,. if not if it runs to L1342,then  pData->Vgab = 128.0

    when build the project, there are warnings(fig below1 ): clamath .h and lib used(fig below2)  , cms file (fig below3)

     

  • Hello Freeman,

    By 'fleet' do you mean 'stops' ?

    Here are some debug suggestions. 

    1 - Try the example project as provided and see if it works as expected

    • C:\ti\c2000\C2000Ware<version>\libraries\math\CLAmath\c28\examples\sqrt\ccs

    2 - Modify the input values in the example function to be similar to yours - does it still work?

    3 - Modify the inputs to the CLA sqrt function to something simple to see if your code continues to line L1342. This will help narrow down the problem.

    4 - View the CLA PC when the project stops and view the assembly at that location.

    5 - Single step through the CLA sqrt function to determine where things go wrong. 

    Regards

    Lori