This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377S: PWM modulation problem

Part Number: TMS320F28377S


Hello TI community,

I am currently trying to modulate my pwm using CPU Timer interrupts. I am producing my modulated pwm frequency, however, my current issue is that there is about 20 seconds of delay before the modulation takes place. I initialized my pwm with it's counter frozen. I have also initialized my cpu timer with the counter also stopped. I have my cpu timer interrupting at the speed of the number of samples I want to modulate times the frequency of the sine wave I want to create. I think this is some sort of sync issue. It there a way to sync the epwm and cpu timer counters together?

  • Hi Brenden,

    If the frequency isn't too slow, I'd recommend using two ePWM modules in stead of ePWM + CPU timer. The ePWMs have many dedicated mechanisms to ensure exact synchronization.

    If the frequency is slower, it should be possible to just enter an ePWM ISR each period and implement the slower timer in software. This will ensure exact synchronization too because it only counts at discreet ePWM events.

    The other thing to check is that the PLL is correctly locked and the device is operating at the desired SYSCLK frequency. You should enable the XCLOCKOUT pin and measure the frequency both before and after the modulation runs.
  • Hi Devin,

    upon further debugging. I created a infinite for loop with a incremented variable and a delay. I am noticing it's consistently taking about 21.5 seconds before i notice on the oscilloscope my pwm is modulating. At faster cpu timer interrupt modulation frequencies like at 512 kHz, my main loop incrementing variable stops increment and my program is stuck in my cpu interrupt (I can tell by seeing the interrupt count expression incrementing). At slow cpu timer speeds like around 1000 Hz, my main test loop variable is able to continue incrementing and my program is not stuck in my interrupt.

    I had this code working before a while ago before I began working on some different aspects of my program but now I am just commenting everything else out and focusing solely back on this issue. For reference, my cpu timer needs to be able to operate up to 512 kHz, and my ePWM I have set to 600 kHz (to be able to run fast enough). I believe I have also configured both peripherals to follow a 100 MHz CPU clock. Before I jump ship to using another ePWM to generate my interrupts to load the duty cycle values into my main ePWM, I was wondering if anyone might see what my problem is as I feel it has to do with some configuration that I changed by mistake.
  • I also just tried looking at the system clocks. I noticed that CPU1.SYSCLK and PLLSYSCLK are staying consistent before and after the modulation but I do notice that they are only running at 25 MHz which is slower than what I thought they were running at (200 MHz).
  • Hi Brenden,

    If your CPU clock is running slower than expected and execution never leaves the CPUT timer ISR my guess is that the main CPU thread is being starved of cycles by interrupt. If execution only bounces back to the main thread very infrequently it could explain why it is taking ~20 seconds to increment your counter to the desired value.