AN3116 Application note

Similar documents
STEVAL-ISQ010V1. High-side current-sense amplifier demonstration board based on the TSC102. Features. Description

AN279 Application note

AN3332 Application note

AN4014 Application Note Adjustable LED blinking frequency using a potentiometer and STM8SVLDISCOVERY Application overview

EVAL-RHF310V1. EVAL-RHF310V1 evaluation board. Features. Description

BD235 BD237. Low voltage NPN power transistors. Features. Applications. Description. Low saturation voltage NPN transistors

STEVAL-CCA040V1. 4X10 Watt dual/quad power amplifier demonstration board based on the STA540SAN. Features. Description

D44H8 - D44H11 D45H8 - D45H11

R 1 typ. = 15 kω. Order codes Marking Polarity Package Packaging. 2N6036 2N6036 NPN SOT-32 Tube 2N6039 2N6039 PNP SOT-32 Tube

BUX87. High voltage NPN power transistor. Features. Applications. Description

Order codes Marking Polarity Package Packaging. MJD44H11T4 MJD44H11 NPN DPAK Tape and reel MJD45H11T4 MJD45H11 PNP DPAK Tape and reel

MJE182 Low voltage high speed switching NPN transistor Features Applications Description High speed switching NPN device

Order codes Marking Package Packaging. STX0560 X0560 TO-92 Bag STX0560-AP X0560 TO-92AP Ammopack. December 2010 Doc ID Rev 1 1/9

STEVAL-ISA005V1. 1.8W buck topology power supply evaluation board with VIPer12AS. Features. Description. ST Components

ST26025A. PNP power Darlington transistor. Features. Applications. Description

Obsolete Product(s) - Obsolete Product(s)

AN2333 Application note

BD533 BD535 BD537 BD534 BD536

2STA1695. High power PNP epitaxial planar bipolar transistor. Features. Applications. Description

BD241A BD241C. NPN power transistors. Features. Applications. Description. NPN transistors. Audio, general purpose switching and amplifier transistors

Obsolete Product(s) - Obsolete Product(s)

AN2581 Application note

STD840DN40. Dual NPN high voltage transistors in a single package. Features. Applications. Description

SPV1001T40. Cool bypass switch for photovoltaic application. Features. Application. Description TO-220

R 1 typ. = 15 kω. Order codes Marking Polarity Package Packaging. STX112-AP X112 NPN TO92-AP Ammopack STX117-AP X117 PNP TO92-AP Ammopack

AN4112 Application note

BD243C BD244C. Complementary power transistors. Features. Applications. Description. Complementary NPN-PNP devices. Power linear and switching TO-220

UM0791 User manual. Demonstration firmware for the DMX-512 communication protocol receiver based on the STM32F103Zx. Introduction

Obsolete Product(s) - Obsolete Product(s)

2STR2215. Low voltage fast-switching PNP power transistor. Features. Applications. Description

2N2219AHR. Hi-Rel NPN bipolar transistor 40 V A. Features. Description

2STC4468. High power NPN epitaxial planar bipolar transistor. Features. Application. Description

AN3134 Application note

LET9060C. RF power transistor from the LdmoST family of n-channel enhancement-mode lateral MOSFETs. Features. Description

2STD1665. Low voltage fast-switching NPN power transistor. Features. Applications. Description

3STL2540. Low voltage high performance PNP power transistor. Features. Applications. Description

STN9260. High voltage fast-switching PNP power transistor. Features. Applications. Description. High voltage capability Fast switching speed

STB High voltage fast-switching NPN power transistor. Features. Applications. Description

2STC4468. High power NPN epitaxial planar bipolar transistor. Features. Application. Description

2STA1943. High power PNP epitaxial planar bipolar transistor. Features. Application. Description

TIP2955 TIP3055. Complementary power transistors. Features. Applications. Description

Obsolete Product(s) - Obsolete Product(s)

Obsolete Product(s) - Obsolete Product(s)

2STR SOT-23 Tape and reel 2STR1230G 130G SOT-23 Tape and reel

