24.3.5 Faults

The Fault Protection unit enables fast and deterministic action when a fault is detected. A fault trigger is an event from the Event System or generated from the software. An OR operation is performed on all the fault sources after the filters to allow multiple fault sources simultaneously.

Fault Actions

When a fault is detected, the action is taken based on the Fault Detection Action (FDACT[1:0]) bit field in the Fault Control (WEXn.FAULTCTRL) register. This will either drive all the enabled pins low or custom settings controlled by the Fault Drive (WEXn.FAULTDRV) and Fault Output (WEXn.FAULTOUT) registers.

The fault detection flag is set, and an optional interrupt is generated. The fault detection flag is set on fault independent of enabling the fault action setting.

Fault protection is independent of the CPU.

If fault mode is enabled and the T/C used as the source for the WEX is stopped, the WEX will enter a Fault state, which occurs if either the T/C is stopped before the WEX or the device enters a sleep mode where the clocks are stopped.

Fault Blanking

Fault Blanking (BLANK) provides a way to suppress fault inputs during the beginning of the active time of the waveform output. Faults can be triggered only after a configured time, preventing false fault triggering during commutation using this method. The fault blanking time is set in the Blanking Time (WEXn.BLANKTIME) register together with the Blanking Prescaler (BLANKPRESC[1:0]) bit field in the Blanking Control (WEXn.BLANKCTRL) register. The bit fields define the number of prescaled peripheral clock cycles inhibiting the fault input. The start time for blanking is selectable. For longer blanking, the feature can be controlled by software through the Command (CMD[2:0]) bit field in the Control C (WEXn.CTRLC) register. For blanking time exceeding what is supported in hardware, the BLANKSET/BLANKCLR commands can be used. The software blanking works in parallel with hardware blanking, and blanking enabled has priority.

Fault Filtering

The WEX has three event inputs for triggering a Fault condition; event inputs A, B and C controlled by the Event Control (WEXn.EVCTRLA, WEXn.EVCTRLB and WEXn.EVCTRLC) registers, respectively.

To enable the fault trigger, write a ‘1’ to the Fault Event Input (FAULTEI) bit in the Event Control (WEXn.EVCTRLx) register. The fault has an asynchronous and immediate effect on the waveform output. Enable the digital filter in the fault input to avoid false fault detection on external events (e.g., a glitch on the I/O port). In this case, the event detection and routing will be synchronous to the peripheral clock. The event action will be delayed approximately 2-3 peripheral clock cycles plus the selected digital filter coefficient.

Figure 24-7. Filter and Blanking

Fault Detection Restart Modes

Returning from the Fault state to normal operation after a fault can be done in two different modes by changing the Fault Detection Restart Mode (FDMODE) bit in the Fault Control (WEXn.FAULTCTRL) register.

  • In Latched mode, the waveform output will remain in the Fault state until the Fault condition is no longer active and the Fault state has been cleared by software. When meeting both conditions, the waveform output will return to normal operation at the following UPDATE condition.
  • In Cycle-by-Cycle mode, the waveform output will remain in the Fault state until the Fault condition is no longer active. When meeting this condition, the waveform output will return to normal operation at the following UPDATE condition.

The UPDATE condition used to restore normal operation is the same as in the timer/counter. The software UPDATE command (WEXn.CTRLC CMD[2:0]) doesn’t affect the Fault restoring.

Figure 24-8. Latched Mode Fault Handling

Figure 24-9. Cycle-By-Cycle Mode Fault Handling