STMicroelectronics STM32 ADC
Schema identifier ($id): "http://devicetree.org/schemas/iio/adc/st,stm32-adc.yaml#"
Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"
STM32 ADC is a successive approximation analog-to-digital converter. It has several multiplexed input channels. Conversions can be performed in single, continuous, scan or discontinuous mode. Result of the ADC is stored in a left-aligned or right-aligned 32-bit data register. Conversions can be launched in software or using hardware triggers.
The analog watchdog feature allows the application to detect if the input voltage goes beyond the user-defined, higher or lower thresholds.
Each STM32 ADC block can have up to 3 ADC instances.
Maintainers (maintainers): "Fabrice Gasnier <fabrice.gasnier@foss.st.com>"
Properties and child nodes (properties) #
compatible — required here #
Allowed values (enum): "st,stm32f4-adc-core", "st,stm32h7-adc-core", "st,stm32mp1-adc-core", "st,stm32mp13-adc-core"
reg — required here #
Maximum number of items (maxItems): 1
interrupts — required here #
One or more interrupts for ADC block, depending on part used:
- stm32f4 and stm32h7 share a common ADC interrupt line.
- stm32mp1 has two separate interrupt lines, one for each ADC within
ADC block.
- stm32mp13 has an interrupt line per ADC block.
Minimum number of items (minItems): 1
Maximum number of items (maxItems): 2
clocks — required here #
Minimum number of items (minItems): 1
Maximum number of items (maxItems): 2
Core can use up to two clocks, depending on part used:
- "adc" clock: for the analog circuitry, common to all ADCs.
It's required on stm32f4.
It's optional on stm32h7 and stm32mp1.
- "bus" clock: for registers access, common to all ADCs.
It's not present on stm32f4.
It's required on stm32h7 and stm32mp1.
clock-names — required here #
Minimum number of items (minItems): 1
Maximum number of items (maxItems): 2
st,max-clk-rate-hz — not listed as required here #
Allow to specify desired max clock rate used by analog circuitry.
vdda-supply — required here #
Phandle to the vdda input analog voltage.
vref-supply — required here #
Phandle to the vref input analog reference voltage.
booster-supply — not listed as required here #
Phandle to the embedded booster regulator that can be used to supply ADC analog input switches on stm32h7 and stm32mp1.
vdd-supply — not listed as required here #
Phandle to the vdd input voltage. It can be used to supply ADC analog input switches on stm32mp1.
st,syscfg — not listed as required here #
Phandle to system configuration controller. It can be used to control the analog circuitry on stm32mp1.
Shared schema rule ($ref): /schemas/types.yaml#/definitions/phandle-array
interrupt-controller — required here #
true — No constraints added by this property rule.
#interrupt-cells — required here #
Exact value (const): 1
#address-cells — required here #
Exact value (const): 1
#size-cells — required here #
Exact value (const): 0
access-controllers — not listed as required here #
Minimum number of items (minItems): 1
Maximum number of items (maxItems): 2
All of these rules must match (allOf) #
Rule 1 #
Condition (
if) #Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)Exact value (
const):"st,stm32f4-adc-core"When the condition matches (
then) #Properties and child nodes (
properties)
clocks— not listed as required hereMaximum number of items (
maxItems):1
clock-names— not listed as required hereExact value (
const):"adc"
interrupts— not listed as required hereArray item rules (
items)Item 1
interrupt line common for all ADCs
st,max-clk-rate-hz— not listed as required hereMinimum value (
minimum):600000Maximum value (
maximum):36000000Default value (
default):36000000
booster-supply— not listed as required here
false— Not permitted by this property rule.
vdd-supply— not listed as required here
false— Not permitted by this property rule.
st,syscfg— not listed as required here
false— Not permitted by this property rule.
Rule 2 #
Condition (
if) #Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)Exact value (
const):"st,stm32h7-adc-core"When the condition matches (
then) #Properties and child nodes (
properties)
clocks— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):2
clock-names— not listed as required hereArray item rules (
items)Item 1
Exact value (
const):"bus"Item 2
Exact value (
const):"adc"Minimum number of items (
minItems):1
interrupts— not listed as required hereArray item rules (
items)Item 1
interrupt line common for all ADCs
st,max-clk-rate-hz— not listed as required hereMinimum value (
minimum):120000Maximum value (
maximum):36000000Default value (
default):36000000
vdd-supply— not listed as required here
false— Not permitted by this property rule.
st,syscfg— not listed as required here
false— Not permitted by this property rule.
Rule 3 #
Condition (
if) #Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)Exact value (
const):"st,stm32mp1-adc-core"When the condition matches (
then) #Properties and child nodes (
properties)
clocks— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):2
clock-names— not listed as required hereArray item rules (
items)Item 1
Exact value (
const):"bus"Item 2
Exact value (
const):"adc"Minimum number of items (
minItems):1
interrupts— not listed as required hereArray item rules (
items)Item 1
interrupt line for ADC1
Item 2
interrupt line for ADC2
st,max-clk-rate-hz— not listed as required hereMinimum value (
minimum):120000Maximum value (
maximum):36000000Default value (
default):36000000
Rule 4 #
Condition (
if) #Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)Exact value (
const):"st,stm32mp13-adc-core"When the condition matches (
then) #Properties and child nodes (
properties)
clocks— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):2
clock-names— not listed as required hereArray item rules (
items)Item 1
Exact value (
const):"bus"Item 2
Exact value (
const):"adc"Minimum number of items (
minItems):1
interrupts— not listed as required hereArray item rules (
items)Item 1
ADC interrupt line
st,max-clk-rate-hz— not listed as required hereMinimum value (
minimum):150000Maximum value (
maximum):75000000Default value (
default):75000000
Properties not matched by properties or patternProperties in this schema (additionalProperties) #
false
Not allowed by this rule.
Required in this object (required): "compatible", "reg", "interrupts", "clocks", "clock-names", "vdda-supply", "vref-supply", "interrupt-controller", "#interrupt-cells", "#address-cells", "#size-cells"
Properties matching a name pattern (patternProperties) #
^adc@[0-9]+$ — name matches this regular expression #
Value type (type): "object"
An ADC block node should contain at least one subnode, representing an ADC instance available on the machine.
Properties and child nodes (properties) #
compatible — required here
Allowed values (enum): "st,stm32f4-adc", "st,stm32h7-adc", "st,stm32mp1-adc", "st,stm32mp13-adc"
reg — required here
Offset of ADC instance in ADC block. Valid values are:
- 0x0: ADC1
- 0x100: ADC2
- 0x200: ADC3 (stm32f4 only)
Maximum number of items (maxItems): 1
#io-channel-cells — required here
Exact value (const): 1
#address-cells — not listed as required here
Exact value (const): 1
#size-cells — not listed as required here
Exact value (const): 0
interrupts — required here
IRQ Line for the ADC instance. Valid values are:
- 0 for adc@0 (single adc for stm32mp13)
- 1 for adc@100
- 2 for adc@200 (stm32f4 only)
Maximum number of items (maxItems): 1
clocks — not listed as required here
Input clock private to this ADC instance. It's required only on stm32f4, that has per instance clock input for registers access.
Maximum number of items (maxItems): 1
dmas — not listed as required here
RX DMA Channel
Maximum number of items (maxItems): 1
dma-names — not listed as required here
Exact value (const): "rx"
assigned-resolution-bits — not listed as required here
Resolution (bits) to use for conversions:
- can be 6, 8, 10 or 12 on stm32f4 and stm32mp13
- can be 8, 10, 12, 14 or 16 on stm32h7 and stm32mp1
st,adc-channels — not listed as required here
List of single-ended channels muxed for this ADC. It can have up to:
- 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
- 19 channels, numbered from 0 to 18 (for in0..in18) on stm32mp13.
- 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
stm32mp1.
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32-array
Deprecated (deprecated): true
st,adc-diff-channels — not listed as required here
List of differential channels muxed for this ADC. Some channels can be configured as differential instead of single-ended on stm32h7 and on stm32mp1. Positive and negative inputs pairs are listed: <vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is required if no adc generic channel is defined. These legacy channel properties are exclusive with adc generic channel bindings. Both properties can be used together. Some channels can be used as single-ended and some other ones as differential (mixed). But channels can't be configured both as single-ended and differential.
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32-matrix
Array item rules (items)
Array item rules (
items)Item 1
"vinp" indicates positive input number
Minimum value (
minimum):0Maximum value (
maximum):19Item 2
"vinn" indicates negative input number
Minimum value (
minimum):0Maximum value (
maximum):19
Deprecated (deprecated): true
st,min-sample-time-nsecs — not listed as required here
Minimum sampling time in nanoseconds. Depending on hardware (board) e.g. high/low analog input source impedance, fine tune of ADC sampling time may be recommended. This can be either one value or an array that matches "st,adc-channels" and/or "st,adc-diff-channels" list, to set sample time resp. for all channels, or independently for each channel.
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32-array
Deprecated (deprecated): true
nvmem-cells — not listed as required here
Array item rules (items)
Item 1
Phandle to the calibration vrefint data provided by otp
nvmem-cell-names — not listed as required here
Array item rules (items)
Item 1
Exact value (
const):"vrefint"
Properties matching a name pattern (patternProperties) #
^channel@([0-9]|1[0-9])$ — name matches this regular expression
Value type (type): "object"
Shared schema rule ($ref): adc.yaml
Represents the external channels which are connected to the ADC.
Properties and child nodes (properties)
reg — required here
Array item rules (items)
Minimum value (
minimum):0Maximum value (
maximum):19
label — not listed as required here
Unique name to identify which channel this is. Reserved label names "vddcore", "vddcpu", "vddq_ddr", "vrefint" and "vbat" are used to identify internal channels with matching names.
diff-channels — not listed as required here
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32-array
Array item rules (items)
Minimum value (
minimum):0Maximum value (
maximum):19
st,min-sample-time-ns — not listed as required here
Minimum sampling time in nanoseconds. Depending on hardware (board) e.g. high/low analog input source impedance, fine tune of ADC sampling time may be recommended.
Required in this object (required): "reg"
Properties not matched by properties or patternProperties in this schema (additionalProperties)
false
Not allowed by this rule.
All of these rules must match (allOf) #
Rule 1
Condition (
if)Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)Exact value (
const):"st,stm32f4-adc"When the condition matches (
then)Properties and child nodes (
properties)
reg— not listed as required hereAllowed values (
enum):0,256,512
interrupts— not listed as required hereMinimum value (
minimum):0Maximum value (
maximum):2
assigned-resolution-bits— not listed as required hereAllowed values (
enum):6,8,10,12Default value (
default):12
st,adc-channels— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):16Array item rules (
items)Minimum value (
minimum):0Maximum value (
maximum):15
st,adc-diff-channels— not listed as required here
false— Not permitted by this property rule.
st,min-sample-time-nsecs— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):16Array item rules (
items)Minimum value (
minimum):80
Rule 2
Condition (
if)Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)When the condition matches (
then)Properties and child nodes (
properties)
reg— not listed as required here
interrupts— not listed as required hereMinimum value (
minimum):0Maximum value (
maximum):1
assigned-resolution-bits— not listed as required hereAllowed values (
enum):8,10,12,14,16Default value (
default):16
st,adc-channels— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):20Array item rules (
items)Minimum value (
minimum):0Maximum value (
maximum):19
st,min-sample-time-nsecs— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):20Array item rules (
items)Minimum value (
minimum):40
Rule 3
Condition (
if)Properties and child nodes (
properties)
compatible— not listed as required hereRule for matching array elements (
contains)Exact value (
const):"st,stm32mp13-adc"When the condition matches (
then)Properties and child nodes (
properties)
reg— not listed as required hereExact value (
const):0
interrupts— not listed as required hereExact value (
const):0
assigned-resolution-bits— not listed as required hereAllowed values (
enum):6,8,10,12Default value (
default):12
st,adc-channels— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):19Array item rules (
items)Minimum value (
minimum):0Maximum value (
maximum):18
st,min-sample-time-nsecs— not listed as required hereMinimum number of items (
minItems):1Maximum number of items (
maxItems):19Array item rules (
items)Minimum value (
minimum):40
Properties not matched by properties or patternProperties in this schema (additionalProperties) #
false
Not allowed by this rule.
Required in this object (required): "compatible", "reg", "interrupts", "#io-channel-cells"
Examples (examples) #
// Example 1: with stm32f429, ADC1, single-ended channel 8
adc123: adc@40012000 {
compatible = "st,stm32f4-adc-core";
reg = <0x40012000 0x400>;
interrupts = <18>;
clocks = <&rcc 0 168>;
clock-names = "adc";
st,max-clk-rate-hz = <36000000>;
vdda-supply = <&vdda>;
vref-supply = <&vref>;
interrupt-controller;
#interrupt-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
adc@0 {
compatible = "st,stm32f4-adc";
#io-channel-cells = <1>;
reg = <0x0>;
clocks = <&rcc 0 168>;
interrupt-parent = <&adc123>;
interrupts = <0>;
st,adc-channels = <8>;
dmas = <&dma2 0 0 0x400 0x0>;
dma-names = "rx";
assigned-resolution-bits = <8>;
};
// ...
// other adc child nodes follow...
};
// Example 2: with stm32mp157c to setup ADC1 with:
// - channels 0 & 1 as single-ended
// - channels 2 & 3 as differential (with resp. 6 & 7 negative inputs)
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
adc12: adc@48003000 {
compatible = "st,stm32mp1-adc-core";
reg = <0x48003000 0x400>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc ADC12>, <&rcc ADC12_K>;
clock-names = "bus", "adc";
booster-supply = <&booster>;
vdd-supply = <&vdd>;
vdda-supply = <&vdda>;
vref-supply = <&vref>;
st,syscfg = <&syscfg>;
interrupt-controller;
#interrupt-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
adc@0 {
compatible = "st,stm32mp1-adc";
#io-channel-cells = <1>;
reg = <0x0>;
interrupt-parent = <&adc12>;
interrupts = <0>;
st,adc-channels = <0 1>;
st,adc-diff-channels = <2 6>, <3 7>;
st,min-sample-time-nsecs = <5000>;
dmas = <&dmamux1 9 0x400 0x05>;
dma-names = "rx";
};
// ...
// other adc child node follow...
};
// Example 3: with stm32mp157c to setup ADC2 with:
// - internal channels 13, 14, 15.
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
adc122: adc@48003000 {
compatible = "st,stm32mp1-adc-core";
reg = <0x48003000 0x400>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc ADC12>, <&rcc ADC12_K>;
clock-names = "bus", "adc";
booster-supply = <&booster>;
vdd-supply = <&vdd>;
vdda-supply = <&vdda>;
vref-supply = <&vref>;
st,syscfg = <&syscfg>;
interrupt-controller;
#interrupt-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
adc@100 {
compatible = "st,stm32mp1-adc";
#io-channel-cells = <1>;
reg = <0x100>;
interrupts = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@13 {
reg = <13>;
label = "vrefint";
st,min-sample-time-ns = <9000>;
};
channel@14 {
reg = <14>;
label = "vddcore";
st,min-sample-time-ns = <9000>;
};
channel@15 {
reg = <15>;
label = "vbat";
st,min-sample-time-ns = <9000>;
};
};
};
Source notes #
Annotations retained from the schema source
Line 1: SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)