Hi josephxavier,
Thank you for your more details.
I check your attachment, and find you said" I am reading this PWM frequency using interrupt on rising edge and calculating the time between two successive rising edges
"
Could you tell me, how did you find your PWM is the fluctation in frequency? Through the OSCILLOSCOPE or just through the rising edge caculation?
We should make sure it is caused by the PWM or the rising edge capture error, you can just define the fixed PWM frequent , don't change it with function void Engine_speed_PWMOUT(unsigned int FMOD_regVal), then test it, whether it will have the fluctuation.
Besides, please send the whole project to me, I would like to help you to check it on my side.
Wish it helps you!
If you still have question, please contact with me!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------