Hello,
I am working with 8 PWM channels and each has an independent fault flag (they each have to independently handle faults, low indicates a fault). I am trying to set up a fault handler that will latch the respective channel when a fault is present (the fault flag triggers). I need the channel to latch and then be handled in an ISR per the scope of their use. However, with my setup, I am not getting the fault to trigger a jump to the Fault ISR. I am wondering if I initialized the channels incorrectly (see below) for my task. Another question I have, once I get the fault flags to trigger a jump to ISR, how do I know which base/generator saw the fault? Each channel is on a unique base/generator so that they will not be affected by faults on other channels.
ROM_GPIOPinConfigure(GPIO_PH0_M0PWM0);
ROM_GPIOPinTypePWM (GPIO_PORTH_BASE, GPIO_PIN_0);
ROM_PWMGenEnable(PWM0_BASE, PWM_GEN_0);
ROM_GPIOPinConfigure(GPIO_PK4_M0FAULT0);
ROM_PWMGenConfigure(PWM0_BASE, PWM_GEN_0, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC | PWM_GEN_MODE_FAULT_EXT |
PWM_GEN_MODE_FAULT_LATCHED | PWM_GEN_MODE_FAULT_NO_MINPER | PWM_GEN_MODE_DBG_STOP));
ROM_PWMGenFaultTriggerSet(PWM0_BASE, PWM_GEN_0, PWM_FAULT_GROUP_0, PWM_FAULT_FAULT0);
ROM_PWMOutputFault(PWM0_BASE, PWM_OUT_0_BIT, TRUE);
ROM_PWMOutputFaultLevel(PWM0_BASE, PWM_OUT_0_BIT, FALSE);
ROM_PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, TRUE);
TPWM_StatusEnabledSet(HAL_PWM09, TRUE);
ROM_PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO);
ROM_PWMIntEnable(PWM0_BASE, PWM_INT_GEN_0);
Thank you.