cancel
Showing results for 
Search instead for 
Did you mean: 

Why is the MCSDK not using floating point algorithms?

ben5en
Associate II

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!

2 REPLIES 2
Ozone
Lead

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.

ben5en
Associate II

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);