Part numbers Order codes Packages Temperature range. LM137 LM137K TO-3-55 C to 150 C LM337 LM337K TO-3 0 C to 125 C LM337 LM337SP TO C to 125 C

LM723CN. High precision voltage regulator. Features. Description

STN High voltage fast-switching PNP power transistor. Features. Application. Description. High voltage capability Very high switching speed

ST13003D-K High voltage fast-switching NPN power transistor Features Applications Description

MD2310FX. High voltage NPN power transistor for standard definition CRT display. Features. Application. Description

BUL743. High voltage fast-switching NPN power transistor. Features. Applications. Description

AN1441 Application note

KF25B, KF33B KF50B, KF80B

BUL38D. High voltage fast-switching NPN power transistor. Features. Applications. Description

Obsolete Product(s) - Obsolete Product(s)

2STD1360 2STF1360-2STN1360

1. Drain 2. Gate. Order code Marking Package Packaging. STAC4932F STAC4932F STAC244F Plastic tray. September 2010 Doc ID Rev 3 1/12

AN2167 Application note

2STC5242. High power NPN epitaxial planar bipolar transistor. Features. Application. Description

Gate. Order codes Package Packaging

AN3218 Application note

Order codes Marking Package Packaging 2STF SOT-89 2STN2550 N2550 SOT-223. November 2008 Rev 1 1/8

STN9360. High voltage fast-switching PNP power transistor. Features. Applications. Description. High voltage capability Fast switching speed

AN440 Application note

STN2580. High voltage fast switching NPN power transistor. Features. Applications. Description. High voltage capability Fast switching speed

Obsolete Product(s) - Obsolete Product(s)

2STX2220. High Gain Low Voltage PNP Power Transistor. General features. Description. Internal schematic diagram. Applications.

Obsolete Product(s) - Obsolete Product(s)

Order codes Marking Package Packaging

STPS30H60-Y. Automotive power Schottky rectifier. Features. Description

2ST2121. High power PNP epitaxial planar bipolar transistor. Features. Applications. Description 1 2 TO-3

MD2009DFX. High voltage NPN power transistor for CRT TV. Features. Application. Description

AN1756 Application note

STD1802T4-A. Low voltage fast-switching NPN power transistor. Features. Description. Applications

BUL39D. High voltage fast-switching NPN power transistor. Features. Application. Description

TR136. High voltage fast-switching NPN power transistor. Features. Applications. Description

2STN2540. Low voltage fast-switching PNP power bipolar transistor. Features. Applications. Description

STEVAL-CCA011V1. Filter-free stereo 2x2.5 W Class-D audio power amplifier demonstration board based on the TS2012FC. Features.

AN3359 Application note 1 Introduction Low cost PCB antenna for 2.4GHz radio: Meander design

MJD122 MJD127 Complementary power Darlington transistors Features Applications Description

SD1728 (TH430) RF & Microwave transistors HF SSB application. Features. Description. Pin connection

AN2837 Application note

AN2979 Application note

BDX53B - BDX53C BDX54B - BDX54C

STPS140Z-Y. Automotive power Schottky rectifier. Features. Description

STTH1210-Y. Automotive ultrafast recovery - high voltage diode. Features. Description

STC04IE170HV. Monolithic emitter switched bipolar transistor ESBT 1700 V - 4 A Ω. Features. Application. Description

PD54003L-E. RF power transistor, LdmoST plastic family N-channel enhancement-mode, lateral MOSFETs. Features. Description

LM323. Three-terminal 3 A adjustable voltage regulators. Features. Description

STX13005G-AP. High voltage fast-switching NPN power transistor. Features. Applications. Description

Overview of the STM32F103xx ACIM and PMSM motor control software libraries release 2.0

Obsolete Product(s) - Obsolete Product(s)

UM0890 User manual. 2-stage RF power amplifier with LPF based on the PD85006L-E and STAP85050 RF power transistors. Introduction

Order codes Packages Lead finish Marking Type EPPL Packaging. 2N5153SHR SMD.5 Gold ESCC Flight Yes Strip pack

Order codes Marking Package Packaging. STD2805T4 D2805 DPAK Tape & reel STD D2805 IPAK Tube. June 2007 Rev 1 1/9

