58
SiFive E300 Platform Reference Manual, Version 1.0.1
the first half of the cycle, and one 1-0 transition on the second half of the cycle.
Generating Arbitrary PWM Waveforms using Ganging
A comparator can be ganged together with its next-highest-numbered neighbor to generate arbi-
trary PWM pulses. When the
pwmcmp
X
gang
bit is set, comparator
X
fires and raises its
pwm
X
gpio
signal. When comparator
X
+ 1
(or
pwmcmp0
for
pwmcmp3
) fires, the
pwm
X
gpio
output is reset to
zero.
Generating One-shot Waveforms
The PWM peripheral can be used to generate precisely timed one-shot pulses by first initializing
the other parts of
pwmcfg
then writing a 1 to the
pwmenoneshot
bit. The counter will run for one
PWM cycle, then once a reset condition occurs, the
pwmenoneshot
bit is reset in hardware to
prevent a second cycle.
PWM Interrupts
The PWM can be configured to provide periodic counter interrupts by enabling auto-zeroing of the
count register when a comparator 0 fires (
pwmzerocmp
=1). The
pwmsticky
bit should also be set
to ensure interrupts are not forgotten while waiting to run a handler.
The interrupt pending bits
pwmcmp
X
ip
can be cleared down using writes to the
pwmcfg
register.
The PWM peripheral can also be used as a regular timer with no counter reset (
pwmzerocmp
=0),
where the comparators are now used to provide timer interrupts.
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 ...