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.
I have a power electronics project in which I configured the EPWM to use trip combination input (from one shot trip for protection and cycle by cycle trip for Peak current mode control). The EPWM works well with the one shot trip from the CMPSS but when I included the configuration code of the cycle by cycle trip for PCMC the EPWM does not give any output again. When I comment out the code for the initialisation of the CMPSS for the PCMC, the ePWM works well and I can see the ouput at the oscilloscope. Please what can be the problem.
The configuration code for my CMPSS for the PCMC is below:
void hw_cmpss::IDC2DCCPCMCInit(void)
{
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CMPSS1);
/**< Enable CMPSS and configure the negative input signal to come from the DAC */
CMPSS_enableModule(CMPSS1_BASE);
CMPSS_configHighComparator(CMPSS1_BASE, CMPSS_INSRC_DAC);
/**< Select positive input of CMPSSH to come from to come from pin 9 CMPSSH1.0*/
ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_1, 0); //TODO verify values
/**< Use VDDA as the reference for the DAC and set DAC value to midpoint for arbitrary reference */
CMPSS_configDAC(CMPSS1_BASE, CMPSS_DACREF_VDDA | CMPSS_DACVAL_SYSCLK | CMPSS_DACSRC_RAMP);
/**< DAC initilization */
//CMPSS_setMaxRampValue(CMPSS1_BASE, RAMP_MAX_VALUE);
CMPSS_configRamp (CMPSS1_BASE, RAMP_MAX_VALUE, RAMP_DEC_VALUE, RAMP_DELAY_VALUE, RAMP_PWM_SYNC_SRC, USE_RAMP_VAL_SHDW);
//CMPSS_setDACValueHigh(CMPSS1_BASE, 2048);
/**< Configure digital filter. For this example, the maxiumum values will be */
/**< used for the clock prescale, sample window size, and threshold. */
//CMPSS_configFilterHigh(CMPSS1_BASE, 0x3FF, 32, 31);
/**< Initialize the filter logic and start filtering */
// CMPSS_initFilterHigh(CMPSS1_BASE);
//
// /**< Configure the output signals. CTRIPH will be fed to the output */
CMPSS_configOutputsHigh(CMPSS1_BASE, CMPSS_TRIP_ASYNC_COMP);
//
// /**< clear all latched comparator event */
// CMPSS_clearFilterLatchHigh(CMPSS1_BASE);
/**< Setup the Output X-BAR to output CTRIP on OUTPUTXBAR! */
XBAR_setEPWMMuxConfig(XBAR_TRIP8, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP8, XBAR_MUX00);
// CMPSS_configBlanking (CMPSS1_BASE, RAMP_BLANCH_VALUE);
// CMPSS_enableBlanking (CMPSS1_BASE);
}
The constant variables are below:
#define CHARG_OC_VALUE 3723u //trip at 3volt
#define BATT_OC_VALUE 3723u //trip at 3volt
#define RAMP_DEC_VALUE 20u
#define RAMP_MAX_VALUE 512u
#define RAMP_BLANCH_VALUE 999u
#define RAMP_DELAY_VALUE 20u
#define RAMP_PWM_SYNC_SRC 1u
#define USE_RAMP_VAL_SHDW 1u
The configuration of my ePWM that relates to the combine trip is below:
Interrupt_register(INT_EPWM2_TZ, &epwm::ISRPCMCCBCTrip);
EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_DCAEVT1, EPWM_TZ_ACTION_LOW); //TODO verify
EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_DCBEVT1, EPWM_TZ_ACTION_LOW);
EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_DCAEVT2, EPWM_TZ_ACTION_LOW); //TODO verify
EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_DCBEVT2, EPWM_TZ_ACTION_HIGH);
/**< configure trip zone action for DCAEVT1, DCBEVT1 and DCAEVT2, DCBEVT2 trigger when it is high */
EPWM_setTripZoneDigitalCompareEventCondition (EPWM2_BASE, EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_HIGH);
EPWM_setTripZoneDigitalCompareEventCondition (EPWM2_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_HIGH); // verify
EPWM_setTripZoneDigitalCompareEventCondition (EPWM2_BASE, EPWM_TZ_DC_OUTPUT_A2, EPWM_TZ_EVENT_DCXH_HIGH);
EPWM_setTripZoneDigitalCompareEventCondition (EPWM2_BASE, EPWM_TZ_DC_OUTPUT_B2, EPWM_TZ_EVENT_DCXH_HIGH); // verify
/**< Configure DCAH and DCBH to use trip4 and trip5 and trip8 */
//combine trip4 and trip5 and trip8
EPWM_selectDigitalCompareTripInput(EPWM2_BASE, EPWM_DC_TRIP_COMBINATION, EPWM_DC_TYPE_DCAH);
EPWM_selectDigitalCompareTripInput(EPWM2_BASE, EPWM_DC_TRIP_COMBINATION, EPWM_DC_TYPE_DCBH);
//trip4
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE, EPWM_DC_COMBINATIONAL_TRIPIN4, EPWM_DC_TYPE_DCAH);
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE, EPWM_DC_COMBINATIONAL_TRIPIN4, EPWM_DC_TYPE_DCBH);
//trip5
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE, EPWM_DC_COMBINATIONAL_TRIPIN5, EPWM_DC_TYPE_DCAH);
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE, EPWM_DC_COMBINATIONAL_TRIPIN5, EPWM_DC_TYPE_DCBH);
//trip8
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE, EPWM_DC_COMBINATIONAL_TRIPIN8, EPWM_DC_TYPE_DCAH); //TODO for PMCM
EPWM_enableDigitalCompareTripCombinationInput(EPWM2_BASE, EPWM_DC_COMBINATIONAL_TRIPIN8, EPWM_DC_TYPE_DCBH);
/**< enable trip zone signal for DCAEVT1 and DCBEVT1 and for one short tripping */
EPWM_enableTripZoneSignals(EPWM2_BASE, EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1);
EPWM_enableTripZoneSignals(EPWM2_BASE, EPWM_TZ_SIGNAL_DCAEVT2 | EPWM_TZ_SIGNAL_DCBEVT2);
/**< configure for unfiltered and asynchronous operation */
EPWM_setDigitalCompareEventSource(EPWM2_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
EPWM_setDigitalCompareEventSource(EPWM2_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL); //TODO verify
EPWM_setDigitalCompareEventSource(EPWM2_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_2, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
EPWM_setDigitalCompareEventSource(EPWM2_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_2, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL); //TODO verify
Pls what can be the reason for this problem.
Thanks
What is the change you make in your EPWM configuration code?
Does your CMPSS output look as expected?
I made not changes to my code. Without calling the function (void hw_cmpss::IDC2DCCPCMCInit(void)) to initialise the CMPSS, the EPWM generates the expected waveform. But once i call the code to initialise the CMPSS, the EPWM does not have any waveform at the pins again.
The cycle by cycle CMPSS does not look as expected. It stops the generation of output on the pins
I see your CMPSS fully blocks your EPWM when configured.
It is a CMPSS setting issue. Let me see if the CMPSS expert can help.
Frank Ankapong can you take a look at the CMPSS settings? it is fully blocking the EPWM through Digital compare.
Hi Abayomi,
Nothing sticks out immediately to me from the CMPSS code. How are you driving the CMPSS?
Can you additionally bring out the CMPSS output onto the Outputxbar->GPIO to see if the CMPSS output tripping?
Sorry for the late rely.
I tried out the suggestion but I only got a high at the GPIO pin. The code for this suggestion is below
/**< Setup the Output X-BAR to output CTRIPout on OUTPUTXBAR! */
XBAR_setOutputMuxConfig(XBAR_OUTPUT3, XBAR_OUT_MUX00_CMPSS1_CTRIPOUTH);
XBAR_enableOutputMux (XBAR_OUTPUT3,XBAR_MUX00);
/**< configure GPIO26 for the output reset */
GPIO_setPadConfig(26, GPIO_PIN_TYPE_STD); // Enable open drain not very sure TODO GPIO_PIN_TYPE_PULLUP
GPIO_setPinConfig(GPIO_26_OUTPUTXBAR3);
GPIO_setDirectionMode(26, GPIO_DIR_MODE_OUT); // output
I also carefully reviewed my entire code that relates to this but I did not find a solution to the problem
I commented out the code below
/**< Setup the Output X-BAR to output CTRIP on OUTPUTXBAR! */
XBAR_setEPWMMuxConfig(XBAR_TRIP8, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP8, XBAR_MUX00);
and the PWM once again generated an pwm wave. But of course this is the code that links the cmpss to the ePWM module.
The epwm code I posted above looks confusing but I also checked it but did not find anything. Perharps is the problem from there?
Where else can I look to for a solution to the problem.
Thanks.
Babatola Abayomi
Abayomi,
The outputxbar config code looks fine. Can you sanity check that the CMPSS itself is actually tripping? i.e Look at the COMPSTS.COMPHSTS register to see if shows 1 when you induce a trip on the input and 0 when you do the same for untrip.
I would check this out today. I want to ask if we have such example in the C200ware - \driverlib\f28004x\examples? I checked and did not find one.
I would check this out today. I want to ask if we have such example in the C200ware - \driverlib\f28004x\examples? I checked and did not find one.
We do have CMPSS examples that do something similar at this directory-> C2000Ware_version\driverlib\f28004x\examples\cmpss
The examples did not include cycle by cycle tripping.
The example is setup for OSHT mode but can be modified to do CBC.