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.

TMS320F280049: IQmath with CCSv9.2 and C2000Ware

Expert 4001 points
Part Number: TMS320F280049
Other Parts Discussed in Thread: MIDAS, CONTROLSUITE, C2000WARE, TIDM-1007

Hi,

the function _IQ15div in Midas using ccs6.2 and controlsuite.

The function was working properly.

 

I used the same code for ccs9.2, and used c2000ware_v2xxx, however the function is not working anymore.

Here is the disassembly.

104        dffw->invout = (ffwd_int16_t) _IQ15div (dffw->num, uout);

        C$L3:

083082:   C242        MOVL         *-SP[2], XAR6

083083:   06E1        MOVL         ACC, *+XAR1[4]

083084:   7648B000    LCR          $..\src_coff\IQNdiv.asm:245:334$

083086:   1EC1        MOVL         *+XAR1[0], ACC

 

Question 1: Is the function already discontinued? Or is there a new setting in the linker file?

 

 

Then I used the following code to replace the function

#define IQ15DIV(x, y)      ( (x << 15) / y )

 

Here is the equivalent disassembly

104        dffw->invout = (ffwd_int16_t)q15_div(dffw->num, uout);

        C$L3:

083080:   C242        MOVL         *-SP[2], XAR6

083081:   06E4        MOVL         ACC, *+XAR4[4]

083082:   FF3E        LSL              ACC, 15

083083:   00C83198    FFC          XAR7, L$$DIV

083085:   1EC4        MOVL         *+XAR4[0], ACC

 

The new function provides correct computation.

Question 2: Do you see any issue with this code?

Question 3: Is there a better way to implement _IQ15div operation?

Regards,

