This is the documentation for the latest (main) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

pwm-clock

Vendor: Generic or vendor-independent

Description

An external clock signal driven by a PWM pin.

The devicetree must define a clock node:

pwmclock: pwmclock {
    status = "okay";
    compatible = "pwm-clock";
    #clock-cells = <1>;
    pwms = <&pwm_ccu40 2 PWM_HZ(1000000) PWM_POLARITY_NORMAL>;
};

This will create a device node with a clock-controller
API. Internally the device node will use PWM API to start the
clock signals at 1MHz. Note that the PWM_HZ() macro converts the
frequency to time (nanoseconds units). This may result in rounding
errors if the clock frequency is not an integer number of nanoseconds.
The clock frequency can be explicitly set using the clock-frequency
property.

The PWM node may need to be properly configured to generate
the target period (i.e. using prescaler options). See the documentation
for the target PWM driver.

Properties

Properties not inherited from the base binding file.

Name

Type

Details

#clock-cells

int

Number of items to expect in a Clock specifier

This property is required.

Constant value: 1

pwms

phandle-array

This property is required.

clock-frequency

int

Exact output frequency, in case the PWM period is not exact
but was rounded to nanoseconds. This property is optional.

pwm-on-delay

int

Optional blocking delay in micro seconds to make sure that the PWM clock has started after returning from clock_control_on().

Specifier cell names

  • clock cells: id