Hi @Tomato1 ,
I tried your example on my desk. Just for clarification, I have RT1170-EVKB and Teknic M-2311P. It is not exactly the same setup as you are having but for the CPU load issue investigation should be OK.
I tried 3 frequencies from your mc_periph_init.h (16kHz, 32kHz, 64kHz):

Then I started Freemaster with MCAT, I could see a change in Sample time (62.5us, 31.25us, 15.625us). I always recalculated and updated parameters for new Sample time ("Update" button) and spun the motor at 500rpm in sensorless FOC control. I checked the Cycle number:



The Max Cycle number was 4330, 4370, 4365. The cycle number is about constant which is expected, the calculated CPU load grows (x2 x4) with frequency (32kHz and 64kHz).
Which configuration/memory are you using? I was running the example from RAM