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.

IQsinPU functional problem

Other Parts Discussed in Thread: DRV8301, CONTROLSUITE

Hi:

    I am using C2000 28069M with DRV8301 EVM. I have some error of calculation based on IQmath.

    Dvision, multiply, square root, give me the correct result. But sinPU function give me the wrong result.

    What could cause this?

     Here is my source code:

#include "IQmathLib.h"
#include <math.h>
/*
* main.c
*/
#define GLOBAL_Q 24

_iq input, div_out;
_iq angle, sin_out;
_iq mpy_a, mpy_b, mpy_out;
_iq sqrt_a, sqrt_out;
void main(void )
{

input=_IQ(0.25);
angle = _IQ(0.1);
mpy_a = _IQ(2.1);
mpy_b = _IQ(3.0);
sqrt_a = _IQ(2.0);

div_out =_IQdiv(_IQ(0.1),_IQ(0.2)); // divide test sin

sin_out = _IQsinPU(angle); // sinPU test sin1 = sin(36degree) = 0.5877

mpy_out = _IQmpy(mpy_a,mpy_b); // multiply test, mpy_out = 2.1*3.0 = 6.3

sqrt_out = _IQsqrt(sqrt_a);
for(;;)
{

asm(" NOP");
}
}

Result is show below(right top corner)

Thanks in advanced

  • Hi,

    Did you try using IQNasin ?

    Regards,

    Gautam

  • Hi Gautam:

        I just add the asin function and test (font with red color). By asin(0.707), I expect 45 degree as result.

       When I run to the asin function, the error pop out as picture below.

       It says some file in tmp directory doesn't exist. And I manual look for the file at that path.

      I can't find it as well. Is there any connection with my file system? I am using ram disk as my tmp directory

      Hope it would help you to analysis my problem. And thanks.

     

    #include "IQmathLib.h"
    #include <math.h>
    /*
    * main.c
    */
    #define GLOBAL_Q 24

    _iq input, div_out;
    _iq angle, sin_out;
    _iq mpy_a, mpy_b, mpy_out;
    _iq sqrt_a, sqrt_out;

    _iq angle_N, sin_out_N;
    void main(void )
    {

    input=_IQ(0.25);
    angle = _IQ(0.1L);
    mpy_a = _IQ(2.1);
    mpy_b = _IQ(3.0);
    sqrt_a = _IQ(2.0);
    sin_out_N = _IQ(0.5);

    div_out =_IQdiv(_IQ(0.1),_IQ(0.2)); // divide test sin

    sin_out = _IQsinPU(angle); // sinPU test sin1 = sin(36degree) = 0.5877

    angle_N= _IQ24asin(0.707L); //

    mpy_out = _IQmpy(mpy_a,mpy_b); // multiply test, mpy_out = 2.1*3.0 = 6.3

    sqrt_out = _IQsqrt(sqrt_a);
    for(;;)
    {

    asm(" NOP");
    }
    }

  • The F28069M devices do NOT have the IQMath functions in ROM like the other Piccolo devices. It looks like you are using the PM_sensorless project from controlSUITE for your framework.

    Have you added the CORRECT IQMath library to your project to work with your FPU rts library?

     

  • I see from your other post that you figured this part out at least, and are including IQmath.

    Which version of IQmath did you include?  Looks like controlSUITE have a version called v160.  Personally I've been using v15c for sometime. Why did they rev from 15c to 160?  That's strange...

    Make sure you use the _fpu32 version since it looks like you are using FPU in your system

    IQmath_fpu32.lib

  • Hi ChrisClearman:

       Actually I started controlsuit with PMsensorless project with BuildLevel1.

      I have a PMSM motor with 3 pole pairs. No load speed: 1350RPM under 12V

       I expect that motor shall spin with the speed that i gave at SpeedRef( at very low speed, 20RPM).

       But motor spin back and forward, not continuously as I thought.

        And I put the angle and IQsinPU(angle) on the PWMDAC.

        Below is the snapshot, yellow is angle, and blue is IQsinPU(angle)

     You could observe that the angle increase continuously, but the sinPU gives part of right and part of wrong result.

      So I begin to test IQsinPU function and the result is the picture i show at previous statement.

      Do you know which part of setting i could have problem or i misunderstanding the purpose?

      Thanks.

     

  • why is your project looking for asin.c ?

    I believe this is only something that would be used with the CLA.

    I feel like your project is all mixed up with different files that don't belong.

    Can you start with a fresh project?