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.

Instaspin lab11 with floating point support

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE, BQ76PL455A-Q1

Hello!

I got recommended Instaspin lab 11 as a base for developing software for our own hardware. Everything is working fine with the motor running. We also would like to export some data through UART and in the recieving we would like to have floating point. As the processor we are using, TMSF28069M, have CPU+FPU I guess it would be possible to convert some motor variables, such as "gMotorVars.SpeedRef_krpm" to a float, cast to a int and send through the SCI-interface and then simply read a float in the recieving end.

I got some problems to add FPU support though. I have tried to look in "C28x IQmath Library SPRC990"

I have linked the libraries:

  1. rts2800_fpu32.lib
  2. rts2800_fpu32_fast_supplement.lib
  3. IQmath_fpu32.lib
  4. 2806xRevB_FastSpinROMSymbols_fpu32.lib
  5. C28x_VCU_LIB_fpu32.lib (Using CRC as well)

And I have changed "#define   MATH_TYPE      FLOAT_MATH"

When I try to compile I get several:

#31 expression must have integral type [...], external location: C:\ti\motorware\motorware_1_01_00_16\sw\modules\svgen\src\32b\svgen_current.h C/C++ Problem"

It seems this is occuring where a shift operator is used ( >> ) which does make sense, shifting a floating point value would result in a corrupted value. However, in for example lab 10c which also have floating point support according to the Instaspin labs, the same operation is used without any problem.

If I don't define FLOAT_MATH i get several errors regarding the libraries:

Description Resource Path Location Type
#16008-D file "../libs/IQmath_fpu32.lib<IQ24cosPU.obj>" specifies ISA [Project_name] C/C++ Problem

After I changed "Variant type" for the device in General project settings I get:

  • "../libs/2806xRevB_FastSpinROMSymbols_fpu32.lib<TMS320x2806x_REVB_boot_rom_out__EST_getLs_d_H_tmp.obj>" specifies ISA revision "C28FPU32", which is not compatible with ISA revision "C2700" specified in a previous file or on the command line
  • "../libs/EST_getIdq_pu.lib<EST_getIdq_pu.obj>" specifies ISA revision "C2800", which is not compatible with ISA revision "C28FPU32" specified in a previous file or on the command line"

So one error contradicts the other? One error says C28FPU32 is specified, and the other error says C28FPU32 is not specified but C2700?

Regards

Robert

  • I might add that I very easily could migrate Lab 20 to floating point support, simply linking the libraries, changing RTS and add FPU32 flag for compiler. Tested on actual hardware and seems to work good.
  • Hi Robert,

    The error is from EST_getIdq_pu.lib which is not compiled with FPU32 to support float, the EST_getIdq_pu(estHandle,&gIdq_pu) is from EST_getIdq_pu.lib in lab11. So you need to exclude EST_getIdq_pu.lib, and remove  EST_getIdq_pu(estHandle,&gIdq_pu).

    Best Regards,

    Yanming Luo

  • Ok, thanks.


    I was somehow aware that this library didn't support FPU32, but as I got errors regarding all the other libraries I wanted to solve that problem first as I thought there were some bigger problem. It works now with float support. I replaced the EST_getIdq_pu(estHandle,&gIdq_pu) with a PARK module and the motor is spinning just fine. One thing i noticed is that the variables in the watch-window is wierd. I set the Rs_Ohm = 0.1938622 in the user.h-file, but in the watch window when I debug I see the type float and the value 1.044809e+09 for Rs_Ohm. If I recalc the Rs_Ohm i still get a similar value, though the motor spins good and the current drawn during the recalculation looks good as well. This is a minor problem, but can still be quite confusing.

    Noticed:

    #ifdef __TMS320C28XX_FPU32__
    extern int32_t EST_getRs_Ohm(EST_Handle handle);
    #else
    extern float_t EST_getRs_Ohm(EST_Handle handle);
    #endif

    Which to me feels wierd. When you are using FPU support, you get a int32 from FAST, but when you are not using FPU you get a float?

    I also noticed that your prebuilt library for the VCU with FPU32-support had some problems. There were no symbols for "getCRC16P1_vcu()" or any other vcu-specific functions. I noticed the vcu-functions were in assembler files, not sure if they were forgotten during the build of the library? In any case I rebuilt this library (C28x_VCU_LIB_fpu32.lib) from the provided source in ControlSuite and now I just tested the CRC functions and confirmed they work correctly with FPU32. Testing the CRC functions with the examples given in the datasheet "bq76PL455A-Q1 Software Design Reference" (slva617a).

    Regards

    Robert