STPS3045FP. Power Schottky rectifier. Features. Description

AN2385 Application note

STPSC V power Schottky silicon carbide diode. Features. Description

STTH60W03C. Turbo 2 ultrafast high voltage rectifier. Features. Description

AN3248 Application note

CPL-WB-02D3. Wide-band, directional coupler with integrated 50 ohm loaded isolated port. Features. Applications. Description.

Transcription:

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

Contents AN3116 Contents 1 Independent modes......................................... 5 1.1 Single-channel, single conversion mode.......................... 5 1.1.1 Description................................................ 5 1.1.2 Example of application....................................... 5 1.2 Multichannel (scan), single conversion mode...................... 5 1.2.1 Description................................................ 5 1.2.2 Example of application....................................... 6 1.3 Single-channel continuous conversion mode....................... 6 1.3.1 Description................................................ 6 1.3.2 Example of applications...................................... 7 1.4 Multichannel (scan) continuous conversion mode................... 7 1.4.1 Description................................................ 7 1.4.2 Example of application....................................... 7 1.5 Injected conversion mode..................................... 7 1.5.1 Description................................................ 7 1.5.2 Example of application....................................... 8 2 Dual modes................................................ 9 2.1 Dual regular simultaneous mode................................ 9 2.1.1 Description................................................ 9 2.1.2 Example of application....................................... 9 2.2 Dual fast interleaved mode.................................... 10 2.2.1 Description............................................... 10 2.2.2 Example of application...................................... 11 2.3 Dual slow interleaved mode................................... 11 2.3.1 Description............................................... 11 2.3.2 Example of application...................................... 12 2.4 Dual alternate trigger mode................................... 13 2.4.1 Description............................................... 13 2.4.2 Example of application...................................... 13 2.5 Dual combined regular/injected simultaneous mode................ 14 2.5.1 Description............................................... 14 2.5.2 Example of application...................................... 14 2/18 Doc ID 16840 Rev 1

Contents 2.6 Dual combined: injected simultaneous + interleaved mode........... 14 2.6.1 Description............................................... 14 2.6.2 Example of application...................................... 15 3 Conclusion................................................ 16 4 Revision history........................................... 17 Doc ID 16840 Rev 1 3/18

List of figures AN3116 List of figures Figure 1. Single-channel, single conversion mode....................................... 5 Figure 2. ADC sequencer converting 7 channels with different configured sampling times................................................................... 5 Figure 3. Multichannel, single conversion mode......................................... 6 Figure 4. Single-channel, continuous conversion mode................................... 6 Figure 5. Multichannel, continuous conversion mode..................................... 7 Figure 6. Injected conversion mode................................................... 8 Figure 7. Dual regular simultaneous mode............................................. 9 Figure 8. Simultaneous measurement of voltage and current.............................. 10 Figure 9. Dual fast interleaved mode................................................. 11 Figure 10. Dual slow interleaved mode................................................ 12 Figure 11. Dual alternate trigger mode................................................ 13 Figure 12. Dual combined regular/injected simultaneous mode............................. 14 Figure 13. Dual combined: injected simultaneous + interleaved mode........................ 15 Figure 14. UPS system............................................................ 15 4/18 Doc ID 16840 Rev 1