Kien

  • Kien,

    It seems to be working fine on my machine.  Can you check what you have in the linker command file for the IQ math sections?

    There's an example in C2000Ware in the device_support\f28004x\common\cmd directory.  Look for the two iqmath examples, and how the IQmath and IQmathTables sections are placed.

    Also, make sure you have "IQmath_fpu32_coff.lib" entered correctly in project properties -> Build -> C2000 linker -> file search path.

    Regards,

    Richard

  • Hi Richard,

    The question came from me and sent it to Kien.

    As I was saying I compiled the code with CCSv6.2 and Controlsuite library and it worked well as it is.

    I then used the same code using ccsc9.2 and c2000warev2.01.xx.,  _IQ15mpy still worked well, but  not _IQ15div.

    Action:

    I included  IQmath_fpu32_coff.lib in the linker search path, and its still behaving same way.

    Second question, is there a problem in using normal integer multiply and divide for F280049

    I look into the disassembled code and it looks like integer multiply and divide is pretty much the same

    or is more compact than its IQmath implementation. 

    Also, I looked into your latest PFC sample code and I did not see any IQ math.

    thanks and rgds,

    yancy

  • Hi Yancy,

    IQNmpy is implemented using a C instrinsic whereas IQNdiv is an archived library routine.  This is why I'm focussing on the .lib file.

    Can you check that your project is being built for COFF rather than EABI?  In the CCS Edit perspective, right-click on the project name, then select "properties".  In the "General" category, what is the Output format?  If it's EABI you'll need to change it or link a different library.

    If this looks right, can you attach your project so I can take a look?

    I'll check on the PFC question and get back to you.  It's several years since we released a device without FPU support so it's quite possible the newer reference designs were developed without IQmath.

    Regards,

    Richard

  • Yancy,

    After looking into the library dependency of recent PFC examples, many are not reliant on IQmath.  If you can tell me which one you saw I can confirm it.

    Regards,

    Richard

  • Richard,

    I'm referring to TIDM-1007-Interleaved CCM Totem Pole Bridgeless PFC.

    My project was set to build for COFF.

    I'm including processor options. CLA was not used.

    and the include library and path as well.

    here is the command linker

        /* Allocate IQ Math */
        IQmath                : > FLASH_BANK0_SEC11, PAGE = 0                 /* Math Code */
        IQmathTables    : > IQTABLES,          PAGE = 0, TYPE = NOLOAD  /* Math Tables In ROM */
        /* Floating point Math */
        FPUmathTables   : > FPUTABLES,         PAGE = 0, TYPE = NOLOAD

    Thanks and rgds,

    Yancy

  • The picture was automatically taken out. Here are the details

    Processor Options

    silicon version : 28

    CLA support  : cla0 

    floating point support: fpu32

    enhanced integer division support : none specified

    TMU support : none specified

    VCU support : none specified

    Libraries included

    IQmath_fpu32.lib

    rts2800_fpu32.lib

    IQmath_fpu32_coff.lib

    rgds,

    Yancy

  •  

    Portion of the map file generated in ccsv9.2

    .TI.ramfunc
    *          0    00080344    0000004c     RUN ADDR = 00008000
                      00080344    00000048     f28004x_sysctrl.obj (.TI.ramfunc)
                      0008038c    00000004     F28004x_usdelay.obj (.TI.ramfunc)

    >>> missing IQmath obj <<<<<

    Cla1Prog   0    0008c000    000000c0     RUN ADDR = 00008800
                      0008c000    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task1)
                      0008c018    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task2)
                      0008c030    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task3)
                      0008c048    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task4)
                      0008c060    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task5)
                      0008c078    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task6)
                      0008c090    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task7)
                      0008c0a8    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task8)

    Portion of the map file generated in ccsv6.2

    .TI.ramfunc
    *          0    00085000    0000004b     RUN ADDR = 00008000
                      00085000    00000047     f28004x_sysctrl.obj (.TI.ramfunc)
                      00085047    00000004     F28004x_usdelay.obj (.TI.ramfunc)

    IQmath     0    003fe000    00000047     
                      003fe000    00000047     IQmath_fpu32.lib : IQ15div.obj (IQmath)

    Cla1Prog   0    00086b50    000000c0     RUN ADDR = 00008800
                      00086b50    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task1)
                      00086b68    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task2)
                      00086b80    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task3)
                      00086b98    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task4)
                      00086bb0    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task5)
                      00086bc8    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task6)
                      00086be0    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task7)
                      00086bf8    00000018     cla_tasks.obj (Cla1Prog:_Cla1Task8)

    Also I found the following thread

    e2e.ti.com/.../575167

    Is IQMath obsolete in the new libraries?

    thanks and rgds,

    yancy

  •  

    I moved IQMath to "FLASH_BANK0_SEC5" instead of  IQTABLES   : origin = 0x3FE000

    And here's what I got.

    Portion of the map file generated in ccsv9.2

    .TI.ramfunc
    *          0    00080344    0000004c     RUN ADDR = 00008000
                      00080344    00000048     f28004x_sysctrl.obj (.TI.ramfunc)
                      0008038c    00000004     F28004x_usdelay.obj (.TI.ramfunc)

    IQmathTables
    *          0    00085000    00000b50     NOLOAD SECTION
                      00085000    00000b50     IQmath_fpu32_coff.lib : IQmathTables.obj (IQmathTables)

    IQmath     0    00085b50    00000047     
                      00085b50    00000047     IQmath_fpu32_coff.lib : IQ15div.obj (IQmath)

    Portion of the map file generated in ccsv6.2

    .TI.ramfunc
    *          0    00085000    0000004b     RUN ADDR = 00008000
                      00085000    00000047     f28004x_sysctrl.obj (.TI.ramfunc)
                      00085047    00000004     F28004x_usdelay.obj (.TI.ramfunc)

    IQmath     0    0008504c    00000047     
                      0008504c    00000047     IQmath_fpu32.lib : IQ15div.obj (IQmath)

    IQmathTables
    *          0    00086000    00000b50     
                      00086000    00000b50     IQmath_fpu32.lib : IQmathTables.obj (IQmathTables)

    However if I test the function it gives me the following result
    _IQ15div(4095, 27333) =   0xFFFFFFFF      ccsv9.2

    _IQ15div(4095, 27333) =   4909                   ccsv6.2

     

    rgds,

    yancy

  • Richard,

    I think its fixed.  Both IQMath and IQMathTables was moved from ROM to Flash memory.

    Probably, I already used the ROM location while trying to figure out the problem.

    The definition  "TYPE = NOLOAD"  was removed from IQmathTables.

      

        /* Allocate IQMath */
        IQmath                 : > FLASH_BANK0_SEC5, PAGE = 0                    /* Math Tables In Flash */
        IQmathTables    : > FLASH_BANK0_SEC5, PAGE = 0  /* , TYPE = NOLOAD */ /* Math Tables In Flash */

    Now the question is, should I move to Floating point (Integer) or use IQMath?

    rgds,

    Yancy

  • Yancy,

    Glad you found a solution. The thread about the build attribute warning is correct, but the warning is innocuous in the case of IQmath: it will not cause an issue.

    I confirm TIDM-1007 was not built with IQmath. You can proceed either way; the device you're using has an FPU and it is very unlikely we will release any parts in future which do not support floating point in hardware. Unless you may want to migrate your code back to an earlier fixed point C28x device, there is little reason to use IQmath.

    Regards,

    Richard

  • Richard,

    Floating point code is compact(with your devices) anyway, so I'll proceed floating point computation from now on.

    Thank you very much!

    Kien,

    Thanks for bringing the issue to this forum.

    rgds,

    yancy

  • Richard,

    Thanks a lot for your support.

    Yancy,

    You welcome. Please keep using C2000 as it is the best DSC for real time applications.