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.

CCS/TMS320F28069M: Error in Sine wave generation using IQ math library and LAUNCHXL-F28069M

Part Number: TMS320F28069M
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Tool/software: Code Composer Studio

Dear Sir/ Madam,

I am trying to generate a sine wave using ramp generator object (available in solar library) using TMS320F28069-LAUNCH PAD .

Step 1. Interrupt created using EPWM interrupt at 50kHz.

Step2. Created a ramp generation object.

            RAMPGEN_IQ rgen1;

Step3. Initiated the ramp generation object.

          RAMPGEN_IQ_init(&rgen1);

          rgen1.Freq = _IQ24(GRID_FREQ);

          rgen1.StepAngleMax = _IQ24(1.0/INV_FREQ);

Step 4: Call the ramp generation macro from the service routine

            RAMPGEN_IQ_MACRO(rgen1);

 

Step 5: Assign the output of the ramp generator to a variable to see the output (GLOBAL_Q=24),

 

               tri=_IQ24toF(rgen1.Out);

 

## I got a proper ramp waveform in the tri variable, which start from zero to one and repeat.

Step 6. I tried to create a normal sin wave using the math library .

               va_ref=sin(tri*2*PI);

 

## Here also I got proper sin waveform.

 

Step 7. Now, I tried to use IQ math library. (GLOBAL_Q=24), (InvSione initiated as _iq24)

            InvSine = _IQsinPU(rgen1.Out);

 

### But here I am not able to get proper sinusoidal waveform. Whenever sin waveform is touching magniude '1', some distortion is initiating.

 

 

### I tried to use other tools from the library (i.e. SPLL and other), there also same distortion is coming.

  1.  1st case with normal sin from math library

 

 

2. second case "math.h" is removed from the project and sine generated with _IQsinPU function

  • Dear Sir/ madam,

    I added the following library files to the project "Solar_Lib_IQ.lib" and "IQmath_fpu32.lib" in the project.

    While building the above project, the build was successfully completed but it gives comments are there in the console window.

    _________________________________________________________________________

    "C:/ti/controlSUITE/libs/app_libs/solar/v1.2/IQ/lib/Solar_Lib_IQ.lib" -lIQmath_fpu32.lib

    warning: build attribute vendor section TI missing in

       "../IQmath_fpu32.lib<IQ23cos.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

       "../IQmath_fpu32.lib<IQmathTables.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

       "../IQmath_fpu32.lib<IQ23sin.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

       "../IQmath_fpu32.lib<IQ24sinPU.obj>": compatibility cannot be determined

    warning: build attribute vendor section TI missing in

       "../IQmath_fpu32.lib<IQ24toF.obj>": compatibility cannot be determined

    'Finished building target: Example_2806xEPwmTimerInt.out'

     

    But still it was showing in warning only. But I am not getting the required sine waveform as described in the earlier comment.

     

  • Now, to debug the above problem I have checked it step by step execution also using breakpoint and a for loop (0-100).

    The obtained incremented angle waveform as per follwoing,

    However, the obtained _IQsinPU output is not according to the desired .

  • Hello,

    Looks like you are using controlSuite, which is no longer being maintained. Have you tried using the IQMath libray in C2000ware?

    -Shantanu

  • Hellow Sir,

    I have tried with C2000 library also. I edited the code given in the project "28069_IQsampleC" in c2000 library.

    The following portion of the code has been included in main function. And I executed the code using breakpoint to see the output at each step.

        i=0;
            for (i=0;i<=100;i++)
            {
                chkdelta=_IQ24((float)i/100);
                chk2=_IQsinPU(chkdelta);
                va_ref=_IQ24toF(chk2);

            }

    It results in same output as given in earlier comments.