Details of SPD_GetAvrgMecSpeedUnit
I asked a question before on the routine SPD_GetAvrgMecSpeedUnit but the answers did not address what I was looking for. https://community.st.com/s/question/0D53W00000xsTlzSAE/information-on-the-c-code-procedure-spdgetavrgmecspeedunit-
This routine returns the average mechanical rotor speed and is called every Medium Frequency Task (1ms). The routine itself returns a pointer to SpeednPosFdbk_Handle_t..
I can't seem to find where the average speed is actually computed.? It is a moving average computed over STO_FIFO_DEPTH_UNIT samples (currently set to 64).
The Medium Frequency Task occurs every 1ms but the motor FOC calculations are updated every PWM period. Is the speed of the new sample put in the buffer calculated over 1ms or is it a "instantaneous" value measured between PWM periods?
My concern with the moving average filter is the linear phase incurs a large phase delay even at low frequencies (see bode)
Thanks for any help you can give,
Regards,

