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.

IQmath function error ---- Urgent

Other Parts Discussed in Thread: TMS320F28035

Hi,

I have already used Sine lookup table from IQmath, and that worked fine.   (TMS320F28035)

Now, I am trying to use the square root function from IQmath in my application, like this

_iq2  voltageRMS;
_iq2  sum;
unsigned long  counter;

 voltageRMS= _IQ2sqrt(sum / counter);

It didn't build and gave errors like

If I double click on the error message, it takes me to F28035.cmd file,   and the location is

And the message from the "Build Console' is

I really need some help here.

Thank you,

Frank

  • Hi Frank,

    Can you try the following and see if it builds? Im assming you're GLOBAL_Q is 2.

    voltageRMS= _IQ2sqrt(_IQdiv(sum,_IQ(counter)));



  • Hi Vishal,

    I tried, but it is still not working.

    it built only when I changed it to

    voltageRMS = _IQ2( sqrt(sum / counter) );

    Frank

  • Frank,

    I tried the following code and it worked fine:

    #include "DSP28x_Project.h"

    //Global Definitions
    #define  GLOBAL_Q       2
    #include "IQmathLib.h"

    //Function Prototypes

    //ISR Prototypes

    //Global Variables

    //Main Function
    void main( void )
    {    
        //Local Variables
        _iq2 var1,var2;
        _iq2 counter;
        
        //! Step 1: Setup the system clock
        InitSysCtrl();

        //! Step 2: Initialize PIE control
        DINT;
        InitPieCtrl();
        IER = 0x00000000;
        IFR = 0x00000000;
        InitPieVectTable();
     
        //Test 1: _IQ2sqrt() test, sqrt(4/2) = 1.1412
        //Expected iq2 answer is 0x5 = 0.11 (0.75, round toward zero?)
        counter = _IQ2(2); //IQ->8
        var1    = _IQ2(4); //IQ->16
        var2    = _IQ2sqrt(var1/counter);//IQ->3


        while(1)
        {
        
        }       
        asm(" NOP");
    }

  • Hi Vishal,

    Thank you for your reply,

    I tried your code and it worked in a sample program, but still not in my project program.

    Then, I realized I forgot to mention that I also used Sine table in my program.

    #pragma DATA_SECTION(sine_table,"IQmathTables");
    _iq30 sine_table[512];

    Every time, I tried to use both "sine_table" and  "_IQ2sqrt " , and it gave me error message #10099-D.  ( It could build if I only use one of them)

    If I click on the message, it says

    I am using TMS320F28035 Experimental Kit.

    Thank you,

    Frank

  • I really want to know how to use this on-chip look-up table without causing issues with _IQsqrt.

    Have anyone used this before?

    Thank you,

    Frank

  • Frank,

    I see now that you are actually assigning a 512 size table to IQMathTables. You dont need to do that. The IQMathTables is a noload section, the tables are already in the bootROM. you only have to call the IQNsin(). That is what is causing your IQMathTable section to blow up.

  • Hi Vishal,

    Thank you very much for your help. It is working now.

    Frank