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: Using the FPU in my own code

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

Hi,

I’m working on a project based on InstaSPIN Lab 5e using the TMS320F28069M chip and InstaSPIN-Motion. The FPU isn’t enabled in that lab, but I’m wondering if I can still use it for some of my own code (particularly in the MainISR function) and if there would be any caveats in doing so.

Questions:

  1. Even though the FPU isn’t enabled on a project-wide basis here, is it still possible to use it for some of my own code in this project? If so, how? Would I need to put my own code in a separate .c file and enable the FPU only for that file?
  2. In particular, I’d like to use the FPU for some calculations in the MainISR function. Is that possible, or will I need to stick with fixed point values there?

I’m fairly new to embedded systems programming and working with fixed point values, so I figure I might as well use this chip’s FPU if I can. Maybe it’s just because I’m not used to thinking like a computer, but keeping all of the calculations in the code I’m writing within fixed-point ranges seems to complicate things quite a bit!

  • Hi Griffin,

    A TI expert has been notified of your question and will reply soon (likely after the weekend).

    Best,

    Kevin

  • Griffin,

    I'll have to check if the compiler will support per-file wise setting of processor options like FPU etc. I suspect it should be OK, but I need to either check it out myself or confirm.

    Coming to your specific question, the F2806x has an FPU so it is odd that the FPU is not selected in project properties - processor options. Yanming (a colleague who has been notified of this thread) may have an explanation for that.

    However, the lab has been created with IQMath precisely for this purpose - to be able to easily port it from fixed point to floating point and vice versa. If you look at IQMathLib.h, you'll see that FLOAT_MATH is 1 and IQ_MATH is 0. This means that the IQMath library is operating in floating point mode. The fact that the FPU is not enabled in Project properties means that all the floating point operations will be routed to the RTS library, which won't be very efficient. So enabling the FPU will definitely help, and I don't see why enabling it project wide will be a problem.

    Try this and let me know.

    Yanming, please let me know your thoughts.

    Thanks,

    Sira

  • Griffin,

    Once you update the project by enabling FPU, you'll get a bunch of build errors.

    Refer to my response on the thread below to fix these errors.

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/906236/3349641#3349641

    Thanks,

    Sira

  • Thanks for the help! I copied the setup in the thread you linked to as best I could and managed to get proj_lab05e to compile with the FPU enabled and without errors. Woo!
    I probably should have mentioned that I'm using MotorWare v1.01.00.18 rather than C2000WARE, since there may be differences between the two when it comes to using the FPU, but so far so good.
    I haven't been able to enter debug mode to test the project on our hardware yet because of an unrelated debug error, but I'll post an update when I do.
    I'm pretty sure I'll have to make some changes to my proj_lab05e.c file to accommodate the FPU as well. By comparing proj_lab05b and proj_lab05g (which are the same except proj_lab05g is set up to use the FPU), I noticed some lines that had been modified for the FPU, so I'm planning to copy those changes over to my proj_lab05e.c file.
    In case it's helpful to others and so that you can check my work, here are all the steps I took to get the lab to compile with the FPU enabled:
    1. Add FPU libraries to the project
     
    (Your screengrab in the other thread also included "IQmath_fpu32_coff.lib", but I couldn't find it anywhere in the MotorWare directory, so I think it's something new in C2000WARE)
     
    2. Enable FPU in Project Properties
     
     
    3. Change the File Search Path from "rts2800_ml.lib" to "rts2800_fpu32.lib"
     
    4. Replace the libraries in the Link Order list with their fpu32 equivalents
    The project compiled with no errors at this point.
    Thanks again for the help!
  • Griffin,

    Great to hear!

    Yes, the _coff is in c2000ware where indexed libraries are used. 

    I'll keep this thread in Waiting for Customer status while you work towards updates. Or if you prefer, mark this issue as resolved and open a fresh thread when you're ready.

    Thanks,

    Sira