I have a PWM pin that is configured to be at 40Khz but I am seeing it bounce around in my oscilloscope. It would read 40.045KHz and bounce ~ +/- 4Hz or so.
I have another module that is using Atmel MCU that is consistently(No bouncing/jittering) outputting PWM at 39.999Khz so I feel like the oscilloscope i'm using is not the problem.
I am Using internal clock(HSI) at 16MHz
Prescaler = 0
ARR = 399
TIM16->CC1 = 200 // ~50% duty cycle
Is there a way to make the PWM output frequency to be consistent?
Any help/feedback is appreciated.