Hi
I have been using cpu timer 0 ISR in my project for sine wave generation.
I generated a 50Hz sine wave using rampgen library with 20kHz ISR. But when i observed it with a precision power analyser, it showed 50.2Hz.
Therefore i used 49.8Hz as the rampgen frequency and got 50Hz output.
But i also noticed that the power measure sine analyser library also detects the frequency as 49.8 Hz, while actual frequency is 50Hz.
Checked the ISR running frequency with gpio toggle and an oscilloscope. Output showed as 20.16kHz.
Therefore I play around with the cpu timer 0 period config value and found out that 50.2 micro second gives the exact outputs i want. All things were as expected.
for 20kHz, correct value for period should be 50. But the working value is 50.2. Why is that.
ConfigCpuTimer(&CpuTimer0, 90,50.2);
Regards
Damith