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.

TMS320F28069: Result is wrong when call _IQdiv(),_IQsin() to do fixed-point calculation

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE

Hi,

Is there a example about fixed-point calculation?

Add IQmathlib.h or IQmath_fpu32.lib, set it to softlib or fpu32. The result is wrong when call_IQdiv(),_IQsin(), but result is correct when call _IQmpy().

#include "DSP28x_Project.h" 
#include "IQmathLib.h"
#define   MATH_TYPE      IQ_MATH
#define   GLOBAL_Q       24

    data1 = _IQ20(1.0 / 12.0);//_IQdiv(_IQ(1.0),_IQ(12.0));
    data1 = _IQ20toIQ(data1);
data2 = _IQmpy(_IQ(2.0),_IQ(1.0));
/*data1,data2 calculation result are correct*/
    data3 = _IQsinPU(_IQ(1.0));
    data6 = _IQsin(_IQ(3.14/6));
data4 = _IQdiv(data1, data2);
/*data3,data6,data4 calculation result are wrong*/
    data5 = data2 / data1;



  • Daniel,

    If you install controlSUITE there are examples here:

    C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVACI_Sensored\  


    that make use of IQ Math.

      Based on some previous posts, I suspect there may be some IQ math constants in the ROM that are not mapped correctly causing the issue. Note that the above pjt is for the F28035.  From a differnt project I see that the IQ tables on the F2806x are here:

            IQTABLES   	: origin = 0x3FDF00, length = 0x000B50     /* IQ Math Tables in Boot ROM */
    	IQTABLES2  	: origin = 0x3FEA50, length = 0x00008C     /* IQ Math Tables in Boot ROM */
       	IQTABLES3  	: origin = 0x3FEADC, length = 0x0000AA	   /* IQ Math Tables in Boot ROM */

    Best,

    Matt