PWM Implementation
8-4 ADSP-21368 SHARC Processor Hardware Reference
Center-aligned, paired mode. Generates complementary signals on two
outputs.
Center-aligned, non-paired mode. Generates complementary signals on
independent signals.
In paired mode, the two’s-complement integer value in the 16-bit
read/write duty cycle registers, (
PWMAx and PWMBx), control the duty cycles
of the four PWM output signals on the pwm_a, pwm_ah, pwm_bl, and pwm_bh
respectively. The duty cycle registers are programmed in two’s-comple-
ment integer counts of the fundamental time unit, tPCLK (the peripheral
clock of the ADSP-21367/8/9 and ADSP-2137x processors) and define
the desired on-time of the high-side PWM signal over half the PWM
period. The duty cycle register range is from
(–PWMPERIOD ÷ 2 – PWMDT) to (+PWMPERIOD ÷ 2 + PWMDT),
which, by definition, is scaled such that a value of 0 represents a 50%
PWM duty cycle.
Each group in the PWM module (0–3) has its own set of registers which
control the operation of that group. The operating mode of the PWM
block (single or double-update mode) is selected by the PWM_UPDATE bit
(bit 2) in the PWM control (PWMCTRL3–0) registers. Status information
about each individual PWM group is available to the program in the
PWM status (PWMSTAT3–0) registers. Apart from the local control and sta-
tus registers for each PWM group, there is a single PWM global control
register (PWMGCTL) and a single PWM global status register (PWMGSTAT).
The global control register allows programs to enable or disable the four
groups in any combination, which provides synchronization across the
four PWM groups. The global status register shows the period completion
status of each group.
On period completion, the corresponding bit in the
PWMGSTAT register is
set and remains sticky. In the interrupt service routine (ISR), the program
should first read the global status register and clear all the intended bits by
explicitly writing 1. This also clears the PWM_INT bit. Interrupts from indi-
vidual groups can be disabled by the
PWM_IRQEN bit in the local PWMCTRLx