Part Number: TMS320F28375D
I've got a project where I would like to use the EPWM trip hardware functionality and have the ability to trip PWM from multiple sources, and then detect the source of the PWM trip after the event occurs. Currently I'm accomplishing this by manually polling GPIO pin status of the trip sources afterwards in software (see code below), but this has the potential to miss recording the trip source correctly if the trip event is very short duration. Ideally, I'd like to find a way to query a hardware register that could point me to the source of the trip signal. Is this possible?
Code of the software polling approach is below:
// INITIALIZATION (call once)
//================
//Select DRV_FAULT & estop as INPUTXBAR1
XBAR_setInputPin(XBAR_INPUT1, XBAR_INPUT_GPIO_M1);
XBAR_setInputPin(XBAR_INPUT2, ESTOP_SENSE);
// Configure TRIP 4 to OR the High and Low trips from both
// comparator 1, 2 & 3, clear everything first
EALLOW;
HWREG(XBAR_EPWM_CFG_REG_BASE + XBAR_O_TRIP4MUX0TO15CFG) = 0;
HWREG(XBAR_EPWM_CFG_REG_BASE + XBAR_O_TRIP4MUX16TO31CFG) = 0;
EDIS;
// Enable Muxes for ored input of CMPSS1H and 1L, mux for Mux0x
//cmpss1 - tripH or tripL
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX00_CMPSS1_CTRIPH_OR_L);
//cmpss4 - tripH or tripL
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L);
//cmpss3 - tripH or tripL
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L);
//inputxbar1 trip DRV_FAULT
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX01_INPUTXBAR1);
//inputxbar2 trip estop
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX03_INPUTXBAR2);
//================
// FOREGROUND CHECK (run continuously)
//================
// Check for PWM trip
if((EPWM_getTripZoneFlagStatus(obj->pwmHandle[0]) & EPWM_TZ_FLAG_OST) || (EPWM_getTripZoneFlagStatus(obj->pwmHandle[1]) & EPWM_TZ_FLAG_OST)
|| (EPWM_getTripZoneFlagStatus(obj->pwmHandle[2]) & EPWM_TZ_FLAG_OST)) {
if(pMotor->faults.indirect.latchFault) {
pMotor->faults.fault_source.drv = GPIO_readPin(XBAR_INPUT_GPIO_M1);
pMotor->faults.fault_source.estop = GPIO_readPin(ESTOP_SENSE);
pMotor->faults.indirect.latchFault = 0;
}
}
//================