Hi,
I put a RC circuit (1K,10nF) between the PWM2A output to the CMPIN3P input. I configured the PWM period to 25uS and the duty to 50%.
I wanted the pwm output to go to zero as soon as the comparator input is greater than 1.65V, and stay at zero until the next cycle, even if the comparator voltage drops below 1.65V. The problem is that the PWM output is going back to 1 as soon as the comparator input drops below 1.65V, thus creating a high frequency oscillation on the PWM pin.
What did I do wrong or what is missing from my configuration below?
void initCMPSS(void)
{
CMPSS_enableModule(CMPSS3_BASE);
CMPSS_configHighComparator(CMPSS3_BASE, CMPSS_INSRC_DAC);
CMPSS_configDAC(CMPSS3_BASE, CMPSS_DACREF_VDDA | CMPSS_DACVAL_SYSCLK |
CMPSS_DACSRC_SHDW);
CMPSS_setDACValueHigh(CMPSS3_BASE, 2048);
CMPSS_configOutputsHigh(CMPSS3_BASE, CMPSS_TRIP_ASYNC_COMP |
CMPSS_TRIPOUT_ASYNC_COMP);
XBAR_setOutputMuxConfig(XBAR_OUTPUT3, XBAR_OUT_MUX04_CMPSS3_CTRIPOUTH);
XBAR_enableOutputMux(XBAR_OUTPUT3, XBAR_MUX04);
}
void EnableTripZone(void)
{
EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_DCAEVT1, EPWM_TZ_ACTION_LOW);
EPWM_setTripZoneDigitalCompareEventCondition(EPWM2_BASE,EPWM_TZ_DC_OUTPUT_A1,EPWM_TZ_EVENT_DCXH_HIGH);
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE,EPWM_DC_COMBINATIONAL_TRIPIN4, EPWM_DC_TYPE_DCAH);
EPWM_enableTripZoneSignals(EPWM2_BASE, EPWM_TZ_SIGNAL_CBC1);
EPWM_setDigitalCompareEventSource(EPWM2_BASE,EPWM_DC_MODULE_A,EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX04_CMPSS3_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX04);
EPWM_clearTripZoneFlag(EPWM2_BASE, EPWM_TZ_INTERRUPT | EPWM_TZ_FLAG_OST);
}