This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PWM Frequency Accuracy

I have F28069 running at 90MHz (I did change the PLL DIV to change from 80MHz default to 90MHz).

I have setup my PWMs (up-down count mode) for 16kHz.

I have setup TBPRD to be 2813 (2*2813/90MHz = 15997Hz) ... this is close enough for me, and I don't need to use HRPWM.

However, when measured on a scope, I am getting something slightly off, I am measuring 16.1kHz when I look at the PWMs.  So I have to increase TBPRD to something like 2830 to measure close to 16.0kHz.

This is important because in my control computations (PID, etc.), I use the step time of 1/16kHz (62.5us) in my calculations and causes everything to be slightly off.

What is the source of this inaccuracy?  I am thinking it may be SYSCLK, is there any way to verify and check what my SYSCLK is actually running at?  How can I account for this correctly?