EFM32 Operational Amplifiers

 

1 Introduction

1.1 About

This application note explains the theory of general operational amplifiers (opamps). It also describes the opamps (OPAMP) that are built into several of the EFM32 microcontrollers. The reference manual has a section explaining how to use the OPAMPs, but this application note covers more theory, and include useful examples with a detailed analysis.

The software examples are written for the EFM32TG840F32 in the EFM32 Tiny Gecko Starter Kit.

 

2 Operational Amplifiers

2.1 Overview

Figure 2.1. A simple overview of an opamp

image

An opamp is in its simplest form an amplifier with a theoretical infinite gain. The opamp has three main terminals (see Figure 2.1 (p. 3)) which are the positive (non-inverting) and negative (inverting) inputs in addition to the output. The general formula for an opamp is given by Equation 2.1 (p. 3) , where AOL is the open loop gain which is infinite in an ideal opamp.

Amplifier Formula

VOUT = AOL (V+ - V-)                                                                            (2.1)

In addition to the three main terminals, the opamp has two power supply pins VS+ and VS-. These two voltage levels define the upper and lower voltage limit for the opamp output. Opamps also have a defined input range, which does not necessarily equal the output range. A rail-to-rail opamp is able to operate in the full range between VS+ and VS-.

 

2.1.1 Feedback

The versatility of the opamp lies in the various possible configurations that can be created by adding different feedback functions between the output and the positive and/or negative inputs. In the simplest form these feedbacks can consist of a few passive components like resistors or capacitors, but can also include more complex circuitry. These feedback connections allow many different kinds of filtering and amplification characteristics.

 

2.2 Characteristics

Open loop gain

The open loop gain (AOL) (See Equation 2.1 (p. 3) ) is the gain without positive or negative feedback. Typical values range from 20,000 to 200,000 in physical devices.

Gain bandwidth product

In a real life opamp the gain is often a tradeoff against the bandwidth the opamp will be able to handle. Because of this relation, these two factors are often presented together as the gain bandwidth product.

Input offset voltage

The output VOUT when V- = V+. This value is ideally 0, but in real-life this value is nonzero.

Slew rate

The slew rate is the maximum change of voltage the opamp can output per time unit. Normally this is very high, which means that the output voltage can change rapidly. The slew rate is typically a few V/µs.

 

2.3 Ideal Opamps

An ideal opamp is a simplified model of a physical opamp. An ideal op-amp is usually considered to have the following characteristics, and they are considered to hold for all input voltages:

• Infinite open loop gain.

• Infinite input impedance.

• Infinite slew rate.

• Infinite bandwidth.

• Zero output offset.

• Zero input offset voltage.

• Zero output impedance.

• Zero noise.

These characteristics are equivalent to the following two "golden" rules for ideal opamps:

• The opamp will output whatever makes the two inputs as equal as possible. V+ = V-.

• The inputs draw no current. I+ = I- = 0.

Ideal opamps are used when calculating quantities for physical opamps. Since physical opamps have characteristics that are close to those of an ideal opamp, this is a good approximation in most cases.

 

3 The EFM32 Operational Amplifiers

3.1 Overview

Figure 3.1. A overview of the EFM32 opamps

image

The EFM32 has up to three built in general purpose opamps, named OPA0, OPA1, and OPA2 (see Figure 3.1 (p. 5) ). It is possible to connect the three opamps together to make more complex configurations in addition to setting up either external or internal feedbacks. The feedback path for each of the opamps includes an internal resistor ladder. This ladder can be configured to set the preferred gain value. It is also possible to bypass the ladder in unity gain mode.

All the EFM32 opamps are rail-to-rail for input and output. The positive source VS+ is equal to VDD, and the negative source VS- is connected to ground. A list containing electrical characteristics of the EFM32 opamps can be found in the datasheet.

The EFM32 opamps can be calibrated. OPA0s and OPA1s offset can be set through the CH0OFFSET and CH1OFFSET bitfields respectively in DACn_CAL. The offset for OPA2 can be set through OPA2OFFSET in DACn_OPAOFFSET.

 

3.2 OPA and DAC

Figure 3.2. The DAC and its components

image

OPA0 and OPA1 are a part of the DAC, while OPA2 is separate (see Figure 3.2 (p. 6) ). All of them can be controlled from the DAC registers. OPA0 is used as an output buffer for DAC channel 0, and OPA1 is used as an output buffer for DAC channel 1. When a DAC channel is used, the associated opamp is used as an output buffer stage and the opamp can in this case not be used independently of the DAC channel. Hence, when a DAC channel is used, the corresponding opamp must be disabled. This can be done by clearing OPAxEN in DACn_OPACTRL.

 

3.3 Alternative Outputs

The outputs of all the opamps are connected to internal switches making it possible to route the outputs to various output destinations. The default output is connected directly to the DACn pin. There are several alternative outputs, these include the ADC, another opamp and different pin destinations.

 

4 The EFM32 Starter Kits

4.1 Overview of the Tiny Gecko STK

