Like I said, I looked at it, and it seemed like a complicated proposition to me:
- it works on fixed point numbers, not floating point
- it can have up to 24 bit precision, so that would be ok, but to get there requires running the CORDIC for many iterations - so the speed gains are better when you don’t need precision
- it is a asynchronous peripheral with no Arduino support whatsoever - you’d have to interact with it using only registers or HAL functions.
- Its performance is optimised in combination with interrupts, or even better, DMA - but calls to trig functions are embedded in streight procedural code, so there would be no easy way to make this asynchronous. You’d be polling for the result.
- There’s also no compiler or libc/math level support for this. Ideally you’d want to call sin() or cos(), and have the compiler know about the asynchronous CORDIC calls, and reorder code to parallelise it while the CORDIC does its job…
So to use the CORDIC in a minimal way you’d have to implement CORDIC-polling versions of the trig functions, and a bunch of carefully written conversion code to convert arguments from floating point to fixed point representations.
To use it properly you’d have to completely re-write the algorithms to (at least partially) use fixed point math and operate in an asynchronous, interrupt or DMA driven way.
None of this is very “Simple” so from my point of view, while cool, I think it’s out of scope for SimpleFOC. If the people at stm32duino make CORDIC versions of sin() and cos() that we can just easily use, that would be a different thing… but as it stands, I think it’s out of scope for us.