Setting the OUTEN bit to 0 results in both PWM A and PWM B being active and gradually dropping off, which is very undesirable:

Using PWM faults does drop both outputs properly to 0. I'm trying to set up QTMR to count the PWM cycles as you described and then trigger the PWM fault. However, the quad timer does not seem to work, is there an example of using Quad Timer as a counter with external input? Here is my initialization code, maybe you can spot what is wrong with it.
QTimer Initialisation:
const qtmr_config_t TMR3_Channel_0_config = {
.primarySource = kQTMR_ClockCounter0InputPin,
.secondarySource = kQTMR_Counter0InputPin,
.enableMasterMode = false,
.enableExternalForce = false,
.faultFilterCount = 0,
.faultFilterPeriod = 0,
.debugMode = kQTMR_RunNormalInDebug
};
static void TMR3_init(void) {
/* Quad timer channel Channel_0 peripheral initialization */
QTMR_Init(TMR3_PERIPHERAL, TMR3_CHANNEL_0_CHANNEL, &TMR3_Channel_0_config);
/* Setup the timer period of the channel */
QTMR_SetTimerPeriod(TMR3_PERIPHERAL, TMR3_CHANNEL_0_CHANNEL, 5U);
/* Enable interrupt requests of the timer channel */
QTMR_EnableInterrupts(TMR3_PERIPHERAL, TMR3_CHANNEL_0_CHANNEL, kQTMR_CompareInterruptEnable);
/* Interrupt vector TMR3_IRQn priority settings in the NVIC. */
NVIC_SetPriority(TMR3_IRQN, TMR3_IRQ_PRIORITY);
/* Enable interrupt TMR3_IRQn request in the NVIC. */
EnableIRQ(TMR3_IRQN);
/* Start the timer - select the timer counting mode */
QTMR_StartTimer(TMR3_PERIPHERAL, TMR3_CHANNEL_0_CHANNEL, kQTMR_PriSrcRiseEdge);
}
PWM initialisation:
XBARA_Init(XBARA1);
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputFlexpwm1Pwm3OutTrig01, kXBARA1_OutputQtimer3Tmr0Input);
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputQtimer3Tmr0Output, kXBARA1_OutputFlexpwm1Fault0);
pwm_config_t pwmConfig;
PWM_GetDefaultConfig(&pwmConfig);
pwmConfig.reloadLogic = kPWM_ReloadPwmFullCycle;
pwmConfig.reloadFrequency = kPWM_LoadEveryOportunity;
pwmConfig.pairOperation = kPWM_ComplementaryPwmA;
pwmConfig.enableDebugMode = false;
pwmConfig.enableWait = false;
if (PWM_Init(PWM1, kPWM_Module_2, &pwmConfig) == kStatus_Fail)
{
DEBUG_ERROR("PWM initialization failed\n");
}
pwm_signal_param_t pwmSignal[2];
timDeadTime = 10U;
pwmSignal[0].pwmChannel = kPWM_PwmA;
pwmSignal[0].level = kPWM_HighTrue;
pwmSignal[0].dutyCyclePercent = 50;
pwmSignal[0].deadtimeValue = timDeadTime;
pwmSignal[0].faultState = kPWM_PwmFaultState0;
pwmSignal[1].pwmChannel = kPWM_PwmB;
pwmSignal[1].level = kPWM_HighTrue;
pwmSignal[1].dutyCyclePercent = 50;
pwmSignal[1].deadtimeValue = timDeadTime;
pwmSignal[1].faultState = kPWM_PwmFaultState0;
pwm_fault_param_t faultConfig;
PWM_FaultDefaultConfig(&faultConfig);
faultConfig.enableCombinationalPath = false;
faultConfig.faultLevel = true;
PWM_SetupFaults(PWM1, kPWM_Fault_0, &faultConfig);
PWM_SetupFaultDisableMap(PWM1,
kPWM_Module_2,
kPWM_PwmA,
kPWM_faultchannel_0,
kPWM_FaultDisable_0);
PWM_SetupFaultDisableMap(PWM1,
kPWM_Module_2,
kPWM_PwmB,
kPWM_faultchannel_0,
kPWM_FaultDisable_0);
if (PWM_SetupPwm(PWM1,
kPWM_Module_2,
pwmSignal,
2,
kPWM_EdgeAligned,
700000U,
BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT)
!= kStatus_Success)
{
DEBUG_ERROR("PWM setup failed");
}
PWM_OutputTriggerEnable(PWM1, kPWM_Module_2, kPWM_ValueRegister_1, true);
Timer Compare Interrupt never fires so I assume something is wrong with the connection from PWM to Quad Timer.
XBARA inputs for PWM are kXBARA1_InputFlexpwm1Pwm[1-4]OutTrig01. I assume the number after PWM corresponds to the PWM submodule being used +1, as submodules are 0-3? Is there a document that properly documents what the XBAR inputs and outputs are? For example, I could not find any information on what the signal kXBARA1_InputDmaDone0 actually does and how it should be used.