56
SiFive E300 Platform Reference Manual, Version 1.0.1
every cycle. The output of each comparator is high whenever the value of
pwms
is greater than or
equal to the corresponding
pwmcmp
X
.
If the
pwmzerocomp
bit is set, when
pwms
reaches or exceeds
pwmcmp0
,
pwmcount
is cleared to zero
and the current PWM cycle is completed. Otherwise, the counter is allowed to wrap around.
Deglitch and Sticky circuitry
To avoid glitches in the PWM waveforms when changing
pwmcmp
X
register values, the
pwmdeglitch
bit in
pwmcfg
can be set to capture any high output of a PWM comparator in a sticky
bit (
pwmcmp
X
ip
for comparator
X
) and prevent the output falling again within the same PWM cycle.
The
pwmcmp
X
ip
bits are only allowed to change at the start of the next PWM cycle.
Note the
pwmcmp0ip
bit will only be high for one cycle when
pwmdeglitch
and
pwmzerocmp
are
set where
pwmcmp0
is used to define the PWM cycle, but can be used as a regular PWM edge
otherwise.
If
pwmdeglitch
is set, but
pwmzerocmp
is clear, the deglitch circuit is still operational but is now trig-
gered when
pwms
contains all 1s and will cause a carry out of the high bit of the
pwms
incrementer
just before the counter wraps to zero.
The
pwmsticky
bit will disallow the
pwmcmp
X
ip
registers from clearing if they’re already set, and is
used to ensure interrupts are seen from the
pwmcmp
X
ip
bits.
Generating Left- or Right-Aligned PWM Waveforms
pwms
0
1
2
3
4
5
6
0
1
2
3
4
5
6
0
1
pwmcmpX=3
pwmcmpX=1
pwmcmpX=0
pwmcmpX=2
pwmcmpX=4
pwmcmpX=5
pwmcmpX=6
pwmcmpX=7
PWM Cycle
Figure 15.4: E300 basic right-aligned PWM waveforms. All possible base waveforms are shown
for a 7-clock PWM cycle (
pwmcmp0
=6). The waveforms show the single cycle delay caused by
registering the comparator outputs in the
pwmcmp
X
ip
bits. The signals can be inverted at the
GPIOs to generate left-aligned waveforms.
Figure 15.4 shows the generation of various base PWM waveforms. The Figure illustrates that if
pwmcmp0
is set to less than the maximum count value (6 in this case), it is possible to generate
Summary of Contents for E300
Page 1: ...SiFive E300 Platform Reference Manual Version 1 0 1 c SiFive Inc ...
Page 2: ...2 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 4: ...ii SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 12: ...4 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 14: ...6 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 22: ...14 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 32: ...24 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 40: ...32 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 56: ...48 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 60: ...52 SiFive E300 Platform Reference Manual Version 1 0 1 ...