Independent modes 1 Independent modes 1.1 Single-channel, single conversion mode 1.1.1 Description Note: 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. This application note is not delivered with a firmware example of this mode. Figure 1. Single-channel, single conversion mode 1.1.2 Example of application This mode can be used for the measurement of a voltage level to decide if the system can be started or not. Measure the voltage level of the battery before starting the system: if the battery has a low level, the low battery message appears. In this case, do not start the system. 1.2 Multichannel (scan), single conversion mode 1.2.1 Description This mode is used to convert some channels successively in independent mode. With the ADC sequencer, you can use this ADC mode to configure any sequence of up to 16 channels successively with different sampling times and in different orders. You can for example carry out the sequence shown in Figure 2. In this way, you do not have to stop the ADC during the conversion process in order to reconfigure the next channel with a different sampling time. This mode saves additional CPU load and heavy software development. Figure 2. ADC sequencer converting 7 channels with different configured sampling times Note: This application note is not delivered with a firmware example of this mode. Doc ID 16840 Rev 1 5/18

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. This mode can also be used to make single measurements of multiple signal levels (voltage, pressure, temperature, etc.) to decide if the system can be started or not in order to protect the people and equipment. It can likewise be used to convert signals coming from strain gauges to determine the directions and values of the different strains and deformations of an object. 1.3 Single-channel continuous conversion mode 1.3.1 Description Note: The single-channel continuous conversion mode converts a single channel continuously and indefinitely in regular channel conversion. The continuous mode feature allows the ADC to work in the background. The ADC converts the channels continuously without any intervention from the CPU. Additionally, the DMA can be used in circular mode, thus reducing the CPU load. An example of firmware is provided with this application note: SingleChannelContinuous. The example uses two methods: DMA and interrupts. To select either method, simply comment or uncomment #define USE_DMA_Transfer in the main.c file. Figure 4. Single-channel, continuous conversion mode 6/18 Doc ID 16840 Rev 1

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. When the oven temperature reaches the desired temperature, the heating resistor is powered off. 1.4 Multichannel (scan) continuous conversion mode 1.4.1 Description The multichannel, or scan, continuous mode can be used to convert some channels successively with the ADC in independent mode. With the sequencer, you can configure any sequence of up to 16 channels successively with different sampling times and different orders. This mode is similar to the multichannel single conversion mode except that it does not stop converting after the last channel of the sequence but it restarts the conversion sequence from the first channel and continues indefinitely. Figure 5. Multichannel, continuous conversion mode 1.4.2 Example of application This mode can be used to monitor multiple voltages and temperatures in a multiple battery charger. The voltage and temperature of each battery are read during the charging process. When the voltage or the temperature reaches the maximum level, the corresponding battery should be disconnected from the charger. 1.5 Injected conversion mode 1.5.1 Description Note: This mode is intended for use when conversion is triggered by an external event or by software. The injected group has priority over the regular channel group. It interrupts the conversion of the current channel in the regular channel group. An example of firmware is provided with this application note: Indep_InjectedGroup. Doc ID 16840 Rev 1 7/18

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. 8/18 Doc ID 16840 Rev 1