Table 4.1 (p. 7) and Figure 4.1 (p. 7) gives an overview of the available pin connections for the opamps on the EFM32TG on the Tiny Gecko Starter Kit (EFM32TG-STK3300). Notice that OPA0 and OPA1 share pins with several other devices on the PCB which in some cases will inhibit these connections to be used for the opamps. For the outputs these collisions can be solved by choosing alternate outputs as given in Table 4.1 (p. 7) . The OPA2 pin connections do not share pins with any external components, but care must still be taken with EFM32 peripherals that might be enabled on the same pins.

Table 4.1. Table showing the inputs, and the alternative outputs for all three opamps. To use OPA2, it is also possible to use the connections on the back side of the kit. The parenthesis tells which other peripherals that use the same pin.

image

Figure 4.1. The front side of the STK. The picture also shows the inputs and main outputs.

image

On the back side of the kit, there is a footprint of OPA2 (Figure 4.2 (p. 8) ). OPA2 can be accessed both from the pins on the front side (see Table 4.1 (p. 7) ), or from this footprint. The footprint has three feedback paths, two to the inverting and one to the non-inverting input. In all these three paths it is easy to connect external components like a resistor or capacitor.

Figure 4.2. The OPA2 on the back side of the STK.

image

 

4.2 Overview of the Giant Gecko STK

Table Table 4.2 (p. 8) gives an overview of the available pin connections for the opamps on the Giant Gecko Starter Kit. On the back side of the kit, there is a footprint of OPA2 which is the same as the one on the Tiny Gecko Starter Kit(Figure 4.2 (p. 8) ) and can be used in the same way. See Overview of the Tiny Gecko STK for details.

Table 4.2. Table showing the inputs, and the alternative outputs for all three opamps. To use OPA2, it is also possible to use the connections on the back side of the kit. The parenthesis tells which other peripherals that use the same pin.

image

5 Software Examples

5.1 Introduction

This chapter describes useful opamp configurations, and the theory behind them. Each of these configurations have a corresponding C software example written for the EFM32TG_STK3300. In the C-code examples where only one opamp is used, OPA2 is chosen in most of the cases. The configurations can also be adapted to OPA0 and OPA1, but they share pins with other external circuitry, so OPA2 is preferred. For more detailed information about how to set the registers to make the different configurations, see the reference manual. In all calculations the opamps are assumed to be ideal.

Opamps can be configured in many more ways than those described here. Common configurations that are not covered are differentiating amplifier, integrating amplifier, summing amplifier and current to-voltage converter.

The resistances in the figures are internal, so no external resistors or other external components are needed. Table 4.1 (p. 7) and Figure 4.1 (p. 7) gives an overview of all inputs and outputs needed to set up the configurations.

 

5.2 Unity Gain Voltage Follower

The simplest configuration with feedback is the voltage follower configuration. In this configuration only one opamp (OPA2) is used. Here the output is routed directly back to the inverting input. This configuration outputs the same voltage value as the input, VIN. This voltage follower is commonly used as a buffer to increase the drive strength to drive higher loads.

Figure 5.1. Unity Gain Voltage Follower

image

5.3 Non-inverting Amplifier

This configuration amplifies the input signal VIN. Only OPA2 is used. The gain is determined by R1 and R2 (in figure Figure 5.2 (p. 10) ) according to Equation 5.1 (p. 10) . VIN is connected to the noninverting input. In the software example R2/R1 = 1/3.

Figure 5.2. Non-inverting Amplifier

image

The inputs of the opamp do not draw any current. Let I be the current from the VOUT pin to ground. By using Ohm's law, and the ideal opamp rules, we get the following equations.

VIN = IR1 VOUT = I(R1+R2)                                                                            (5.1)

Now cancel out I, by putting the two equations together. This gives:

VOUT = (R1+R2)/R1 VIN = (1 + R2/R1) VIN                                                                         (5.2)

5.4 Inverting Amplifier

This configuration inverts the input signal VIN around the POS signal applied to the positive input according to Equation 5.5 (p. 11) . The ratio R2/R1 determines the inverting gain and unity gain is achieved when R2/R1 = 1. Then VOUT = 2POS - VIN. Only OPA2 is used in this configuration. The software example uses R2/R1 = 1.

The value of POS usually equals (VS+ + VS-)/2, giving full range on the output. For the EFM32 opamps this equals to VDD/2.

This is exactly the same configuration as the non-inverting amplifier, except that VIN is connected to the inverting input, and the non-inverting input is connected to the POS reference.

Figure 5.3. Inverting Amplifier

image

Again, let I be the current from the VOUT pin to VIN. By using Ohm's law, and the ideal opamp rules this gives the following pair of equations.

POS - VIN = IR1 VOUT-VIN = I(R1+R2)                                                                    (5.3)

Substitute out I to get

(POS-VIN)(R1+R2) = (VOUT-VIN) R1                                                                                                     (5.4)

and finally

VOUT = (POS-VIN) R1/R2 + (POS-VIN) - VIN = -(VIN - POS) R2/R1 + POS                       (5.5)

5.5 Cascaded Non-inverting Amplifier

