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.

GPIO Interrupt Toggle for Waveform Generation

Hello,

I am using an interrupt driven by a PWM to generate a specific waveform that toggles two different GPIO pins complementary. I'm doing this to create a voltage swing of 6.6 V (2 * 3.3V) across a transducer. The code clearly sets one GPIO on and one GPIO off, then toggles the two, but when I look at the pins on the oscilloscope, the output is in phase. I have no idea what could be going wrong. It is especially weird because this code was working a couple of days ago, and all of a sudden it stopped working. Finally, LED3 on my board (C2000 F28069 Experimenter's Kit) has been on while I am in the Edit perspective of CCS. Could this be a hardware issue? I'm fairly sure I haven't been driving any large voltages across the board, but yesterday I did use the kit for about 10 hours straight. 

The code inside the interrupt is below.

Any help would be much appreciated.

Thanks,

Matthew Krenik

interrupt void ISR_INT3_PWM2(void)
{

if (counterPWM == 0)
{
GpioDataRegs.GPADAT.bit.GPIO0 = 1; // Initially turns on GPIO 0, turns off GPIO 1
GpioDataRegs.GPADAT.bit.GPIO1 = 0;
EPwm2Regs.ETCLR.bit.INT = 1;
counterPWM++;
}
else if (counterPWM > 0 && counterPWM < numberOfToggles)
{
GpioDataRegs.GPATOGGLE.all |= 0x0003; // Toggles so that GPIO 1 is on, and GPIO 0 is off
EPwm2Regs.ETCLR.bit.INT = 1;
counterPWM++;
}
else if (counterPWM == numberOfToggles) // After numberOfToggles expires, holds the same level for one period
// this flips the phase and adds a braking function
{
EPwm2Regs.ETCLR.bit.INT = 1;
counterPWM++;
}
else if (counterPWM == numberOfToggles+1) // Toggles so that it completes the brake sequence
{
GpioDataRegs.GPATOGGLE.all |= 0x0003;
EPwm2Regs.ETCLR.bit.INT = 1;
counterPWM++;
}
else
{
GpioDataRegs.GPADAT.all &= 0xFFFC;
counterPWM = 0;
}

IFR = 0x0000;
PieCtrlRegs.PIEACK.all = 0xFFFF; // Must acknowledge the PIE group
asm(" CLRC INTM, DBGM"); // Enable Global Interrupts
}