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.

_IQdiv function does not work

Other Parts Discussed in Thread: TMS320F28069, MOTORWARE

Dear TI's experts,

I'm using TMS320F28069 device. 

In my project, I use soft lib floating point with runtime support lib without FPU. 

I'm trying to use IQ math but I got an error with _IQdiv API:

    float a = 0.5f;
    float b = 0.3f;
    float c = 0.0f;
    _iq30 tmp = _IQ30div(_IQ30(a),_IQ30(b));
    c = _IQ30toF(tmp);

but when I debug it, I just saw that value of tmp is not correct

tmp long 0.5412080726 (Q-Value(30))

As per I know, it should be 0.5/0.3 = 1.66666

Any recommendation for fixing this issue?

Regards,

Fitz

 

  • Hi Fitz,

    Why don't you define your a,b and c variables as _iq30 datatype? Then convert the _iq30 result into float at last.

    Regards,
    Gautam
  • Hi Gautam,

    Thank for your replying.
    This just an example that could reproduce my issue in simple way.
    I my code, a, b is floating point variable. and there is a division expression. I do want to improve calculation speed so I tried IQ math instead FPU32.
    Is there any problem with me code? Because I saw in IQ math manual that I could cast floating point number to IQN base.
    Could you suggest other solution? This solution might not be ok for my case.

    Regards,
    Fitz

  • That's what I suggested above... define your a,b and c variables as _iq30 datatype instead of float. Then do :
    _iq30 tmp = _IQ30div(a,b);
  • Fitz,

    I tried your code on my 28069 and it works fine. Do you by any chance have one of the motion control variants of the device, i.e. F28069M??

    The IQ math tables are in a different location in boot ROM on those devices.

       FPUTABLES   : origin = 0x3FD590, length = 0x0006A0	 /* FPU Tables in Boot ROM */
       IQTABLES    : origin = 0x3FDC30, length = 0x000B50    /* IQ Math Tables in Boot ROM */
       IQTABLES2   : origin = 0x3FE780, length = 0x00008C    /* IQ Math Tables in Boot ROM */
       IQTABLES3   : origin = 0x3FE80C, length = 0x0000AA	 /* IQ Math Tables in Boot ROM */
    

    You will find the correct linker command files for these devices in the motorware packages, specifically C:\ti\motorware\motorware_1_01_00_16\sw\ide\ccs\cmd\f2806x

  • Hi ,

    Nice. It's correct. I'm using F28069M device.
    This might help me. I'm going to try with your suggestion.
    Thank you so much.

    @Gautam,
    Thank for your suggestion. I will try it also.
    By the way, I might have to try with linker first. It looks easy for me because I have not need to change much thing in my code.

    Thank you all.
    I will let you know when I get result.

    Regards,
    Fitz
  • Hi , Gautam,

    It's work properly when I change linker.
    Thank for your supporting.

    Regards,
    Fitz
  • That's Great, Fitz!

    Goodluck & Regards,
    Gautam