Hello,
I am trying to generate a sin wave by using PWM. My MCU is an stm32f405 running at 168 MHz. The timer that I'm using ( the one generating the PWM signal) also runs at 168 MHz in up-down count mode (symmetric PWM). The timer has a frequency of 10KHz (switching frequency) and the frequency of my sin wave is 50Hz. I have a sin lookup table of 200 points that cover a full 50Hz cycle generated from matlab and imported to my project. On every overflow of the timer a new point is taken from the sin table and placed in the compare register. The effect of the change in the compare value takes place on the next cycle of the timer (Due to the existence of preload and shadows registers). I also have a lowpass RC filter on Channel 1 of my timer.
The output is taken on the capacitor of the RC filter. I am able to get a 50Hz sin wave however I have sidebands added to it, one on about 46Hz and the other on 54Hz. I'm using the FFT on the oscilloscope to find the frequencies of the sideband. Looking at the oscilloscope in the time domain, one can see that the output voltage on the capacitor of the RC is "wiggling". The sidebands have a smaller amplitude than the fundamental.
Has anyone encountered something like this before? What can be the cause of this?
Thank you!
I am trying to generate a sin wave by using PWM. My MCU is an stm32f405 running at 168 MHz. The timer that I'm using ( the one generating the PWM signal) also runs at 168 MHz in up-down count mode (symmetric PWM). The timer has a frequency of 10KHz (switching frequency) and the frequency of my sin wave is 50Hz. I have a sin lookup table of 200 points that cover a full 50Hz cycle generated from matlab and imported to my project. On every overflow of the timer a new point is taken from the sin table and placed in the compare register. The effect of the change in the compare value takes place on the next cycle of the timer (Due to the existence of preload and shadows registers). I also have a lowpass RC filter on Channel 1 of my timer.
The output is taken on the capacitor of the RC filter. I am able to get a 50Hz sin wave however I have sidebands added to it, one on about 46Hz and the other on 54Hz. I'm using the FFT on the oscilloscope to find the frequencies of the sideband. Looking at the oscilloscope in the time domain, one can see that the output voltage on the capacitor of the RC is "wiggling". The sidebands have a smaller amplitude than the fundamental.
Has anyone encountered something like this before? What can be the cause of this?
Thank you!