Sideband generation during sin wave PWM

Discussion in 'Embedded Systems and Microcontrollers' started by hwgeek1221, Feb 26, 2016.

  1. hwgeek1221

    Thread Starter New Member

    Nov 21, 2015
    6
    0
    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!
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    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.
     
  3. hwgeek1221

    Thread Starter New Member

    Nov 21, 2015
    6
    0
    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.
     
  4. jjw

    Member

    Dec 24, 2013
    173
    31
    Do you have any interrupts running beside of your program. They might interfere with your pwm routine.
     
Loading...