3.9.30. pwm - pwm Usage

pwm [-ldDPfwisv] Synopsis

Sets pwm device parameters, or shows current value. Specify the pwm device by device name. If no other parameters are given, or if args has ‘-v’, then show the current values only. Timings can either be specified via period + duty (on) duration, or via frequency. Duty can be given either as a percentage or time. If a parameter is not specified, the current value will be used where possible. To set an output to inactive state, set the duty to 0. (although note this will not by itself stop the pwm running.) Stopping the pwm device does not necessarily set the output to inactive, but stop is handled last, so can be done in addition to other changes. Options


list registered PWMs

-d <name>

device name (eg ‘pwm0’)

-D <duty_ns>

duty cycle (ns)

-P <period_ns>

period (ns)

-f <freq_hz>

frequency (Hz)

-w <duty_%>

duty cycle (%) - the on ‘width’ of each cycle


line inverted polarity


stop (disable) the pwm device


print current values