Reply by baha...@hotmail.com October 17, 20112011-10-17
Hi,
I am using F2812 chip to implement the following.
1- Generate a symmetric three phase PWM, PWM7-12, using EVB on chip.
2- Map the compare match 4, CMP4, to call a software Interrupt service routine using PIE.
The first task, PWM generation, was successfully done. I have verified the physical hardware output using a scope.
However, for the second part, compare match Interrupt, I couldn’t get the expected output.
The Interrupt was delayed from the moment it should start.
My debug approach was as following.
In CMP4 Interrupt service routine, I set a hardware pin HI and maintain it for 5 micro second so I can monitor it on a scope.
For such configuration, CMP4 Hardware debug pin should go high when PWM7 goes high too.
But PWM7 was leading CMP4 hardware debug pin with big time difference, not dead-band.
Also changing the PWM ratio was only affecting the PWM7 on time period, as expected, but there was no change to the moment where CMP4 occurs.
I don’t know why this delay between the CMP4 interrupt and PWM7 goes Hi happen
Please find below the function I am using to initiate the CMP4 Interrupt and serve it
void CMP4INT_isr_init(void)
{
//Remap CMP4INT to CMP4INT_isr()
EALLOW;
PieVectTable.CMP4INT = &CMP4INT_isr;
EDIS;
//Enable CMP4INT Mask
EvbRegs.EVBIMRA.bit.CMP4INT = 1;
//Reset/enable CMP4INT Flag
EvbRegs.EVBIFRA.bit.CMP4INT = 1;
//Enable PIE CMP4INT in group 4
PieCtrlRegs.PIEIER4.bit.INTx1 = 1;
//enable Interrupt from group 4
IER |= M_INT4;
}
-------------------------
interrupt void CMP4INT_isr(void)
{
//Serve the interrupt
// Enable more interrupts from this timer
EvbRegs.EVBIMRA.bit.CMP4INT = 1;
//Reset CMP4INT Flag
EvbRegs.EVBIFRA.all |= BIT1;
//Acknowldge PIE from group 4
PieCtrlRegs.PIEACK.all |= PIEACK_GROUP4;
//Interrupt function
GpioDataRegs.GPBDAT.bit.GPIOB6=1;
DELAY_US(5);
GpioDataRegs.GPBDAT.bit.GPIOB6=0;
}
Could you guide me in any error I am doing in either the interrupt configuration or service function which may result in this delay?
thank you in advance.
Regards,
Bahaa

_____________________________________