Skip to content

Commit 942ab60

Browse files
dts: bindings: comparator
add comparator DTS description Signed-off-by: Alexander Kozhinov <[email protected]>
1 parent 9354e06 commit 942ab60

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Copyright (c) 2025 Alexander Kozhinov <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: |
5+
STM32 Comparator
6+
7+
The following example displays the minimum node layout:
8+
9+
comp1: comparator@deadbeef {
10+
compatible = "st,stm32-comp";
11+
positive-input = "IN0";
12+
negative-input = "VREFINT";
13+
status = "disabled";
14+
};
15+
16+
Enabling the comparator node requires setting the minimum default
17+
configuration of the comparator. This includes selecting the
18+
positive and negative inputs, and routing them using pinctrl:
19+
20+
&pinctrl {
21+
comp1_default: comp1_default {
22+
...
23+
};
24+
};
25+
26+
&comp1 {
27+
status = "okay";
28+
pinctrl-0 = <&comp1_default>;
29+
pinctrl-names = "default";
30+
31+
positive-input = "IN0";
32+
negative-input = "VREFINT";
33+
};
34+
35+
compatible: "st,stm32-comp"
36+
37+
include:
38+
- base.yaml
39+
- pinctrl-device.yaml
40+
41+
properties:
42+
interrupts:
43+
required: true
44+
45+
reg:
46+
required: true
47+
48+
hysteresis:
49+
type: string
50+
description: |
51+
Selects the hysteresis voltage level.
52+
Hysteresis adds a voltage offset to the comparator threshold to prevent
53+
unwanted output toggling when the input voltage is noisy or slowly
54+
varying around the comparator threshold.
55+
56+
invert-output:
57+
type: string
58+
enum:
59+
- NONINVERTED
60+
- INVERTED
61+
default: NONINVERTED
62+
63+
st,exti-line:
64+
required: true
65+
type: int
66+
description: |
67+
Extended Interrupts and Event Controller (EXTI) interrupt
68+
line number connected to the COMPx event.
69+
70+
st,lock-enable:
71+
type: boolean
72+
73+
st,blank-sel:
74+
type: string
75+
description: |
76+
The purpose of the blanking function is to prevent the current regulation
77+
from tripping upon short current spikes at the beginning of PWM period
78+
(typically the recovery current in power switch anti-parallel diodes).
79+
This goes through setting a dead window defined with a timer output
80+
compare signal. The blanking source is selected individually per
81+
comparator channel. The inverted blanking signal is logical AND-ed with
82+
the comparator stage output to produce the comparator channel x output.
83+
source: STM32G4 Reference Manual (RM0440 Rev 8, page 768, chapter 24.3.6)
84+
85+
positive-input:
86+
required: true
87+
type: string
88+
description: |
89+
Selects positive input pin given by pinmux controller. This input can be
90+
typically assigned to one of the predefinded package pins.
91+
IN0 will correspond to first pinmux pin option and IN1 to the second one.
92+
enum:
93+
- IN0
94+
- IN1
95+
default: IN0
96+
97+
negative-input:
98+
required: true
99+
type: string
100+
description: |
101+
Selects negative input pin given by pinmux controller.
102+
This input can be typically assigned to one of the predefinded package pins
103+
or to one of internal signals like VREF_INT or DAC.
104+
In case of package pin assignment IN0 will correspond to first pinmux pin
105+
option and IN1 to the second one.
106+
107+
st,miller-effect-hold-enable:
108+
type: boolean
109+
description: |
110+
Miller effect is a hidden feature of stm32, which may be enabled by setting
111+
bit 1 of COMP_CxCSR register.
112+
for more info see:
113+
https://community.st.com/t5/stm32-mcus-products/stm32g431-comparator-bug/m-p/679540#M250779
114+
115+
st,power-mode:
116+
type: string
117+
description: |
118+
Power mode is not supported by all stm32 series.

0 commit comments

Comments
 (0)