https://wiki.st.com/stm32mpu-ecosystem-v1/index.php?title=DAC_device_tree_configuration&feed=atom&action=history
DAC device tree configuration - Revision history
2024-03-29T14:58:45Z
Revision history for this page on the wiki
MediaWiki 1.31.16
https://wiki.st.com/stm32mpu-ecosystem-v1/index.php?title=DAC_device_tree_configuration&diff=67769&oldid=prev
Jean Christophe Trotin at 14:06, 6 February 2020
2020-02-06T14:06:54Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 14:06, 6 February 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"><noinclude></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{ArticleBasedOnModel|[[Peripheral or framework device tree configuration model]]}}</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{ArticleMainWriter|FabriceG}}</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{ArticleApprovedVersion| FabriceG | ArnaudP | No previous approved version | AnneJ - 14Sept'18 - 8780 | 14Sept'18 }}</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">[[Category:Device tree configuration]]</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">[[Category:IIO]]</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></noinclude></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Purpose ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Purpose ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l91" >Line 91:</td>
<td colspan="2" class="diff-lineno">Line 83:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><references /></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><references /></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><noinclude></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Device tree configuration]]</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:IIO]]</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{ArticleBasedOnModel|Peripheral or framework device tree configuration model}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{PublicationRequestId | 8780 | 2018-09-14 | AnneJ}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></noinclude></ins></div></td></tr>
</table>
Jean Christophe Trotin
https://wiki.st.com/stm32mpu-ecosystem-v1/index.php?title=DAC_device_tree_configuration&diff=67756&oldid=prev
Gerald Baeza: /* Purpose */
2020-02-06T13:53:21Z
<p><span dir="auto"><span class="autocomment">Purpose</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:53, 6 February 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l15" >Line 15:</td>
<td colspan="2" class="diff-lineno">Line 15:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>It is used by the [[DAC Linux driver]] that registers relevant information in [[IIO overview|IIO framework]], such as IIO devices, channels and voltage scale.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>It is used by the [[DAC Linux driver]] that registers relevant information in [[IIO overview|IIO framework]], such as IIO devices, channels and voltage scale.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">If the peripheral is assigned to another execution context, refer to [[How to assign an internal peripheral to a runtime context]] article for guidelines on peripheral assignment and configuration.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== DT bindings documentation ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== DT bindings documentation ==</div></td></tr>
</table>
Gerald Baeza
https://wiki.st.com/stm32mpu-ecosystem-v1/index.php?title=DAC_device_tree_configuration&diff=49813&oldid=prev
Frq08988: /* DT configuration (board level) */
2019-01-21T13:59:22Z
<p><span dir="auto"><span class="autocomment">DT configuration (board level)</span></span></p>
<p><b>New page</b></p><div><noinclude><br />
{{ArticleBasedOnModel|[[Peripheral or framework device tree configuration model]]}}<br />
{{ArticleMainWriter|FabriceG}}<br />
{{ArticleApprovedVersion| FabriceG | ArnaudP | No previous approved version | AnneJ - 14Sept'18 - 8780 | 14Sept'18 }}<br />
[[Category:Device tree configuration]]<br />
[[Category:IIO]]<br />
</noinclude><br />
<br />
== Purpose ==<br />
<br />
The purpose of this article is to explain how to configure the digital-to-analog converter (''DAC'')<ref name="DAC internal peripheral">[[DAC internal peripheral]]</ref> ''' when the peripheral is assigned to Linux<sup>&reg;</sup> OS''', and in particular:<br />
* how to configure and enable the DAC '''peripheral'''<br />
* how to configure the '''board''', the DAC channels, reference voltage regulator and pins.<br />
The configuration is performed using the '''device tree mechanism'''<ref name="Device tree">[[Device tree]]</ref>.<br />
<br />
It is used by the [[DAC Linux driver]] that registers relevant information in [[IIO overview|IIO framework]], such as IIO devices, channels and voltage scale.<br />
<br />
== DT bindings documentation ==<br />
''STM32 DAC device tree bindings''<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt | Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt}}, STM32 DAC device tree bindings</ref> deal with all the required or optional properties.<br />
<br />
== DT configuration ==<br />
This hardware description is a combination of STM32 and board device tree files. See [[Device tree]] for explanations on device tree file split.<br />
<br />
The '''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details.<br />
<br />
=== DT configuration (STM32 level) ===<br />
The DAC nodes are declared in stm32mp157c.dtsi<ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi | STM32MP157C device tree file}}</ref>:<br />
* '''DT root node''' (''''dac'''') describes the DAC hardware block parameters such as registers area and clocks.<br />
* '''DT child nodes''' (''''dac1'''' and ''''dac2'''') describe DAC channels independently.<br />
'''dac''': dac@address {<br />
compatible = "st,stm32h7-dac-core";<br />
... {{highlight|/* common resources in 'dac' root node. */}}<br />
'''dac1''': dac@'''1''' {<br />
compatible = "st,stm32-dac";<br />
reg = <'''1'''>; {{highlight|/* DAC identifier (e.g. 1 for DAC1) */}}<br />
... {{highlight|/* private resources in 'dac1' child node. */}}<br />
};<br />
'''dac2''': dac@'''2''' {<br />
compatible = "st,stm32-dac";<br />
reg = <'''2'''>; {{highlight|/* DAC identifier (e.g. 2 for DAC2) */}}<br />
... {{highlight|/* private resources in 'dac2' child node. */}}<br />
};<br />
};<br />
{{Warning|This device tree part is related to STM32 microprocessors. It should be kept as is, without being modified by the end-user.}}<br />
<br />
=== DT configuration (board level) ===<br />
Follow the below sequence to configure and enable the DAC on your board:<br />
* Enable '''DT root node''' named ''''dac'''' by setting '''status = "okay"'''.<br />
* Configure pins in use via [[Pinctrl overview|pinctrl]] through '''pinctrl-0''' and '''pinctrl-names'''.<br />
* Configure analog reference voltage regulator<ref name="Regulator overview">[[Regulator overview]]</ref> by setting '''vref-supply = <&your_regulator>'''.<br />
* Enable '''DT child node(s)''' for ''''dac1'''' and/or ''''dac2'''' channels(s) in use by setting '''status = "okay"'''.<br />
{{info|The DAC can use the internal VREFBUF<ref name="VREFBUF internal peripheral">[[VREFBUF internal peripheral]]</ref> or any other external regulator<ref name="Regulator overview"/> wired to the VREF+ pin}}.<br />
<br />
=== DT configuration example ===<br />
The example below shows how to configure DAC1 and DAC2 channels:<br />
* PA4 and PA5 pins both configured as analog pins (see [[Pinctrl device tree configuration]] for more details)<br />
* VREFBUF<ref name="VREFBUF internal peripheral"/> used as reference voltage<br />
<br />
dac_ch1_pins_a: dac-ch1 {<br />
pins {<br />
pinmux = <STM32_PINMUX('A', 4, ANALOG)>; {{highlight|/* configure 'PA4' as ANALOG */}}<br />
};<br />
};<br />
dac_ch2_pins_a: dac-ch2 {<br />
pins {<br />
pinmux = <STM32_PINMUX('A', 5, ANALOG)>; {{highlight|/* configure 'PA5' as ANALOG */}}<br />
};<br />
};<br />
<br />
&dac {<br />
pinctrl-names = "default";<br />
pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>; {{highlight|/* Use PA4 and PA5 pin as ANALOG */}}<br />
vref-supply = <'''&vrefbuf'''>; {{highlight|/* Example to use VREFBUF (It needs to be enabled as well) */}}<br />
status = "'''okay'''"; {{highlight|/* Enable the DAC block */}}<br />
dac1: dac@1 {<br />
status = "'''okay'''"; {{highlight|/* Enable DAC1 */}}<br />
};<br />
dac2: dac@2 {<br />
status = "'''okay'''"; {{highlight|/* Enable DAC2 */}}<br />
};<br />
};<br />
<br />
==How to configure the DT using STM32CubeMX==<br />
The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32|platform configuration device tree]] files.<br /><br />
The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. If so, the tool inserts '''user sections''' in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to [[STM32CubeMX]] user manual for further information.<br />
<br />
==References==<br />
For additional information, refer to the following links:<br />
<br />
<references /></div>
Frq08988