ST STM32 Application Note

ST STM32 Application Note

Adc modes and their applications
Hide thumbs Also See for STM32:
Table of Contents

Advertisement

Quick Links

AN3116
Application note
STM32™'s ADC modes
and their applications
Introduction
STM32 microcontrollers have one of the most advanced ADCs on the microcontroller
market. You could imagine a multitude of applications based on the STM32 ADC features.
Some ADC modes are provided to simplify measurements and give efficient results in
applications such as motor control.
This application note provides help for ADC users to understand some advanced modes
offered in the STM32 microcontrollers, and to quick start development. Each of the
described modes is provided with an example of application to better understand how to use
them. Most modes come with a basic firmware to make it easier to understand the ADC
configuration.
This application note is divided into two sections: independent modes and dual modes. The
first section describes modes used with a single ADC. The second section describes modes
that should be used with two ADCs (ADC1 and ADC2 working jointly).
This application note does not describe the ADC modes that result from the combination of
other modes.
March 2010
Doc ID 16840 Rev 1
1/18
www.st.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ST STM32

  • Page 1 Introduction STM32 microcontrollers have one of the most advanced ADCs on the microcontroller market. You could imagine a multitude of applications based on the STM32 ADC features. Some ADC modes are provided to simplify measurements and give efficient results in applications such as motor control.
  • Page 2: Table Of Contents

    Contents AN3116 Contents Independent modes ......... 5 Single-channel, single conversion mode .
  • Page 3 AN3116 Contents Dual combined: injected simultaneous + interleaved mode ... 14 2.6.1 Description ..........14 2.6.2 Example of application .
  • Page 4 List of figures AN3116 List of figures Figure 1. Single-channel, single conversion mode ........5 Figure 2.
  • Page 5: Independent Modes

    AN3116 Independent modes Independent modes Single-channel, single conversion mode 1.1.1 Description This is the simplest ADC mode. In this mode, the ADC performs the single conversion (single sample) of a single channel x (refer to Figure 1.) and stops after completion of the conversion.
  • Page 6: Example Of Application

    Independent modes AN3116 Figure 3. Multichannel, single conversion mode 1.2.2 Example of application This mode can be used when starting a system depends on some parameters like knowing the coordinates of the arm’s tip in a manipulator arm system. In this case, you have to read the position of each articulation in the manipulator arm system at power-on to determine the coordinates of the arm’s tip.
  • Page 7: Example Of Applications

    AN3116 Independent modes 1.3.2 Example of applications This ADC mode can be implemented to monitor a battery voltage, the measurement and regulation of an oven temperature, etc. In the case of the oven temperature regulation, the temperature is read and compared to the temperature set by the user.
  • Page 8: Example Of Application

    Independent modes AN3116 Figure 6. Injected conversion mode 1.5.2 Example of application This mode can be used to synchronize the conversion of channels to an event. It is interesting in motor control applications where transistor switching generates noise that impacts ADC measurements and results in wrong conversions. Using a timer, the injected conversion mode can thus be implemented to delay the ADC measurements to after the transistor switching.
  • Page 9: Dual Modes

    AN3116 Dual modes Dual modes Dual modes are available in STM32 microcontrollers that feature two ADCs: ADC1 master and ADC2 slave. ADC1 and ADC2 triggers are synchronized internally for regular and injected channel conversion. ADC1 and ADC2 work together. In some devices, there are up to 3 ADCs: ADC1, ADC2 and ADC3. In this case ADC3 always works independently, and is not synchronized with the other ADCs.
  • Page 10: Dual Fast Interleaved Mode

    Dual modes AN3116 In this case, the voltage and current should be measured simultaneously and then the instantaneous power, which is the product of u (t) and i (t), should be computed. Figure 8 shows how to measure a power using the two ADCs in dual regular simultaneous mode.
  • Page 11: Example Of Application

    AN3116 Dual modes Figure 9. Dual fast interleaved mode 2.2.2 Example of application This mode is used to speed up the sampling rate of the ADC when 2 Msamples/second are needed with 1.5 cycle of sampling time. ADC1 and ADC2 convert the same channel alternately to reduce the conversion time.
  • Page 12: Example Of Application

    = 1.5 cycles (T × f , refer to the datasheet of the STM32 product you are using for more details on the sampling time vs. the source impedance). In this case, the maximum allowed impedance of the source (R max) is 1.2 k.
  • Page 13: Dual Alternate Trigger Mode

    AN3116 Dual modes With T = 13.5 cycles, the maximum allowed impedance of the source (R ) is 19 k. Since the source has an impedance R = 10 k < 19 k the impedance condition is respected. With a single ADC and with T = 1.5 (corresponding to 1.2 k), the impedance condition is not satisfied.
  • Page 14: Dual Combined Regular/Injected Simultaneous Mode

    Dual modes AN3116 Dual combined regular/injected simultaneous mode 2.5.1 Description The dual combined regular/injected simultaneous ADC mode is a regular simultaneous mode that allows injection. The injected channels are also converted simultaneously. In this mode, you should convert sequences with the same length or ensure that the interval between triggers is longer than the longest of the 2 sequences.
  • Page 15: Example Of Application

    AN3116 Dual modes Note: This application note is not delivered with a firmware example of this mode. Figure 13. Dual combined: injected simultaneous + interleaved mode 2.6.2 Example of application You can use this dual combined mode in a UPS system (uninterruptible power supply). The battery voltage is monitored with the ADC watchdog converted in dual interleaved mode.
  • Page 16: Conclusion

    ADC configuration and speed up development. With the provided firmware examples, you can modify the code a little to switch from one mode to another. The STM32’s ADC has several modes intended for advanced conversion processes so as to attain efficient conversion results in applications such as motor control.
  • Page 17: Revision History

    AN3116 Revision history Revision history Table 1. Document revision history Date Revision Changes 02-Mar-2010 Initial release. Doc ID 16840 Rev 1 17/18...
  • Page 18 No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.

Table of Contents