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.

TM4C PWM Fault Handling

I am using the motion controller PWM fault capabilities on my TM4C processor. As demonstrated below, I have set up an external fault pin to trigger the fault on the MxFaultn pin. This pin will go low when a fault is present. I then want to processor to latch the generator pwm pin low until the Fault Clear function has been called). I am stuck on where I should nest the ROM_PWMGenFaultClear function call to ensure the fault latch is cleared. Is there an ISR that my processor enters when a fault is triggered?

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_DBG_STOP));

ROM_PWMGenFaultConfigure(PWM0_BASE, PWM_GEN_0, 100, PWM_FAULT0_SENSE_LOW);

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);

 

 

  • Hello KM01,

    When the fault occurs, you would want to take an action to clear the fault condition first. It would be in an Interrupt where you can set the Fault condition as a interrupt source. Till the Fault condition has not cleared you would want the PWM to be driven low hence a latch would not be advised since clearing the interrupt source would cause internal fault condition to be cleared and PWM to be resumed.

    Regards
    Amit
  • Amit Ashara said:
    When the fault occurs, you would want to take an action to clear the fault condition first

    Hi Amit,

    Good that.   Earlier post here I advised poster to employ, parameter, "PWM_GEN_MODE_FAULT_MINPER" w/in the call to "PWMGenConfigure()."

    Then - he may "fine tune" the response to the fault via, "PWMGenFaultConfigure()'s 3rd parameter.   (i.e. the duration of the PWM output being extinguished is variable and controllable.)

    Beauty of the method I've described - the faults are often transient - and "Self-Clearing!"  And - we need not worry about a PWM-Fault interrupt - if the fault remains long enough we "shut-down" our system.  No PWM Fault interrupt is required.   (recall KISS - always)

    We use this exact method to develop, "Cycle by Cycle" current limiting - a safe and robust technique - which is enhanced by the Analog Comparator resident w/in our LX4F (and your newer devices - as well...)

  • cb1-

    I am slowly starting to understand the information you were providing me. I want to clarify, since I didn't get it the first time:

    If I use the minimum fault period, then when a fault triggers the controller, it will hold the in the faulting scheme until the minimum period declared as parameter in the PWMGenFaultConfigure() has passed. Then once this period of time is up, the controller will return to normal function (provided the fault has cleared during this time period). The initialization of the fault will still use the PWMOutputFault configuration call so that the controller knows to latch the PWM output low when a fault is observed.

    And to Amit's reply, if I don't include the minimum period declaration, then I would have to set up an ISR to clear the fault.

    Both methods should have the same configuration/initialization, except for the parameter "PWM_GEN_MODE_FAULT_MINPER" within the PWMGenConfigure().

    Am I understanding this correctly?
  • Hello KM01

    Yes, that is correct.

    Regards
    Amit
  • KM01 said:
    Both methods should have the same configuration/initialization ... Am I understanding this correctly? 

    May I (slightly) differ w/Amit?   I don't believe your understanding is complete - yet.

    Is the function, "PWMGenFaultConfigure()" used and/or treated the same via Fault_Latch vs. (my much preferred) "PWM_GEN_MODE_FAULT_MINPER()"?  (you'll have to review the peripheral driver library for that detail - it's been years since my firm employed w/our LX4F MCU...)

    PWM_GEN_MODE_FAULT_MINPER() - as past stated - requires parameter #3 to specify the duration of the, "Fault, PWM hold-off period."  That's not appropriate for the broader (more brutal) - Fault Latch technique - if memory serves.

    You made excellent note of the "automatic nature" of this "MINPER()" function - in that a transient fault will "kill" PWM for the duration specified - and then either "re-trigger" or re-launch PWM if - "all is clear!"  

    With the exception I've noted herein - and that fact added to your para 2 - I then believe your understanding proves correct.