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.

Error in using sine and cos

Other Parts Discussed in Thread: CCSTUDIO

 I am only using math.h....

If I use the commented lines, I am getting the desired wt waveform, but when I use the above code, frequency of wt waveform is not as expected.

Is it because of increase in trigonometric calculations

Pls reply

Thanks

  • Use IQ library 

    Gastón

  • Actually, i dont want to use iq math.
  • do some partition of the maths (perform more steps, this will help you to easily debug the code also). e.g sina_ref = (Vrd* cos(wt)-Vrq* sin(wt))* 0.8164965809; will be Cos_wt = Vrd* cos(wt) and Sin_wt = Vrq* sin(wt) then you do sina_ref = (Cos_wt - Sin_wt)*0.8164965809
    Gastón
  • Thank you , I will try it out.
    What do u think is the cause of the problem.
  • problem still remains...after the partitioning
    when i include sin (wt), cos(wt)....result is correct. But when i include sin (wt-2.094395102),it seems wt itself is getting affected....and result is erroneous.I have declared (wt) as float

  • Hi Shyam,

    Are you using the latest compiler? if not can you upgrate to the latest and see if the issue persists?

  • I can see the desired waveform with correct frequency in the graph of ccsv3.3, but in DAC and also when i actually run the inverter, result is same as in DAC, which is erroneous

  • Im trying to figure out if there is an issue with the compiler. If you can use v15.9.0.STS and see if you are still seeing the same issue, then we can proceed with looking at the disassembly for the code

    you can download the latest compiler herE:

    software-dl.ti.com/.../download.htm
  • i placed the folders (bin, lib and include) in....C:\ccstudio_v3.3\c2000\cgtools......renamed the existing folders to bin1,lib1..etc

  • i am getting lot of warnings on compiling:

    [Linking...] "C:\CCStudio_v3.3\C2000\cgtools\bin\cl2000" -@"Debug.lkf"

    <Linking>

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      boot.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      cos.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      exit.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_add.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_cmp.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_div.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_mpy.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_neg.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_toi.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_tol.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      fs_tou.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      i_tofs.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      sin.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      _lock.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

      "C:\CCStudio_v3.3\DSP2823x_examples\mk_example_vbyf_noload_park\rts2800.lib<

      args_main.obj>": compatibility cannot be determined

    warning: creating output section ".bss" without a SECTIONS specification

    warning: creating ".stack" section with default size of 0x400; use the -stack

      option to change the default size

    Build Complete,

     0 Errors, 20 Warnings, 0 Remarks.

  • sounds like you are using a very old rts library. The warning is described here:

    processors.wiki.ti.com/.../C28x_Compiler_Error_and_Warning_Messages


    Have you copied the RTS library to a local folder? I would delete that and use the one that comes with the code gen tool.
  • I removed the existing rts lib file and added rts2800_fpu32.lib and rts2800_ml.lib to the libraries folder in ccs environment...

    After compiling , i am getting error:  

    <Linking>

    error: file "C:\CCStudio_v3.3\C2000\cgtools\lib\rts2800_fpu32.lib<boot.obj>"

      specifies ISA revision "C28FPU32", which is not compatible with ISA revision

      "C2800" specified in a previous file or on the command line

    error: file "C:\CCStudio_v3.3\C2000\cgtools\lib\rts2800_fpu32.lib<cpy_tbl.obj>"

      specifies ISA revision "C28FPU32", which is not compatible with ISA revision

      "C2700" specified in a previous file or on the command line

    error: file

      "C:\CCStudio_v3.3\C2000\cgtools\lib\rts2800_fpu32.lib<cpy_utils.obj>"

      specifies ISA revision "C28FPU32", which is not compatible with ISA revision.......

  • The rts2800_fpu32.lib was compiled with --fpu_support=fpu32 and your project is not. Thats why its complaining about mismatching instruction sets. The error goes away when you turn on fpu_support in the project properties.
  • i couldn't locate fpu support ...Could u pls indicate the exact location
  • I see you are using CCSv3.3. Im not sure where it is on 3.3 but here is a snapshot of what it looks like on CCS6.

  • I installed ccs v6....Could u pls guide me on how to check whether the problem is with compiler
  • I can see the correct waveforms in the graph in ccsv3.3....but when i send it to DAC and view it in the scope, its wrong
    Also when I run my inverter, its similar to DAC result
  • You can emulate standalone mode of operation with the debugger. Here is what you do, you connect to the target,  then go to Scripts-> EMU Boot Mode Select -> EMU_BOOTMODE_FLASH, Restart the device (dont reset), and then set a breakpoint in main() and run to that point. This way you are simulating standalone mode even with the emulator connected. Now you can see where the code is going wrong.