st,stm32-comp

Vendor: STMicroelectronics

Note

An implementation of a driver matching this compatible is available in drivers/comparator/comparator_stm32_comp.c.

Description

STM32 Comparator

The following example displays the minimum node layout:

  comp1: comparator@40010200 {
    reg = <0x40010200 0x4>;
    interrupts = <64 0>;
    clocks = <&rcc STM32_CLOCK(APB2, 0)>;
    st,exti-line = <21>;
    positive-input = "IN0";
    negative-input = "VREFINT";
    status = "okay";
  };

NOTE: The shown example is for stm32g474re

Enabling the comparator node requires setting the minimum default
configuration of the comparator. This includes selecting the
positive and negative inputs, and routing them using pinctrl:

  &comp1 {
    pinctrl-0 = <&comp1_inp_pa1 &comp1_out_pa6>;
    pinctrl-names = "default";

    positive-input = "IN0";
    negative-input = "VREFINT";
    status = "okay";
  };

NOTE: Pins used above are an example for stm32g474re

Properties

Properties not inherited from the base binding file.

Name

Type

Details

invert-output

string

Output polarity selection.

Default value: NONINVERTED

Legal values: 'NONINVERTED', 'INVERTED'

st,exti-line

int

EXTI interrupt line number connected to the comparator (COMPx) event.

This property is required.

st,lock-enable

boolean

The comparator configuration can be locked to prevent any
modification until the next system reset.
Once the lock bit is set, it can be cleared only by a system reset.
This feature allows to protect the comparator configuration against
unintentional modification.

positive-input

string

Selects positive input pin provided by the pinmux controller.
IN0 corresponds to the first pinmux option, IN1 to the second one.

This property is required.

Legal values: 'IN0', 'IN1'

negative-input

string

Selects negative input. May be a package pin (IN0 / IN1) via pinctrl
or an internal signal (e.g. VREFINT, DAC).
In case of package pin assignment IN0 will correspond to first pinmux pin
option and IN1 to the second one.

This property is required.

Legal values: '1_4VREFINT', '1_2VREFINT', '3_4VREFINT', 'VREFINT', 'IN0', 'IN1'

hysteresis

string

Selects the hysteresis voltage level.
Hysteresis adds a voltage offset to the comparator threshold to prevent
unwanted output toggling when the input voltage is noisy or slowly
varying around the comparator threshold.

Default value: NONE

Legal values: 'NONE', 'LOW', 'MEDIUM', 'HIGH'

st,blank-sel

string

Blanking source to mask short spikes at PWM period start.
Ref (example): STM32G4 RM0440 Rev 8, 24.3.6.

Default value: NONE

Legal values: 'NONE'

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.