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.

TMS320F28069M: Motorware with fp32 and tmu support

Part Number: TMS320F28069M
Other Parts Discussed in Thread: MOTORWARE, DRV8305,

Hi,

we are in need of using motorware with fp32 and tmu support.

So we took an instaspin lab5b as an example and made only the following changes:

[] Compiler options changed –float_support=fp32  as well as --tmu_support

[] Switched the rts lib to rts2800_fp32.lib

[] Changed the following libs

C:\TI\motorware\motorware_1_01_00_18_05\sw\modules\fast\lib\32b\f28x\f2806x\2806xRevB_IQmath_BootROMSymbols.lib

C:\TI\motorware\motorware_1_01_00_18_05\sw\modules\fast\lib\32b\f28x\f2806x\ 2806xRevB_IQmath_BootROMSymbols_fpu32.lib

 

C:\TI\motorware\motorware_1_01_00_18_05\sw\modules\iqmath\lib\f28x\32b\IQmath.lib

C:\TI\motorware\motorware_1_01_00_18_05\sw\modules\iqmath\lib\f28x\float\IQmath_fpu32.lib

it builds fine, but Unfortunately after these changes the motor does not spin anymore. Before we investigate further, could you let me know if we are missing something? Has this been tried on your side?

Thanks,

--Gunter

  • You may refer to lab04a and lab05g that support FPU32. You don't need to enable TMU support since 2806xRevB_IQmath_BootROMSymbols_fpu32.lib doesn't use TMU functions as well.
  • Hi Yanming,

    thanks for the comment. 

    I am a little further as I was investigating this. Using Lab5b with softlib side by side with Lab5b with fpu32, I found some obvious places early on where the fpu32 case fails. One case is in HAL_setParams()

    _iq current_sf = _IQ(pUserParams->current_sf);

    Here current_sf in the user param structure is defined as 

    float_t current_sf; //!< Defines the current scale factor for the system

    The actual value is 1.964... in float format.

    This gets then converted by _IQ()

    For "softlib" case after _IQ() conversion the value is 1.964.... in Q24 format as expected. This works.

    However for the "fpu32" case the _IQ conversion leads to a value of 0.0 (zero) in Q24 format.

    What am I missing?

    Also for various .c files there is a header file called IQmathLib.h being included. Could you also explain the need for FLOAT_MATH vs IQ_MATH. Right now as far as I can tell everything is defined for IQ_MATH.

    #define FLOAT_MATH 1
    #define IQ_MATH 0

    #ifndef MATH_TYPE
    #define MATH_TYPE IQ_MATH
    #endif

    We talked to Witney Dewey, and we think this could be important.

    Thanks!
    --Gunter

  • Hi Yanming,

    I made another interesting observation:

    Building and running Lab5g seems to work, when executing over the questionable _IQ() functions. Lab5g is build with FPU32.

    When using the Lab5b with my FPU32 support, there are distinct differences in the .map file, where I think there are some functions missing that are supposed to be linked in from the rts2800_fpu32.lib

    The hal.c is the SAME between the two labs, but in case Lab5g it is causing the link of the symbols, in the other case Lab5b it does not.

    Lab5g working .map file

    .text      0    003f0000    00003024    
                      003f0000    00000c24     hal.obj (.text)
                      003f0c24    0000077f     drv8305.obj (.text)
                      003f13a3    00000595     user.obj (.text)
                      003f1938    0000046d     ctrl.obj (.text)
                      003f1da5    000002f1     pwm.obj (.text)
                      003f2096    000002e9     proj_lab05g.obj (.text)
                      003f237f    00000206     adc.obj (.text)
                      003f2585    00000195     gpio.obj (.text)
                      003f271a    0000018a     clk.obj (.text)
                      003f28a4    00000102     pie.obj (.text)
                      003f29a6    000000a9     spi.obj (.text)
                      003f2a4f    00000088     rts2800_fpu32.lib : fs_div.obj (.text)
                      003f2ad7    00000083                       : fd_mpy.obj (.text)
                      003f2b5a    00000068                       : exp.obj (.text)
                      003f2bc2    00000061                       : log.obj (.text)
                      003f2c23    0000005b     pll.obj (.text)
                      003f2c7e    0000005a     rts2800_fpu32.lib : pow.obj (.text)
                      003f2cd8    00000050                       : _log.obj (.text)
                      003f2d28    00000047     pwr.obj (.text)
                      003f2d6f    00000046     rts2800_fpu32.lib : boot.obj (.text)
                      003f2db5    00000046     wdog.obj (.text)
                      003f2dfb    00000045     offset.obj (.text)
                      003f2e40    00000032     timer.obj (.text)
                      003f2e72    00000031     rts2800_fpu32.lib : ldexp.obj (.text)
                      003f2ea3    0000002d     osc.obj (.text)
                      003f2ed0    00000027     cpu.obj (.text)
                      003f2ef7    00000023     filter_fo.obj (.text)
                      003f2f1a    00000022     rts2800_fpu32.lib : i_div.obj (.text)
                      003f2f3c    00000020     flash.obj (.text)
                      003f2f5c    0000001f     rts2800_fpu32.lib : fd_tol.obj (.text)
                      003f2f7b    0000001c                       : fs_tofd.obj (.text)
                      003f2f97    0000001a                       : modf.obj (.text)
                      003f2fb1    00000019                       : args_main.obj (.text)
                      003f2fca    00000019                       : exit.obj (.text)
                      003f2fe3    00000016                       : frexp.obj (.text)
                      003f2ff9    00000010     memCopy.obj (.text)
                      003f3009    0000000a     pie.obj (.text:retain)
                      003f3013    00000009     rts2800_fpu32.lib : _lock.obj (.text)
                      003f301c    00000008     CodeStartBranch.obj (.text)
     
    This is correct mapping!
     
    address    name
    --------   ----
    003f0000   .text
    003f2fca   C$$EXIT
    003f2ad7   FD$$MPY
    003f2f5c   FD$$TOL
    003f2a4f   FS$$DIV
    003f2f7b   FS$$TOFD
    003f2f1a   I$$DIV
    003f2f2b   I$$MOD

    Lab5b failing .map file

    the fd_mpy and fd_tol functions are missing! There are some others missing.

    .text      0    003f0000    00002d75    
                      003f0000    00000c61     hal.obj (.text)
                      003f0c61    0000077f     drv8305.obj (.text)
                      003f13e0    00000595     user.obj (.text)
                      003f1975    0000046d     ctrl.obj (.text)
                      003f1de2    00000339     proj_lab05b.obj (.text)
                      003f211b    000002f1     pwm.obj (.text)
                      003f240c    00000206     adc.obj (.text)
                      003f2612    00000195     gpio.obj (.text)
                      003f27a7    0000018a     clk.obj (.text)
                      003f2931    00000102     pie.obj (.text)
                      003f2a33    000000a9     spi.obj (.text)
                      003f2adc    0000005b     pll.obj (.text)
                      003f2b37    00000047     pwr.obj (.text)
                      003f2b7e    00000046     rts2800_fpu32.lib : boot.obj (.text)
                      003f2bc4    00000046     wdog.obj (.text)
                      003f2c0a    00000045     offset.obj (.text)
                      003f2c4f    00000032     timer.obj (.text)
                      003f2c81    0000002d     osc.obj (.text)
                      003f2cae    00000027     cpu.obj (.text)
                      003f2cd5    00000023     filter_fo.obj (.text)
                      003f2cf8    00000020     flash.obj (.text)
                      003f2d18    00000019     rts2800_fpu32.lib : args_main.obj (.text)
                      003f2d31    00000019                       : exit.obj (.text)
                      003f2d4a    00000010     memCopy.obj (.text)
                      003f2d5a    0000000a     pie.obj (.text:retain)
                      003f2d64    00000009     rts2800_fpu32.lib : _lock.obj (.text)
                      003f2d6d    00000008     CodeStartBranch.obj (.text)
     
    The symbols are there, but not in the right place! The code at this point is leading to a TRAP0 instruction. It seems there is no real code.
     
    address    name
    --------   ----
    003f0000   .text
    003f2d31   C$$EXIT
    003f81d6   FD$$MPY
    003f853d   FD$$TOL
    003f8259   FS$$DIV
    003f8579   FS$$TOFD
     
     
     
    Regards,
    --Gunter
     
  • Hi Yanming,

    more testing.

    First the linker command is this

    Building target: "proj_lab05b.out"

    Invoking: C2000 Linker

    "C:/TI/ccsv8/tools/compiler/c2000_6.2.11/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -O2 -g --define=FAST_ROM_V1p6 --define=FLASH --diag_warning=225 --display_error_number -z -m"proj_lab05b.map" --stack_size=0x3B0 --warn_sections -i"C:/TI/ccsv8/tools/compiler/c2000_6.2.11/lib" -i"C:/TI/ccsv8/tools/compiler/c2000_6.2.11/include" --reread_libs --priority --disable_auto_rts --diag_suppress=16002 --xml_link_info="proj_lab05b_linkInfo.xml" --rom_model -o "proj_lab05b.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./drv8305.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj" "./proj_lab05b.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "C:/TI/motorware/motorware_1_01_00_18_05/sw/modules/fast/lib/32b/f28x/f2806x/2806xRevB_FastSpinROMSymbols_fpu32.lib" "C:/TI/motorware/motorware_1_01_00_18/sw/ide/ccs/cmd/f2806x/F28069F.cmd" "C:/TI/motorware/motorware_1_01_00_18_05/sw/modules/iqmath/lib/f28x/float/IQmath_fpu32.lib"  -lrts2800_fpu32.lib

     

    You can see that the 2806xRevB_FastSpinROMSymbols get linked before the rts2800_fpu32 symbols.

     

    Listing the symbols from 2806xRevB_FastSpinROMSymbols_fpu32.lib

    $ ./nm2000.exe -a 2806xRevB_FastSpinROMSymbols_fpu32.lib |grep "TOL"
    003f853d A FD$$TOL
    00000000 f TMS320x2806x_REVB_boot_rom_out_FD$$TOL_tmp.asm
    003f84cd A FS$$TOL
    00000000 f TMS320x2806x_REVB_boot_rom_out_FS$$TOL_tmp.asm

    This is an absolute symbol with an address, which gets linked first. Exactly what we are seeing. It points to a ROM symbol.

     

    a0192896@LTA0192896 /cygdrive/c/TI/ccsv8/tools/compiler/c2000_6.2.11/bin
    $ ./nm2000.exe rts2800_fpu32.lib |grep "TOL"
    00000000 U FD$$TOL
    00000000 U FD$$TOL
    00000000 U FD$$TOL
    00000000 T FD$$TOL
    00000000 T FD$$TOLL
    00000000 T FS$$TOL
    00000000 T FS$$TOLL

    These are all relative symbols, so I think it would force the code to get linked in.

    Now what I am seeing when looking at the location via the Disassembly Window, there are only ITRAP0 instructions

    003f853d A FD$$TOL

    3f853d: 0000 ITRAP0
    3f853e: 0000 ITRAP0
    3f853f: 0000 ITRAP0
    3f8540: 0000 ITRAP0
    3f8541: 0000 ITRAP0
    3f8542: 0000 ITRAP0

    Do we have the wrong ROM symbols in the library?

    Or do I have the wrong device, i.e. with a different ROM? I am using the TMS320F28069M Launchpad.

    Thanks,

    --Gunter

     

  • Hi,

    since the Lab5g was working, I double checked the linker command line for that lab

    Building target: "proj_lab05g.out"

    Invoking: C2000 Linker

    "C:/TI/ccsv8/tools/compiler/c2000_6.2.11/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -O2 -g --define=FAST_ROM_V1p6 --diag_warning=225 --display_error_number -z -m"proj_lab05g.map" --stack_size=0x3B0 --warn_sections -i"C:/TI/ccsv8/tools/compiler/c2000_6.2.11/lib" -i"C:/TI/ccsv8/tools/compiler/c2000_6.2.11/include" --reread_libs --priority --disable_auto_rts --diag_suppress=16002 --xml_link_info="proj_lab05g_linkInfo.xml" --rom_model -o "proj_lab05g.out" -lrts2800_fpu32.lib "C:/TI/motorware/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2806x/2806xRevB_FastSpinROMSymbols_fpu32.lib" "C:/TI/motorware/motorware_1_01_00_18/sw/modules/iqmath/lib/f28x/float/IQmath_fpu32.lib" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./drv8305.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj" "./proj_lab05g.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "C:/TI/motorware/motorware_1_01_00_18/sw/ide/ccs/cmd/f2806x/f28069F_ram_lnk.cmd"  

    <Linking>

    Here the rts2800_fpu32.lib gets linked before 2806xRevB_FastSpinROMSymbols_fpu32.lib

    This is exactly the opposite to what I have in Lab5b.

    Is this a lib ordering issue?

    Thanks!

    --Gunter

  • Hi Yanming,

    I determined that the issue is a linker library ordering issue. After putting the 2806xRevB_FastSpinROMSymbols_fpu32.lib AFTER the rts2800_fpu32.lib in priority, the Lab5b works now. The symbols get now properly pulled from the rts2800_fpu32.lib first.

    Here is the linker command line

    Building target: "proj_lab05b.out"

    Invoking: C2000 Linker

    "C:/TI/ccsv8/tools/compiler/c2000_6.2.11/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -O2 -g --define=FAST_ROM_V1p6 --define=FLASH --define=ANALOG_HALL --define=ADC_SWITCHING --diag_warning=225 --display_error_number -z -m"proj_lab05b.map" --stack_size=0x3B0 --warn_sections -i"C:/TI/ccsv8/tools/compiler/c2000_6.2.11/lib" -i"C:/TI/ccsv8/tools/compiler/c2000_6.2.11/include" -i"C:/TI/motorware/motorware_1_01_00_18_05/sw/modules/fast/lib/32b/f28x/f2806x" --reread_libs --priority --disable_auto_rts --diag_suppress=16002 --xml_link_info="proj_lab05b_linkInfo.xml" --rom_model -o "proj_lab05b.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./drv8305.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj" "./proj_lab05b.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "C:/TI/motorware/motorware_1_01_00_18_05/sw/ide/ccs/cmd/f2806x/F28069F.cmd" "C:/TI/motorware/motorware_1_01_00_18_05/sw/modules/iqmath/lib/f28x/float/IQmath_fpu32.lib"  -lrts2800_fpu32.lib -l2806xRevB_FastSpinROMSymbols_fpu32.lib

    <Linking>

    Finished building target: "proj_lab05b.out"

    Regards,

    --Gunter