SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
The final section in the fault chain is the fault action, which takes place in the DPWM module. Here is a drawing showing the main points of fault action:
This drawing fits in with the overview of the DPWM in Figure 2-1. The portion expanded here is the fault handler portion. The connection of the CLIM/CBC signal to the Timing Generation Module is also shown.
For information on the effect of CLIM/CBC in the timing module, see Section 2.16.3. The bits described in that section affect the CLIM/CBC signal which is sent to the Timing Generator. Chapter 2 also describes the Blanking Registers in the DPWM, which permit blanking of the CLIM/CBC signal to the Timing Generation module. These registers are used to prevent switching noise from causing false triggers of the CBC logic. They can also be used to synchronize CBC triggers between DPWMs with different on-times. The blanking registers affect different edges depending on topology. The effects are as follows:
CLIM/CBC is also used by the Fault Handler, which is described below. The two mechanisms are completely independent of each other, except they have the same input signal. The Blanking Registers do not affect the CLIM/CBC signal which goes to the Fault Handler.
This section will describe the logic in the fault handling portion of the DPWM.
All 4 signals, CLIM/CBC, AB,A, and B can be used as fault signals, and all are used in exactly the same way, except they shut off different DPWM signals.
As shown, there are 2 enable bits, CBC_FAULT_EN for CLIM/CBC, and ALL_FAULT_EN for the other 3. Each fault has its own 5 bit counter, with a maximum value set by a dedicated x_MAX_COUNT bit-field. The fault lines are monitored continuously, but only one event per DPWM period is counted. If the x_MAX_COUNT value is set to 0, the first fault event will shut off the appropriate DPWM pins. The maximum number of sequential fault periods is 31, if the x_MAX_COUNT field is loaded with a 0x1f.
The faults must occur sequentially. If any period completes without a fault, the counter will be reset.
The faults handler is much simpler than the CLIM/CBC in the timing generator. They simply latch off either 1 or 2 of the DPWM pins. To restart the DPWM, it is necessary to disable it using either the global enable register:
void global_enable(void)
{
//Enable DPWM0, DPWM1, DPWM2, DPWM3, FE_CTRL0 AND FE_CTRL1 simultaneously.
LoopMuxRegs.GLBEN.all = 0x30F;
}
void global_disable(void)
{
//Disable DPWM0, DPMW1, DPWM2 and DPWM3 simultaneously.
LoopMuxRegs.GLBEN.all = 0x300;
}
Or the local DPWM enable register:
Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 0;
Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 1;
The DPWMINT register can be used to configure Fault interrupts, as well as other interrupts. It can also be used to read the status of those interrupts. The interrupt bits are cleared by a read. The DPWMFLTSTAT register shows the status of the faults. These bits are also clear on read bits. See the reference section for bit mapping of these registers.
If the fault is enabled by the ALL_FAULT_EN bit, and it occurs, the FLT_A, FLT_B, FLT_AB flags will be set. If the appropriate INT_EN bit is set, the DPWM will send and interrupt to the Central Interrupt Module (CIM). If the interrupt for that DPWM is enabled in the CIM, then an interrupt will be given to the processor.