deleted>Frq08988 mNo edit summary |
Registered User No edit summary |
||
(28 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | |||
{{ | |MPUs list=STM32MP15x | ||
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | |||
}} | }} | ||
</noinclude> | <noinclude></noinclude> | ||
==Article purpose== | ==Article purpose== | ||
The purpose of this article is to | The purpose of this article is to: | ||
* briefly introduce the ADC | * briefly introduce the ADC peripheral and its main features, | ||
* indicate the | * indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts), | ||
* list the software frameworks and drivers managing the peripheral, | |||
* explain how to configure the | * explain how to configure the peripheral. | ||
==Peripheral overview== | ==Peripheral overview== | ||
The | The '''ADC''' peripheral is a successive approximation analog-to-digital converter. | ||
The STM32MP15 has one ADC block with two physical ADCs: | The STM32MP15 has one ADC block with two physical ADCs: | ||
* '''Configurable resolution''': 8, 10, 12, 14, 16 bits. | * '''Configurable resolution''': 8, 10, 12, 14, 16 bits. | ||
Line 35: | Line 29: | ||
* Each context has its own '''configurable sequence and trigger''': software, TIM<ref name="TIM internal peripheral">[[TIM internal peripheral]]</ref>, LPTIM<ref name="LPTIM internal peripheral">[[LPTIM internal peripheral]]</ref> and EXTI<ref name="EXTI_internal_peripheral">[[EXTI internal peripheral]]</ref>. | * Each context has its own '''configurable sequence and trigger''': software, TIM<ref name="TIM internal peripheral">[[TIM internal peripheral]]</ref>, LPTIM<ref name="LPTIM internal peripheral">[[LPTIM internal peripheral]]</ref> and EXTI<ref name="EXTI_internal_peripheral">[[EXTI internal peripheral]]</ref>. | ||
Refer to [[STM32MP15 resources#Reference manuals|STM32MP15 reference manuals]] for the complete features | Refer to the [[STM32MP15 resources#Reference manuals|STM32MP15 reference manuals]] for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented. | ||
== | ==Peripheral usage== | ||
This chapter is applicable in the scope of the '''OpenSTLinux BSP''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-A processor(s), and the '''STM32CubeMPU Package''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-M processor. | |||
== | ===Boot time assignment=== | ||
=== | ====On {{MicroprocessorDevice | device=15}}==== | ||
The ADC is usually not used at boot time. But it may be used by the SSBL (see [[Boot | The ADC is usually not used at boot time. But it may be used by the SSBL (see [[Boot chain overview]]), to check for power supplies for example. | ||
{{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp1_boottime}} | |||
<section begin=stm32mp15_boottime /> | |||
| rowspan="1" | Analog | |||
| rowspan="1" | [[STM32MP15 ADC internal peripheral|ADC]] | |||
| ADC | |||
| | |||
| | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
|- | |||
<section end=stm32mp15_boottime /> | |||
|} | |||
| [[ADC internal peripheral|ADC]] | |||
| | |||
===Runtime assignment=== | |||
====On {{MicroprocessorDevice | device=15}}==== | |||
==== | {{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp15_runtime}} | ||
{{: | <section begin=stm32mp15_runtime /> | ||
< | |||
| rowspan="1" | Analog | | rowspan="1" | Analog | ||
| rowspan="1" | [[ADC internal peripheral|ADC]] | | rowspan="1" | [[STM32MP15 ADC internal peripheral|ADC]] | ||
| ADC | | ADC | ||
| | | | ||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | | <span title="assignable peripheral" style="font-size:21px">☐</span> | ||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | | <span title="assignable peripheral" style="font-size:21px">☐</span> | ||
| Assignment (single choice) | | Assignment (single choice) | ||
|- | |- | ||
</ | <section end=stm32mp15_runtime /> | ||
|} | |||
==Software frameworks and drivers== | |||
Below are listed the software frameworks and drivers managing the ADC peripheral for the embedded software components listed in the above tables. | |||
* '''Linux<sup>®</sup>''': [[IIO overview|IIO framework]] | |||
* '''STM32Cube''': {{CodeSource | STM32CubeMP1 | Drivers/STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_adc.c | HAL ADC driver}} | |||
* '''U-Boot''': [[ADC_OpenSTLinux_drivers#U-Boot |U-Boot ADC driver]] | |||
==How to assign and configure the peripheral== | |||
The peripheral assignment can be done via the [[STM32CubeMX]] graphical tool (and manually completed if needed).<br /> | |||
This tool also helps to configure the peripheral: | |||
* partial device trees (pin control and clock tree) generation for the OpenSTLinux software components, | |||
* HAL initialization code generation for the STM32CubeMPU Package. | |||
The configuration is applied by the firmware running in the context in which the peripheral is assigned. | |||
For the Linux kernel and U-boot configuration, please refer to [[ADC device tree configuration]] article. | |||
==How to go further== | ==How to go further== | ||
See | See application notes: | ||
* How to get the best ADC accuracy in STM32<ref>[http://www.st.com/content/ccc/resource/technical/document/application_note/group0/3f/4c/a4/82/bd/63/4e/92/CD00211314/files/CD00211314.pdf/jcr:content/translations/en.CD00211314.pdf How to get the best ADC accuracy in STM32], by STMicroelectronics</ref>. | * How to get the best ADC accuracy in STM32<ref>[http://www.st.com/content/ccc/resource/technical/document/application_note/group0/3f/4c/a4/82/bd/63/4e/92/CD00211314/files/CD00211314.pdf/jcr:content/translations/en.CD00211314.pdf How to get the best ADC accuracy in STM32], by STMicroelectronics</ref>. | ||
* Getting started with STM32MP15 series hardware development (AN5031)<ref>[https://www.st.com/resource/en/application_note/dm00389996.pdf Getting started with STM32MP15 series hardware development], by STMicroelectronics</ref>.<br/> It deals with analog domain power supply and reference voltage. | |||
==References== | ==References== | ||
<references/> | <references/> | ||
<noinclude> | |||
[[Category:Analog peripherals|ADC internal peripheral STM32MP15]] | |||
{{ArticleBasedOnModel| Internal peripheral article model}} | |||
{{PublicationRequestId | 8309 | 2018-08-07 | AlainF}} | |||
</noinclude> |
Latest revision as of 17:17, 6 November 2024
1. Article purpose[edit | edit source]
The purpose of this article is to:
- briefly introduce the ADC peripheral and its main features,
- indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts),
- list the software frameworks and drivers managing the peripheral,
- explain how to configure the peripheral.
2. Peripheral overview[edit | edit source]
The ADC peripheral is a successive approximation analog-to-digital converter.
The STM32MP15 has one ADC block with two physical ADCs:
- Configurable resolution: 8, 10, 12, 14, 16 bits.
- Each ADC has up to 20 multiplexed channels (including 6 internal channels connected only to ADC2).
- The conversions can be performed in single, continuous, scan or discontinuous mode.
- The result can be read in a left- or right-aligned 32-bit data register by using CPU or DMA[1].
- The analog watchdog feature allows the application to detect if the input voltage goes beyond the user-defined, high or low thresholds.
- A common input clock for the two ADCs, which can be selected between 2 different clock[2] sources (Synchronous or Asynchronous clock).
- The common reference voltage can be provided by either VREFBUF[3] or any other external regulator[4] wired to VREF+ pin.
Each ADC supports two contexts to manage conversions:
- Regular conversions can be done in sequence, running in background
- Injected conversions have higher priority, and so have the ability to interrupt the regular sequence (either triggered in SW or HW). The regular sequence is resumed, in case it has been interrupted.
- Each context has its own configurable sequence and trigger: software, TIM[5], LPTIM[6] and EXTI[7].
Refer to the STM32MP15 reference manuals for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented.
3. Peripheral usage[edit | edit source]
This chapter is applicable in the scope of the OpenSTLinux BSP running on the Arm® Cortex®-A processor(s), and the STM32CubeMPU Package running on the Arm® Cortex®-M processor.
3.1. Boot time assignment[edit | edit source]
3.1.1. On STM32MP15x lines
[edit | edit source]
The ADC is usually not used at boot time. But it may be used by the SSBL (see Boot chain overview), to check for power supplies for example.
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A7 secure (ROM code) |
Cortex-A7 secure (TF-A BL2) |
Cortex-A7 non-secure (U-Boot) | |||
Analog | ADC | ADC | ☐ |
3.2. Runtime assignment[edit | edit source]
3.2.1. On STM32MP15x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A7 secure (OP-TEE) |
Cortex-A7 non-secure (Linux) |
Cortex-M4 (STM32Cube) | |||
Analog | ADC | ADC | ☐ | ☐ | Assignment (single choice) |
4. Software frameworks and drivers[edit | edit source]
Below are listed the software frameworks and drivers managing the ADC peripheral for the embedded software components listed in the above tables.
- Linux®: IIO framework
- STM32Cube: HAL ADC driver
- U-Boot: U-Boot ADC driver
5. How to assign and configure the peripheral[edit | edit source]
The peripheral assignment can be done via the STM32CubeMX graphical tool (and manually completed if needed).
This tool also helps to configure the peripheral:
- partial device trees (pin control and clock tree) generation for the OpenSTLinux software components,
- HAL initialization code generation for the STM32CubeMPU Package.
The configuration is applied by the firmware running in the context in which the peripheral is assigned.
For the Linux kernel and U-boot configuration, please refer to ADC device tree configuration article.
6. How to go further[edit | edit source]
See application notes:
- How to get the best ADC accuracy in STM32[8].
- Getting started with STM32MP15 series hardware development (AN5031)[9].
It deals with analog domain power supply and reference voltage.
7. References[edit | edit source]
- ↑ DMA internal peripheral
- ↑ RCC internal peripheral
- ↑ VREFBUF internal peripheral
- ↑ Regulator overview
- ↑ TIM internal peripheral
- ↑ LPTIM internal peripheral
- ↑ EXTI internal peripheral
- ↑ How to get the best ADC accuracy in STM32, by STMicroelectronics
- ↑ Getting started with STM32MP15 series hardware development, by STMicroelectronics