espressif,esp32-sdm

Description

Espressif Sigma-Delta Modulator (SDM)

Sigma-delta modulator. Each channel outputs a pulse-density stream on one
GPIO. Route the channel with pinctrl: SDM_CHn selects channel n, and the
child node's reg value must use that same index.

The driver divides the SDM source clock by an integer prescaler from 1 to
256, computed once at init as the source rate divided by sample-rate-hz,
rounded down. The source is APB on ESP32, ESP32-S2, ESP32-S3 and ESP32-C3.
On ESP32-C5, ESP32-C6, ESP32-H2 and ESP32-P4 it is the IO MUX function
clock selected at init, which is XTAL after reset. Density is changed at
run time with esp32_sdm_set_pulse_density().

Prescale and pulse density do not survive peripheral power-down, including
light sleep on SoCs that power down peripherals. The driver programs the
prescaler only at init and has no call to restore it. Avoid peripheral
power-down when the sample rate must be kept.

Examples

&pinctrl {
  sdm0_default: sdm0_default {
    group1 {
      pinmux = <SDM_CH0_GPIO4>;
      output-enable;
    };
  };
};

&sdm0 {
  pinctrl-0 = <&sdm0_default>;
  pinctrl-names = "default";
  status = "okay";

  channel0@0 {
    reg = <0>;
    sample-rate-hz = <1000000>;
  };
};

Properties

Top level properties

These property descriptions apply to “espressif,esp32-sdm” nodes themselves. This page also describes child node properties in the following sections.

Properties not inherited from the base binding file.

Name

Type

Details

pinctrl-0

phandles

Pin configuration/s for the first state. Content is specific to the
selected pin controller driver implementation.

pinctrl-1

phandles

Pin configuration/s for the second state. See pinctrl-0.

pinctrl-2

phandles

Pin configuration/s for the third state. See pinctrl-0.

pinctrl-3

phandles

Pin configuration/s for the fourth state. See pinctrl-0.

pinctrl-4

phandles

Pin configuration/s for the fifth state. See pinctrl-0.

pinctrl-names

string-array

Names for the provided states. The number of names needs to match the
number of states.

Child node properties

Name

Type

Details

reg

int

Channel index. It must match the SDM_CHn signal used in pinctrl.
ESP32, ESP32-S2, ESP32-S3 and ESP32-P4 have channels 0 through 7.
ESP32-C3, ESP32-C5, ESP32-C6 and ESP32-H2 have channels 0 through 3.

This property is required.

Legal values: 0, 1, 2, 3, 4, 5, 6, 7

See Important properties for more information.

sample-rate-hz

int

Target sample rate, in Hz. The hardware prescaler is the integer
ratio of the SDM source clock to this rate and must fall in the
range 1 to 256.

This property is required.