This configuration chains several non-inverting amplifiers to create a higher overall gain. All three EFM32 opamps are used in this example. The output of OPA0 is routed to the non-inverting input of OPA1. Similarly, the output of OPA1 is routed to the non-inverting input of OPA2. If one opamp can amplify the signal by a factor of F, then this cascaded configuration can amplify by a factor of F3. In the software example F = 4/3.

Figure 5.4. Cascaded Non-inverting Amplifier

image

The mathematical analysis used to find VOUT1, VOUT2 and VOUT3 use the same idea as the single noninverting amplifier. If all resistances are like in Figure 5.4 (p. 11) , then VOUT3=(1+R2/R1)3VIN.

 

5.6 Cascaded Inverting Amplifier

This configuration consists of three inverting amplifiers put together to achieve higher accumulated gain. All three EFM32 opamps are used in this configuration. In the software example R2/R1 = 1 for all three resistor ladders.

Figure 5.5. Cascaded Inverting Amplifier

image

The mathematical analysis used to find VOUT1, VOUT2 and VOUT3 use the same idea as the single inverting amplifier. If all resistances are like in Figure 5.4 (p. 11) , then VOUT3=(1+R2/R1)3VIN.

 

5.7 Two Opamp Differential Amplifier

This configuration uses two opamps to output the weighted difference between the two inputs as shown in Figure 5.4 (p. 11) . The result is given as a differential output, VDIFF, between the two output pins given in Equation 5.9 (p. 13) . The first opamp is just used as a voltage follower, and the feedback in the second opamp is enabled. . In the software example R2/R1 = 1, so VDIFF = (V2 - V1).

As the figure shows, it is possible to use OPA0 and OPA1, or OPA1 and OPA2 to set up this configuration. The software example uses OPA0 and OPA1.

Figure 5.6. Two Opamp Differential Amplifier

image

Let VOUT be the output of OPA1 (in the upper drawing). The following equations appear by using the ideal opamp rules and Ohm's law.

(V2-V1) = IR1

VOUT-V1 = I(R1+R2)                                                                             (5.6)

Cancel out I to get

(V2-V1)(R1+R2) = (VOUT-V1) R1                                                                                  (5.7)

Solve for VOUT to get

VOUT = (R1+R2)/R1 (V2-V1) + V1 = V2 + R2/R1 (V2-V1)                             (5.8)

Now by using the fact that VDIFF = VOUT - V2

VDIFF = R2/R1 (V2-V1)                                                                          (5.9)

5.8 Three Opamp Differential Amplifier

This configuration will use all three EFM32 opamps. OPA0 and OPA1 are just used as voltage followers, and their outputs are routed to the non-inverting and inverting input of OPA2. Negative feedback is enabled in OPA2, and the non-inverting input use the OPA0 resistor ladder. The OPA0 inverting input is connected to ground. See figure Figure 5.7 (p. 13) for an overview.

Figure 5.7. Three Opamp Differential Amplifier

image

Let I1 be the current from VOUT to V1, and let I2 be the current from ground to V2. Let V be the voltage going into the two input terminals. This gives

V-V1 = I1R1

VOUT-V1= I1(R1+R2)

V- V2 = I2R1

0-V2 = I2(R1+R2)                                                                        (5.10)

Introduce R = (R1+R2)/R1. Then cancel out I1 and I2 to get

-V2 = R (V - V2)

VOUT - V1 = R (V - V1)                                                                 (5.11)

This gives

-V2 + V2R = VR = VOUT - V1 + V1R                                               (5.12)

Solve for VOUT to get

VOUT = (V2 - V1) R2/R1                                                                                        (5.13)

The Three Opamp Differential Amplifier use another set of resistances than the other configurations, and the resulting gain can be found in Table 5.1 (p. 14) .

Table 5.1. Three Opamp Differential Amplifier Gain Programming

image

5.9 Opamp to ADC

Both OPA0 and OPA1 can send their outputs directly to the EFM32 ADC. This example configures OPA1 to send its output to ADC channel 1. OPA1 will get input from the non-inverting pin and amplifies the signal by using a negative feedback. In the C-example the resistances are configured to give a gain of 4/3.

The output is routed out to the alternative OPA1 output channel, and then out to output 4, where ADC channel 1 is located. The ADC converts the signal and writes the result on the LCD display.

Figure 5.8. OPA1 Connected to the ADC.

image

5.10 DAC to Opamp

This example shows how the DAC output can be routed to OPA2. Here DAC channel 0 is used to send a signal to the positive OPA2 input. The configuration is exactly the same as the three opamp differential amplifier configuration, except that OPA0 is used as a part of DAC channel 0, and OPA1 is replaced with ground (see Figure 5.9 (p. 15) ).

Figure 5.9. DAC Connected to OPA2.

image

With R2>R1This configuration is useful for generating a higher amplitude (up to VDD) output, referenced to a lower voltage reference in the DAC conversion (e.g. internal 1.25 V bandgap reference). If R2<R1, this configuration will reduce the signal and can then be useful for outputting low amplitude signals while still utilizing the full 12-bit resolution of the DAC.

In the software example the signal is reduced from 1.0V to 0.33V.

No comments:

Post a Comment