Dual modes 2 Dual modes Note: 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. Do not sample the same channel on the two ADCs at the same time, this would introduce conversion errors. 2.1 Dual regular simultaneous mode 2.1.1 Description Note: The dual regular simultaneous ADC mode is used to perform two conversions simultaneously owing to the synchronization of ADC1 and ADC2. Each ADC converts a channel sequence (with scan enabled and the sequencer of each ADC configured) or converts a single channel (scan disabled). The conversion can be started with an external trigger or by software. In this mode, the conversion results of ADC1 and ADC2 are stored in ADC1 s data register (32-bit format). Figure 7 shows how ADC1 and ADC2 convert two sequences simultaneously. ADC1 converts a sequence of 16 channels successively: channel 15 to channel 0 and ADC2 converts a sequence of 16 channels successively: channel 0 to channel 15. This application note does not provide a firmware example. However the STM32 firmware library provides an example of this mode at the following path: \Project\STM32F10x_StdPeriph_Examples\ADC\RegSimul_DualMode. Figure 7. Dual regular simultaneous mode 2.1.2 Example of application The dual regular simultaneous mode can be used in applications where two signals should be sampled and converted at the same time. For example, to measure and plot the singlephase or three-phase instantaneous electrical power: p n (t) = u n (t) i n (t). Doc ID 16840 Rev 1 9/18

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 n (t) and i n (t), should be computed. Figure 8 shows how to measure a power using the two ADCs in dual regular simultaneous mode. To measure a single-phase power, ADC1 and ADC2 are used with two channels (1 channel for the voltage and 1 channel for the current). To measure a three-phase power, ADC1 and ADC2 are used with 6 channels (3 channels for the voltage and 3 channels for the current). Figure 8. Simultaneous measurement of voltage and current 2.2 Dual fast interleaved mode 2.2.1 Description The dual fast interleaved ADC mode is intended for the conversion of one channel. ADC1 and ADC2 convert the selected channel alternately with a period of 7 ADC clock cycles. This means that the channel is converted every 7 clock cycles. Each ADC converts the channel every 14 ADC clock cycles. With a 14 MHz ADC clock, it is thus possible to reach 2 Msamples per second: 14 MHz/7 = 2 MHz (sampling frequency). The conversion can be started by external trigger or by software and the conversion results of ADC1 and ADC2 are stored into ADC1 data register (32-bit format). The maximum allowed sampling time is 7 ADC clock cycles to avoid the overlap between the ADC1 and ADC2 sampling phases in the event that they convert the same channel. This means that the only allowed sampling time is 1.5 cycles. Note: 1 It is highly recommended to use DMA instead of interrupts to avoid the loss of data. 2 An example of firmware is provided with this application note: Dual_FastInterleaved. 10/18 Doc ID 16840 Rev 1

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. While ADC1 samples channel CHx, ADC2 converts the previous sample. For example if a signal to be converted has a maximum frequency of 800 khz, the sampling rate frequency should be higher than or equal to twice the frequency of the signal to be converted (in accordance with Shannon-Nyquist criteria). Since the maximum sampling rate is 1 Msample/second with one ADC, the criteria cannot be met. This is solved by using the dual fast interleaved ADC mode. In this way, the sampling rate frequency becomes 2 Msample/second since the two ADCs (ADC1 and ADC2) work alternately and sample the signal at equal periods (7 ADC cycles). With the dual fast interleaved ADC mode, 2 Msamples/second can be achieved with 1.5 cycles of sampling time. 2.3 Dual slow interleaved mode 2.3.1 Description The dual slow interleaved ADC mode is intended for the conversion of one channel. ADC1 and ADC2 convert the selected channel alternately with a period of 14 ADC clock cycles. The channel is thus converted every 14 clock cycles. Each ADC converts the channel every 28 ADC clock cycles. The conversion can be started by external trigger or by software and the conversion results of ADC1 and ADC2 are stored into ADC1 s data register (32-bit format). The maximum allowed sampling time is 14 ADC clock cycles to avoid any overlap with the next conversion. This means that the only allowed sampling times are 1.5, 7.5 and 13.5 cycles. Continuous conversion should not be used in this mode since the ADCs would continuously convert the selected regular channel automatically (the CONT bit should not be set in this mode). Note: 1 It is highly recommended to use DMA instead of interrupts to avoid the loss of data. 2 An example of firmware is provided with this application note: Dual_SlowInterleaved. Doc ID 16840 Rev 1 11/18

Dual modes AN3116 Figure 10. Dual slow interleaved mode 2.3.2 Example of application Let us assume that the signal to be converted has a maximum frequency (f in ) of 500 khz with an impedance R AIN = 10 k. The minimum sampling rate should be 1 Msamples/second (in accordance with Shannon-Nyquist criteria). With one ADC, the only configuration is f ADC = 14 MHZ and the sampling time T s = 1.5 cycles (T s = t s f ADC, 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 AIN max) is 1.2 k. The conversion will not be accurate since R AIN > R AINmax. Solution Use the ADC in dual slow interleaved mode. Each ADC sampling should be configured to have a minimum sampling rate of 500 ksamples/second with f ADC = 14 MHz. T TotalRate = T s + T conv = t TotalRate f ADC = f ADC ----------------, where: F srate T TotalRate is the total conversion time in ADC clock cycles. t TotalRate is the sum of the sampling time t s (t s = T s /f ADC ) and the conversion time t conv (t conv = T conv /f ADC ) T conv is a constant equal to 12.5 cycles T s is the sampling time given in ADC cycles, it is equal to: T s f ADC F srate = ---------------- 12.5 = --------------------- 14 10 12.5 = 15.5 cycles 3 500 10 6, where F srate is the sampling rate frequency. Since T s = 15.5 cycles is not available for the configuration (for more details about the different available T s values, refer to the 12-bit ADC characteristics section in the datasheet of the STM32 product you are using). The nearest available value is T s = 13.5. To know whether this value meets Shannon-Nyquist criteria, we need to calculate the sampling rate with T s = 13.5 and f ADC = 14 MHz: T TotalRate = 13.5 + 12.5 = 26 cycles F srate = f ADC /T TotalRate = 14.10 6 / 26 = 538 khz per ADC Since the conversion is made with two ADCs (ADC1 + ADC2) working alternately, the sampling rate frequency is: F srate = 538 2 = 1076 khz > 2 f in, and so the Shannon- Nyquist criteria is respected. 12/18 Doc ID 16840 Rev 1

