Sideband generation during sin wave PWM

Thread Starter

hwgeek1221

Joined Nov 21, 2015
16
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!
 

crutschow

Joined Mar 14, 2008
34,285
You may be looking at a beat frequency between the 50Hz and the 10KHz carrier.
Try change the frequency of one or the other slightly and see if the sidebands also change.
How far below the fundamental are the sidebands.
 

Thread Starter

hwgeek1221

Joined Nov 21, 2015
16
You may be looking at a beat frequency between the 50Hz and the 10KHz carrier.
Try change the frequency of one or the other slightly and see if the sidebands also change.
How far below the fundamental are the sidebands.
Thank you for your reply.
What is meant by a beat frequency?
I have my 1st sideband at 46 Hz and the second at 54 Hz.
 

jjw

Joined Dec 24, 2013
823
Do you have any interrupts running beside of your program. They might interfere with your pwm routine.
 
Top