I am new to the F28069 microcontroller. I am trying to use the cpu timer2 interrupt to control the epwm module. My pwm frequency is 500kHz. I would like it to generate 5 cycles and stop for 200 microseconds, and then generate another 5 cycles, and keep the same type of generating pwm signals.
Here is the code:
EALLOW;
PieVectTable.TINT2 = &cpu_timer2_isr;
EDIS;
ConfigCpuTimer(&CpuTimer2,80,10);///configure Timer2 @10 microseconds
StartTmr2();
IER |= M_INT14;
//Enable TINT0 in the PIE: Group 1 interrupt 7
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
Here is the interrupt routine:
interrupt void cpu_timer2_isr(void)
{
EPwm7Regs.CMPA.half.CMPA = 0;///Stop PWM by setting duty cycle to be 0
delayTime(200);///Wait for 200 micro seconds
EPwm7Regs.CMPA.half.CMPA = 80;///Restart PWM
}
My problem is that the code runs well, but the Timer2 does not trigger as I wish. It only generates 2 or 3 cycles each time. Does anyone have any idea about it? Thank you in advance.
Xinjun