Dual modes With T s = 13.5 cycles, the maximum allowed impedance of the source (R AIN ) is 19 k. Since the source has an impedance R AIN = 10 k < 19 k the impedance condition is respected. With a single ADC and with T s = 1.5 (corresponding to 1.2 k ), the impedance condition is not satisfied. By using two ADCs, we have thus extended the impedance margin from 1.2 k to 19 k. With the dual slow interleaved ADC mode, the 1 Msamples/second sampling rate is achieved with higher input impedances. 2.4 Dual alternate trigger mode 2.4.1 Description Note: Figure 11. The dual alternate trigger ADC mode can be used only on an injected channel group. In this mode, ADC1 and ADC2 alternately convert the injected channels on the same external trigger. When the first trigger occurs, all injected group channels in ADC1 are converted. When the second trigger happens, all injected group channels in ADC2 are converted and so on. The maximum number of injected channels in the group is 4 for each ADC. An example of firmware is provided with this application note: Dual_AlternateTrigger. Dual alternate trigger mode 2.4.2 Example of application The dual alternate trigger mode makes it possible to have sampling points as close as possible to each other (down to 1.5 ADC cycles). This is interesting for instance in motor control applications, where a single-shunt sensor is used for three-phase current reading. In some cases, the PWM duty cycle of the power stage has to be limited to maintain a minimum time slot for two consecutive conversions. If the sampling points are as close as possible, the PWM duty cycle is maximized, which increases the voltage applied to the motor. Doc ID 16840 Rev 1 13/18

Dual modes AN3116 2.5 Dual combined regular/injected simultaneous mode 2.5.1 Description Note: 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. Otherwise, the ADC with the shortest sequence may restart while the ADC with the longest sequence is completing the previous conversions. An example of firmware is provided with this application note: Dual_Combined_Reg_Inj_Sumultaneous. The example uses two methods: DMA and interrupts. To select either method, simply comment or uncomment #define USE_DMA_Transfer in the main.c file. Figure 12. Dual combined regular/injected simultaneous mode 2.5.2 Example of application The dual combined (regular/injected) simultaneous mode can be used to read 3-phase currents at definite times. This mode is interesting when you read the currents of two of the phases and you determine the current of the third phase by extrapolation since there is a relationship between the currents of the 3 phases. 2.6 Dual combined: injected simultaneous + interleaved mode 2.6.1 Description This mode is the combination of the dual interleaved mode (fast or slow) and the dual injected simultaneous mode. When the regular channel is triggered, the dual interleaved conversion starts: ADC2 makes the first conversion, then ADC1 converts the channel and so on. When the injected channel is triggered, it interrupts the interleaved channel conversion and the two ADCs (ADC1 and ADC2) start converting the group of injected channels. When the two ADCs finish the injected conversion, they resume the conversion of the channel configured in interleaved mode. 14/18 Doc ID 16840 Rev 1

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. The ADC also monitors the power consumed by the load by measuring the voltage and the current in dual injected simultaneous mode. Figure 14. UPS system Doc ID 16840 Rev 1 15/18

Conclusion AN3116 3 Conclusion This application note explains some ADC modes, and provides examples of applications to make it easier to understand the presented modes. Most examples come with firmware to simplify the 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. DMA is a major feature and its use is recommended when possible to avoid the loss of samples and release the CPU load. 16/18 Doc ID 16840 Rev 1

Revision history 4 Revision history Table 1. Document revision history Date Revision Changes 02-Mar-2010 1 Initial release. Doc ID 16840 Rev 1 17/18

Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. 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. UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. 2010 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com 18/18 Doc ID 16840 Rev 1