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/LAUNCHXL-F28069M: _IQ math Library Problem

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi everyone

This is Mike

After been reading, trying and doing some work with the LAUNCHXL-F28069M I stopped because there´s is an issue I cannot deal with.

Any suggestions?

Regards

Mike

  • Hi Mike,
    Since these are warnings, you can ignore them. The reason for these warnings is that the IQmath library has been compiled with an older version of the compiler and the compiler version you are using to build your code is a newer one, hence these warnings. Rest assured, your code should work as expected.
    There are related threads which discuss similar warnings.
    e2e.ti.com/.../237376
    e2e.ti.com/.../744231

    Regards
    Ritvik
  • Hi Ritvik Sadana,

    Thanks for answering. I could ignore them but in the simulation I notice that these instructions do nothing, that´s why I'm asking for help.
    Any suggestions
    Regards
    Mike
  • Mike,
    I guess the problem will remain if you use the new version of the tools. I am looking into this problem. The immediate solution can be to use CCSv4 and Compiler v5.0.2 (can't say for sure if these are still available on the net!). For a more permanent solution, you will have to wait for some time as I look closer into the issue.

    Regards
    Ritvik
  • Hi Ritvik Sadana

    I changed, in the IQmathLib.h, the MATH _TYPE instead of "IQ_MATH" I wrote "FLOAT_MATH" It seems to work, but I noticed this change make all my variables in float type. That is a little confusing to me because the IQmath, regard definitions, are done in long type. If I change this ( FLOAT_MATH instead IQ_MATH) Will I be limited? I mean Float Type has a range and Long Type has another one.

    Could you explain this to me please?

    Regards
    Mike
  • Mike,

    This is an expected behavior. You can check this in line number #3639 in IQmathLib.h :

    //###########################################################################
    #else   // MATH_TYPE == FLOAT_MATH
    //###########################################################################
    // If FLOAT_MATH is used, the IQmath library function are replaced by
    // equivalent floating point operations:
    //===========================================================================

    And you are right that IQ Math definitions are done in long but for that, you need to keep MATH_TYPE = IQ_MATH.

    Ritvik

  • So I have a new question. In sprc990.pdf talks about IQ math, LAUNCHXL-F28069M. How can I link the .lib in my project?, I think it will solve this issue. In that sprc990 I read about some math operations are contained in tables, and one just have to link it to the project. I have this file included in my project but I think it talks about the build options. I hope more people can help us with some comments.
    Regards
    Mike
  • Mike,

    The tables you are referring to are the lookup tables which calculate basic math functions like sin/cos/atan etc. For using those tables/functions, you need to include BootROMSymbols.lib. You can find the symbols in the following directory:

    {install_dir}\C2000Ware_1_00_03_00\libraries\boot_rom\f2806x\v1_1\rom_symbol_libs\IQmath\2806x_IQmath_BootROMSymbols.lib

    On page 17 of sprc990.pdf, you can find the steps to link the library to your project. Page 12 onwards describes how to use the tables.

    -Ritvik

  • Hi Ritvik Sadana

    I solved the issue but I think that´s not te correct way.

    In the IQmathlib.h, as I told you before, I made a change in the "MATH_TYPE == FLOAT_MATH" so I thought "Why not to use the math.h?" I mean, I define my variables as _iq but in a specific instruction (I wanted to do an accumulator function, in fact, I did it) I had to squared all my data coming from a buffer and then add them so just I used instruction pow from math.h and then adding all of them.

    But I think actually I'm not using IQmath, just I'm optimizing the variables to be processed because they are _iq.
    What do you think about it?
    Regards
    Mike
  • Hi Ritvik Sadana

    Are you Still There?
  • Mike,
    Appologies for the delay. If you are using math.h, then the code will not be so cycle optimized as it is in IQMath. Still, if it meets your time limit, then you can use math.h as well.
    Ritvik
  • I'll be measuring a signal coming from a Three Phase generator, I´m taking 154 samples per cycle, That signal is variable in amplitude and freq, but the freq doesn´t go more than 70 Hz so I think It´ll be ok. What do you think Ritvik?
    Regards
    Mike
  • The question is more specific to your application and probably it is difficult for us to make a comment one way or the other. If you have any issues with math functions, let us know.

  • Hi Ramesh

    I want to apologize myself for that.

    The problem was about the IQmath, and some issues in some functions as _IQdiv(); , IQmpy(); So I decided to use the math functions, right now my variables are declared as _iq and I'm using the pow function and it worked well, so the question is if I doing that Is it optimizing the calculus?

    Someone told me about that fpu would resolve this issue, making my numbers .0, example: 1.0 instead 1 and fpu automatically will do the work, I mean, the fpu will optimize the calculus when it finds float numbers.

  • Is Anybody out there?
  • Mike,

    The choice between IQMath and FPU is purely based on the precision you need in your calculations. In some cases, IQMath works better, while in some, FPU will give you better precision and wider range. You can read more about this here: IQMath vs Floating Point

    FPU will optimize the code only if you use "/" instead of _IQdiv() or "*" instead of _IQmpy. Also, you need to use _fpu32.lib version of the libraries that you are using in your code and enable the floating point support under Properties->Build->C2000 Compiler->Processor Options->Specify floating point support->fpu32 . Until then, your numbers are treated as fixed-point numbers in the CPU.

    -Ritvik

  • Great ! Just I need to do that settings on the CCS, and that's it. I will review the link you share to me.

    Thanks a lot.

    Regards 

    Mike