Volker Soffel, manager for analog microcontroller (AMC) worldwide marketing and applications, National Semiconductor Corp., Santa Clara, Calif. , email@example.com
Many of today's typical analog signal-processing systems are built around a microcontroller with integrated A/D converter. However, the maximum amplitude of the analog signals to be processed is often not large enough to utilize the full dynamic range of the integrated converter, so designers typically use external operational amplifiers to amplify those signals. Using this approach, one op amp per amplified analog signal is required. The concept presented in this paper takes an alternate approach: A programmable gain op amp is integrated between the analog input multiplexer and a 10-bit successive approximation A/D converter. The microcontroller software can program different gain factors for each of the analog inputs, thus eliminating the need for any external op amps. This approach can result in significant component count, board space and cost savings. The performance characteristics of such an implementation are discussed with approaches to how to address common design challenges, like offset correction. The paper also discusses the challenges of emulating the analog functionality integrated on a microcontroller and presents a concept that allows superior analog emulation capability.
The traditional way
Figure 1 shows the block diagram of a typical analog signal-processing system built around a microcontroller. The microcontroller features an integrated A/D converter and is used to process a variety of signals. In our example various analog sensor outputs (battery voltage change, battery charge current, battery temperature) are measured. The microcontroller's A/D voltage reference is typically tied to the chip's Vcc voltage (5 V in the example) and the A/D converter thus has a full-scale dynamic range of 0 V to 5 V. Assuming a 10-bit resolution, this translates into a voltage step of 4.88 m V per bit.
Figure 1: Example of an analog signal processing system
Now let's look at the output characteristics of each of our analog sensors in more detail. One parameter to be measured in our example is the charge current for the battery and the current flowing into the system powered by the battery. This is usually done using the shunt resistor; the tradeoff that has to be made is minimizing the voltage drop over that resistor (to minimize heat dissipation and measurement error), while getting a reasonable resolution of the measured current.
Let's assume our charge/supply current that we want to measure is a maximum 1 A. However, in certain modes current can drop below the 1-mA level and we want to be able to measure this current as well. A 0.1-ohm resistor in the supply line would result in a 0.1- V drop in the supply at 1 A. Without amplification, our A/D would only see a maximum 100-m V input voltage, giving us an A/D resolution of 100m V/4.88m V = 20.5 (5 bits), which translates into a current resolution capability of 1 A/20.5 = 48.8m A, not very exciting. Amplifying the 0.1- V voltage drop by a factor of 50 gives us a full 5- V input voltage delta, resulting in a current resolution capability of 976.56 A.
To measure the battery temperature, a negative temperature coefficient (NTC) resistor is used. A typical NTC resistor with a beta of 2,988 and a value of 3 kohm at 25C changes its resistive value from approximately 0.5 kohm to about 7.7 kohm over a temperature range of -10C to +50C. If such a temperature sensor is used without additional amplification, a typical result looks as follows (assuming the NTC's voltage change with temperature is linear, which of course it is not, but this is of no relevance for the point we are trying to illustrate.):
Figure 2: Temperature measurement w/o amplification
The minimum voltage measured by the A/D at -10C is:
5 V*0.5 kohm /(5.9 kohm +0.5 kohm) = 390.63 m V
The maximum voltage measured by the A/D at +50C is:
5 V*7.7 kohm /(5.9 kohm +7.7 kohm)= 2.831 V
So the voltage delta over temperature is 2.440 V, utilizing only half of the A/D's full dynamic range. Assuming, for a moment, the NTC's voltage change is linear, this translates into an A/D resolution of 2.440 V/4.88m V= 500 (< 9="" bits),="" which="" in="" terms="" of="" the="" temperature="" range="" to="" be="" measured="" would="" give="" us="" a="" temperature="" resolution="" of="" 60c/500="0.12C.">
Taking the same configuration and amplifying the signal gives the following results:
Figure 3: Temperature measurement with amplification
The minimum voltage measured by the A/D at -10C is:
5 V*0.5 kohm/(27 kohm + 0.5 kohm)* 4 = 363.6 mV
The maximum voltage measured by the A/D at +50C is:
5 V*7.7 kohm /(27 kohm +7.7 kohm)*4 = 4.438 V
The voltage delta over temperature is 4.074 V. Assuming again, for a moment, the NTC's voltage change is linear, this would translate into an A/D resolution value of 4.074 V/4.88m V = 835 (< 10="" bits),="" which="" in="" terms="" of="" the="" temperature="" range="" to="" be="" measured="" gives="" us="" a="" temperature="" resolution="" of="" 60c/835="0.072C." so="" by="" adding="" the="" amplifier="" into="" our="" system="" design="" we="" have="" substantially="" improved="" our="" capability="" to="" do="" a="" finer="" grained="" temperature="" measurement.="">
Another parameter to be measured in our example system is the voltage change of the battery over time to determine charge termination. A rechargeable NiCd or NiMH battery has a typical cell voltage of 1.2 V. The maximum voltage when fully charged is 1.45 V, the minimum voltage when discharged is 0.9 V. One of the methods to do charge termination is -delta V, i.e. at the end of charge the cell voltage drops slightly. Assuming a one-cell configuration and no amplification, we utilize a resolution of the A/D of
1.45 V/4.88m V = 297 (< 9="" bits).="" amplifying="" the="" voltage="" by="" a="" factor="" of="" two="" we="" get="" 2.9="" v/4.88m="" v="594"><10 bits).="" this,="" in="" terms="" of="" the="" actual="" voltage="" we="" are="" trying="" to="" measure,="" gives="" us="" now,="" of="" course,="" twice="" the="" granularity:="" 1.45="" v/594="2.44" mv="">10>
In summary, it can be stated that with the traditional way of adapting the analog signals to the full dynamic range of the A/D, external op amps are required. Depending on the application, the number of external op amps increases with the number of analog signals that need to be processed, resulting in a significant number of external components (op amps, resistors to set the amplification factors ,Vcc buffer caps) that increase system cost and required printed-circuit-board real-estate area. Where that is a critical factor, it can be addressed in two ways: integration and subminiature packaging technology. Before we take a closer look at the possibilities that integration provides, we take a short look at new subminiature package technology available for microcontrollers: chip scale packaging
National Semiconductor started offering its microcontrollers in a new package, called chip-scale package, (CSP) about a year ago. The package provides significant space saving when compared to traditional SO packages while giving a larger number of I/Os per available mm2 of board area. Especially when it comes to analog performance, the package offers distinct advantages, as pin inductance and capacitance are minimized because of the very short leads. At the same time, thermal performance of the package is superior because of a large heat-conductive contact surface with the pc board. Compared with a 44-pin plastic quad flat package, a 44-pin CSP package is 66 percent smaller (7x7x0.8 mm). The 28-pin CSP package is 68 percent smaller than a 28-pin TSSOP package and has about the same physical size as an 8-pin SO, but gives the user 24 I/Os versus the 4 I/Os of the SO8 package.
Figure 4: 44- and 28-pin CSP package in comparison to a 44-PLCC package
Integrating the op amps
Figure 5 below illustrates an implementation on one of National Semiconductor's COP8 microcontrollers, where a programmable gain amplifier has been integrated between the output of the on-chip analog input multiplexes and the 10-bit successive approximation A/D. The op amp is software programmable with different gain factors of 1, 2, 5, 10, 20, 50 and 100. It can also be bypassed. The op amp is designed with high-impedance rail-to-rail inputs and rail-to-rail output. The input offset of the op amp can be as much as 7 mV. For this reason, circuitry for trimming out the offset by the user has been provided. By doing two measurements, one with an amplification factor of 1 and one with 20, the user can trim the offset for both the n-channel and the p-channel input stage pairs in 0.5-mV steps. At the end of this calibration process the input offset voltage is 500 V or less. The analog input multiplexer supports seven inputs, with one dedicated to the on-chip temperature sensor, providing a total of six external analog inputs. Rather than requiring up to six external op amps and passive components for designs utilizing all those analog inputs, the implementation discussed here can handle all that functionality with the one integrated programmable gain op amp.
A second "standard" op amp is integrated with both inputs and its output accessible externally via the microcontroller's pins. This op amp can be utilized to implement an active filter function (e.g., noise filtering), an independent amplification or buffer stage, or other op amp function. In fact, the analog input multiplexer's output provides a path back to one of the input pins and a second input pin provides a direct connection to the 10-bit A/D input so that another, external, circuit can be inserted into the A/D conversion path. Using the second op amp, for example, an active low-pass filter could be implemented that is applied to all of the analog inputs.
Figure 5: Block diagram of on-chip op amps and A/D signal path
Figure 6 shows the block diagram of the COP8ALE microcontroller, a device with 8 kbytes of Flash memory, 512 bytes of RAM and three 16-bit multifunction timers. They support processor-independent PWM, capture and event counter modes at a resolution down to 50 ns, full duplex USART with integrated baud rate generator, Microwire three-wire synchronous interface, brown-out reset, clock doubler dual clock function. The virtual E2PROM features allows the user to dynamically allocate any desired amount of Flash program memory for data storage.
Figure 6: Block diagram of COP8ALE microcontroller with integrated op amps and temperature sensor
System development challenges
As beneficial as the integration of a programmable op amp and temperature sensors onto a microcontroller is in terms of external component count reduction, it creates a series of new challenges when it comes to application development, which usually involves the writing and debugging of code. The debugging of code usually involves a real-time, in-system emulator for the microcontroller, which allows the software developer to rapidly make changes to the code during the development phase and to check it out in the final end application. At the same time, the emulator provides powerful PC-based debugging tools that support capabilities like examining on-chip registers, setting breakpoints at defined points in the program flow and looking at a history of executed code (trace). Emulators today use one of two approaches, which for the purpose of this discussion we would like to call the probe card approach and the debug board approach.
The probe card approach uses a so-called base unit that is connected to a PC via the serial port. The base unit contains the majority of the emulator electronics, with the exception of the emulation chip itself. The emulation chip is a special bond-out version of the actual microcontroller and is mounted on a separate small circuit board, called a probe card. It connects via a ribbon cable to the base unit and has different socket adapters at the bottom; they allow the probe card to be plugged into the actual target application board. What this means for analog signals that connect to the microcontroller is that they have to travel from the target board, via a chip-socket, via another pin adapter socket on the probe card, via the board traces of the probe card to the actual microcontroller pins. One can easily see that this introduces additional noise, capacitance and inductance that make it impossible to obtain the same analog signal behavior during emulation as in the final production version where the microcontroller sits directly on the target board.
Figure 7: Probe-card-based emulator
The debug board approach combines all the emulator electronics and the actual emulation chip onto a larger board. The connection to the target system is accomplished by ribbon cables, which provide, on one end, a connector that can plug into an actual chip package socket. This means that all pin signals for the microcontroller to be emulated are now routed via this ribbon cable that connects the target system with the debug board, including any analog signals to be measured by the microcontroller. This is bad enough if already amplified analog signals are routed via such a cable--as additional noise, capacitance and inductance are introduced that falsify the original analog signal--but it becomes worse if the amplification is now done within the microcontroller and analog signals in the millivolt or even microvolt range are routed via such a cable. The results become unusable. Also, as analog functions, such as a temperature sensor, get integrated into a microcontroller, you want to measure the temperature at a specific point in the end application and not the ambient temperature of the debug board.
Another drawback of both the probe card and debug board approaches is that they require a specialized bond-out chip for each new microcontroller derivative. This makes the debug board or probe card specific to a given device, and a new probe card or debug board must purchased if new family members with new integrated features are introduced.
Figure 8: Debug-board-based emulator
The solution to the above problems comes with the advent of Flash program memory and a new approach in microcontroller emulation pioneered by National Semiconductor: 100 percent precise analog emulation. The electrical erase/write capability of Flash program memory, in combination with emulation support circuitry and code embedded in the microcontroller, means each chip can be its own emulator. This in turn means that a sample of the microcontroller chip, regardless of package, can be directly soldered into the target application. So now the microcontroller chip "sees" the same analog environment as the finalized application. Temperatures, for example, are measured where they are supposed to be measured and voltages in the microvolt to millivolt range that must be amplified only need to travel the shortest possible distance. The only connection now required to enable PC-based software debugging are four fully digital I/O pins of the controller, whose digital functions are "re-created" on a small piece of hardware that sits between the PC and the target system. This connection from the target board to the base is accomplished via a small 2*7 header on the target board that, at the same time, can be used to program and reprogram the controller in-system without the need for any additional programming support circuitry. As mentioned earlier, the chip is its own emulator, so that when a new family member is introduced no new emulator or probe card must be purchased--all that is required is a sample of the new chip and eventually a software update for the debugger software that runs on a PC.
Figure 9: The chip is its own emulator, 100 percent precise analog emulation
The integration of a programmable gain amplifier into the on-chip A/D signal path of a microcontroller can provide significant system cost savings. A number of external op amps and passive components, which are required today to utilize the full dynamic range of an A/D converter, can be eliminated. Along with new subminiature packaging technology, this not only reduces system cost, but at the same time can shrink the required board space by as much as 66 percent. However, as more and more analog functions are integrated into microcontrollers, traditional microcontroller emulation methodologies that were constructed for "digital" systems become less and less suitable for the task at hand. Only if the actual microcontroller chip can act as its own emulator can analog signal integrity be maintained throughout the development phase all the way to production.