I am using FRDM-KV31F and FRDM-MC-LVPMSM boards to control a PMSM motor using Kinetis Motor Control, and I noticed that fixed point math is used for the FOC algorithm. Is it possible to use floating point math for the FOC algoritm? Why the fixed point math is used instead floating point, because as far as I know KV31 microcontroller has single precision floating point unit.
KMS on the KV31 is only available as a fixed-point solution. We have run benchmarks between fixed and floating point libraries and there is virtually no difference in performance or code size.
If you are interested in motor control libraries that are floating point we do have them:
But please notice that those are not the same libraries that are used in KMS. Those libraries are essentially considered "advanced" or for advanced users.
Let me know if you have further questions or comments.
Thanks Eduardo. Do you have any specific data or white papers on the fix/floating point comparison? Any application code examples utilizing the floating point libraries?
I've done a limited amount of this benchmarking / comparison. Based on our limited testing we've found no meaningful difference between floating point and fixed point FOC on the KV31. Unfortunately, I don't have data that is shareable.
A single-precision floating point number is limited to 24 significand bits. The fixed-point type used for all calculations requiring precision in KMS is a Q24 which maintains the exact same precision as a single-precision float. We spent quite a bit of time optimizing the fixed point math library to improve the execution speed of the basic math operations, so that the math execution speed is on-par with the standard library floating point operations.
The only advantage you could gain by running in floating point is that everything can be done using engineering units instead or normalized units.