29
pwmcmp1ip
RW
X
PWM1 Interrupt Pending
30
pwmcmp2ip
RW
X
PWM2 Interrupt Pending
31
pwmcmp3ip
RW
X
PWM3 Interrupt Pending
The
pwmcfg
register contains various control and status information regarding the PWM periph-
eral, as shown in Table 90.
The
pwmen*
bits control the conditions under which the PWM counter
pwmcount
is incremented.
The counter increments by one each cycle only if any of the enabled conditions are true.
If the
pwmenalways
bit is set, the PWM counter increments continuously. When
pwmenoneshot
is set, the counter can increment but
pwmenoneshot
is reset to zero once the counter resets,
disabling further counting (unless
pwmenalways
is set). The
pwmenoneshot
bit provides a way
for software to generate a single PWM cycle then stop. Software can set the
pwmenoneshot
again at any time to replay the one-shot waveform. The
pwmen*
bits are reset at wakeup reset,
which disables the PWM counter and saves power.
The 4-bit
pwmscale
field scales the PWM counter value before feeding it to the PWM compara-
tors. The value in
pwmscale
is the bit position within the
pwmcount
register of the start of a
cmpwidth
-bit
pwms
field. A value of 0 in
pwmscale
indicates no scaling, and
pwms
would then be
equal to the low
cmpwidth
bits of
pwmcount
. The maximum value of 15 in
pwmscale
corre-
sponds to dividing the clock rate by 2
15
, so for an input bus clock of 16 MHz, the LSB of
pwms
will increment at 488.3 Hz.
The
pwmzerocmp
bit, if set, causes the PWM counter
pwmcount
to be automatically reset to zero
one cycle after the
pwms
counter value matches the compare value in
pwmcmp0
. This is normally
used to set the period of the PWM cycle. This feature can also be used to implement periodic
counter interrupts, where the period is independent of interrupt service time.
The Scaled PWM Count Register
pwms
reports the
cmpwidth
-bit portion of
pwmcount
which
starts at
pwmscale
, and is what is used for comparison against the
pwmcmp
registers.
Scaled PWM Count Register (
pwms
)
Register Offset
0x10
Bits
Field Name
Attr.
Rst.
Description
[15:0]
pwms
RW
X
Scaled PWM count register.
cmpwidth
bits wide.
Table 90:
PWM Configuration Register
Table 91:
Scaled PWM Count Register
Chapter 19 Pulse Width Modulator (PWM)
FE310-G003 Manual
© SiFive, Inc.
Page 103
Содержание FE310-G003
Страница 1: ...SiFive FE310 G003 Manual v1p1 SiFive Inc ...