English
Language : 

LM3S2276 Datasheet, PDF (662/785 Pages) Texas Instruments – Stellaris® LM3S2276 Microcontroller
Pulse Width Modulator (PWM)
17.3.8
17.4
The PWM unit can use the following inputs to generate a fault condition, including:
■ FAULTn pin assertion
■ A stall of the controller generated by the debugger
Fault conditions are calculated on a per-PWM generator basis. Each PWM generator configures
the necessary conditions to indicate a fault condition exists. This method allows the development
of applications with dependent and independent control.
Each PWM generator's mode control, including fault condition handling, is provided in the PWMnCTL
register. This register determines whether a single FAULT0 input is used (as previous Stellaris
products support) or whether all FAULTn input signals may be used to generate a fault condition.
This register allows the fault condition duration to last as long as the external condition lasts, or it
may specify that the external condition be latched and the fault condition (and its effects) last until
cleared by software. Finally, this register also enables a counter that may be used to extend the
period of a fault condition for external events to assure that the duration is a minimum length. The
minimum fault period count is specified in the PWMnMINFLTPER register.
These PWM generator registers provide status, control, and configure the fault condition in each
PWM generator: PWMnFLTSRC0, PWMnFLTSTAT0, and PWMnFLTSEN.
There are up to four FAULT input pins (FAULT0-FAULT3). These pins may be used with circuits that
generate an active High or active Low signal to indicate an error condition. Each of the FAULTn pins
may be individually programmed for this logic sense using the PWMnFLTSEN register.
The PWMnFLTSRC0 register define the contribution of the external fault sources. Using these
registers, individual or groups of FAULTn signals are ORed together to specify the external fault
generating conditions.
Status regarding the specific fault cause is provided in PWMnFLTSTAT0.
PWM generator fault conditions may be promoted to a controller interrupt using the PWMINTEN
register.
During fault conditions, the PWM output signals usually require being driven to safe values so that
external equipment may be safely controlled. To facilitate this, the PWMFAULT register is used to
determine if the generated signal continues to be passed driven, or a specific fault condition encoding
is driven on the PWM output, as specified in the PWMFAULTVAL register.
Output Control Block
With each PWM generator block producing two raw PWM signals, the output control block takes
care of the final conditioning of the PWM signals before they go to the pins. Via a single register,
the set of PWM signals that are actually enabled to the pins can be modified; this can be used, for
example, to perform commutation of a brushless DC motor with a single register write (and without
modifying the individual PWM generators, which are modified by the feedback control loop). Similarly,
fault control can disable any of the PWM signals as well. A final inversion can be applied to any of
the PWM signals, making them active Low instead of the default active High.
Initialization and Configuration
The following example shows how to initialize the PWM Generator 0 with a 25-KHz frequency, and
with a 25% duty cycle on the PWM0 pin and a 75% duty cycle on the PWM1 pin. This example assumes
the system clock is 20 MHz.
662
November 17, 2011
Texas Instruments-Production Data