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/DRV8312-69M-KIT: lab11 with floating point unit

Part Number: DRV8312-69M-KIT
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hi everyone,

I'm using the DRV8312-69M Kit to implement different estimators for an ACIM (LVACIMTR). I've started from project 11 of instaspin labs and replaced every call to the instaspin estimator with my own estimators. The estimators work, but I have to reduce the estimator frequency to <8kHz for the ISR to complete before the next ISR call.

My observer basically consists of 21 floating point multiplications, 18 sums and an atan2, for example:


obj->i_beta = z2/((float_t)USER_EST_FREQ_Hz) + (obj->a22*ibeta_old)+ (obj->a23*wmech_old* psialpha_old) + (obj->a24* psibeta_old) + (obj->b*ubeta_meas)+ ibeta_old

I noticed the f28069M has a floating point unit, but proj11 uses fixed point math and a floating point softlib, so now I want to use the fpu to make my observer faster.
Ideally I don't want to change all the iq-math in the modules (clarke, svgen,... ). I thought the IQmath_fpu32 library is what I'm looking for.

What I tried:
a) I selected the Runtime library "rts2800_fpu32.lib"
b) -- float_support is set to fpu32
c) IQmath_fpu32 is in the search path
d) In "sw/modules/math/src/32b/math.h" (and all modules e.g. "sw/modules/clarke", ...) I changed #include "sw/modules/iqmath/src/32b/IQmathLib.h" to #include "sw/modules/iqmath/src/float/IQmathLib.h"

Now some modules (such as clarke.h give me "expression must have integral type" errors. This is, I assume, because floating point cannot perform lshift and rshift operations.

So, to my questions:
1. Have I made a mistake or can the fpu not be used unless I modify the modules which use bit-shifting?
2. Is the above procedure generally correct if I want to use the fpu and can I expect my program to get faster then?
3. Are there "sw/modules" which can be used with floating point math or do I have to change them myself?

Thank you so much in advance

  • 1) FPU unfortunately cannot be utilized in base modules because of the bit-shifting issue you described. Even though it looks as if the simple change should be switching the #define from IQ_MATH to FLOAT_MATH, we've seen issues when this directive is executed at compile time. You should be able to still use the fpu32 for other calculations, such as the i_beta assignment you've shown above. Also, do not change the #includes to the .../float/.. directory - you can see an example "fpu32" lab in lab4a. Those source files continue to use the .../32b/.. directory.
    2) Yes, generally speaking your procedure is correct. If you read starting from section 3.11 of the IQmath_Quickstart.pdf in ControlSUITE (C:\ti\controlSUITE\libs\math\IQmath\v160\doc), you'll see the steps laid out
    3) There are no floating point versions of the instaSPIN modules yet, but they are planned for release with our development kit for the new F28004x C2000 device. All new development will be done with native floating point compatibility instead of IQ Math

    Sean
  • Thanks a lot, that was exactly what I was looking for.

    I set up my project as in Lab4a and now my program runs with the desired speed without having to change any code.

    I love your products and the service so far.