2021-01-27 03:57 AM
Since I'm still fairly new to the STM / Arm world, I wonder why, for example, the X-CUBE MCSDK does NOT use the floating point algorithm for devices that have a hardware floating point unit. Are there special things to watch out for when using floating point instructions in combination with interrupts (for motor control in this special case)?
The questions relate to writing floating point control algorithms for better understanding and "easier" writing of code on STM32 machines with floating point units. Hope someone can add some good notes on this. Many Thanks!
2021-01-27 04:03 AM
Aside from the obvious performance penalty, yes.
You would need a full interrupt stackframe then, which includes half of the 32 FP registers.
And believe it or not, single precision FP has an accuracy disadvantage compared with proper integer implementations.
2021-01-28 12:18 AM
Thanks for your response!
Interrupt stack frame: Are there some more details or an example of how this is actually done? Or is this allready done by the Controller when setting the correct bits?
// Enable lazy stacking of FPU registers for interrupts
SET_BIT (FPU-> FPCCR, FPU_FPCCR_LSPEN_Msk + FPU_FPCCR_ASPEN_Msk);