CHAPTER 5 Using MCUs/DSPs to Increase Sensor IQ Backed by an increasingly powerful array of solid-state process technologies, integrated sensors are expected to be widely applied to extend microcomputer-based control in a variety of areas. —Kensall D. Wise, 1982 [1] 5.1 Introduction Several semiconductor technologies are available to improve the accuracy and quality of the measurements and to add diagnostics and other intelligence to any type of sensor. Foremost among these technologies are MCUs, DSPs, DSCs, ASICs, and FPGAs. Dedicated sensor signal processors are usually adaptations of one of these approaches. Some of these technologies also have the potential to allow for a fully integrated (monolithic) smart sensor. Before taking this step, it is important to understand the technologies that are available, their contribution to smart sensors, and their ability to provide a higher level of intelligence (and value) to sensors. 5.1.1 Other IC Technologies ASIC technology utilizes computer aided design (CAD) software tools to achieve custom circuit designs. ASIC technology consists of programmable logic devices (PLDs) for low-circuit density, gate arrays for medium density, and standard cells for high-end custom circuits. ASIC devices combine high density and integration of full custom designs with relatively low cost and fast design turn-around. A custom highly-integrated chip utilizing core microprocessor cells, combined with analog, memory, and additional logic functions, can address specific sensing requirements, such as fluid level sensing. Mixed-signal ASICs combine analog with digital capability. Field-programmable gate arrays (FPGAs) and field-programmable analog arrays (FPAA), analog versions of FPGAs, are attractive as sensor interfaces because they can minimize development time and they can be reconfigured after they have been in service. Both the FPGA and FPAA use a front-end circuit design program [2]. A circuit design is transferred to the FPGA (or FPAA) by either downloading converted serial data directly to the on-chip static random access memory (RAM) 85 86 Using MCUs/DSPs to Increase Sensor IQ in the FPGA or to the serial EPROM. A digital core incorporated in the FPGA design gives it the same kind of computing capability as an MCU with the advantages of field programmability. FPGAs are especially useful when rapid circuit prototyping and flexibility are required. The term system on a chip (SOC or SoC) is frequently used to describe a highly integrated circuit, ASIC, MCU, DSP, or DSC that incorporates considerably more hardware options than previously available versions. These chips frequently incorporate application-specific software that is closely linked to the hardware that is on the chip. These chips include a large and increasing amount of the system, and reduce they the total chip count. In only the more simple systems are they actually the whole system. This is especially true with the sensor portion of the system. The added complexity of adding the sensor to the SOC makes a sensor system on a chip more difficult but the difficulty is minimized with CMOS compatible MEMS processes. 5.1.2 Logic Requirements The shift of the logic requirements from a centralized computer to nodes in decentralized systems is creating the need for smart sensors. Sensor-driven process control systems that eliminate human operators and increase the precision of the process will play an important role in the manufacturing of the semiconductors that control them. Essential aspects of any sensor system include amplification, A/D conversion, a communications interface, and the computing portion. Amplification and A/D conversion were discussed in Chapter 4. The communications interface will be covered in Chapter 7. This chapter will use existing MCU, DSP, DSC, and FPGA products to demonstrate the remaining elements. 5.2 MCU Control Single-chip MCUs combine microprocessor unit (MPU) computing capability, various forms of memory, a clock oscillator, and I/O capability on a monolithic structure as shown in Figure 5.1 [3]. MCUs provide flexibility and quick time-to-market for numerous embedded control systems and for smarter sensing solutions. The programmability and wide variety of peripheral options available in the microcontroller provide design options. These options can offset the cost of the additional circuitry by eliminating other components or by providing features that would otherwise require far more components. In addition, high-volume MCUs enable systems to achieve low cost, high quality, and excellent reliability. To provide increasingly higher performance without sacrificing excessive power consumption, many suppliers offer MCUs with more than one core. The cores can either be identical or different. With their higher capability, multicore MCUs typically target more complex system controls. Within the overall control strategy, a sensor (or multiple sensors that need their data measured and analyzed with tight constraints) can take advantage of multicore MCUs. 5.3 MCUs for Sensor Interface 87 Figure 5.1 Basic microcontroller block diagram. 5.3 MCUs for Sensor Interface In addition to the basic features of a microcontroller, a number of custom modules are integrated on the same chip in order to increase the utilization of the process, reduce printed circuit board space, and increase the functionality for a specific application. MCU features that have a significant impact on sensor system performance will be discussed in this section. These include analog input capabilities, A/D conversion techniques, processing bandwidth, on-board memory, power conservation, and improved electromagnetic compatibility (EMC) and control of radio frequency interference (RFI). The same features, possibly with different specifications, perform similarly on 8-bit families of MCUs and higher performance 16-bit and 32-bit products as well. 5.3.1 Peripherals Existing MCU technology contains a variety of peripherals or hardware options that enhance the capability of the MCU. Peripherals enable the MCU to obtain information from sensors and control output devices. Some of the most common peripherals are general purpose input/output (I/O) ports, timers, and serial ports. Timers usually measure time relative to the internal clock on the chip or an externally provided clock signal. An on-chip oscillator that operates up to 4.0 MHz at 5V or 1 MHz at 3V controls the clock on the chip. A more complex timer can generate one or more PWM (pulse width modulated) signals, measure the pulse width, and generate additional output pulse trains. Three basic serial ports are the serial communications interface (SCI), the serial peripheral interface (SPI) and the Inter-Integrated Circuit (I2C) bus. The SCI 88 Using MCUs/DSPs to Increase Sensor IQ is a simple 2-pin interface that operates asynchronously. Data is transmitted on one pin and received on the other. Start and stop bits synchronize communications between two devices. The SCI port is a universal asynchronous receiver transmitter (UART) that can be used with an RS-232 level translator to communicate with personal or other types of computers over fairly long distances. The SPI port requires a third pin to provide the synchronizing signal between the control chip and an external peripheral. This type of communication is usually on the same board. Standard SPI peripherals are available from many manufacturers and include A/D converters, display drivers, electrically erasable programmable ROM (EEPROM), and shift registers. The I2C bus is a patented interface developed by NXP Semiconductors (formerly Philips Semiconductors) [4]. The half-duplex, synchronous, multimaster bus requires only two wires to transmit data (SDA) and clock (SCL) signals. The master communicates with individual slaves by using a 7-bit or 10-bit address. Initially defined with a maximum of 100 kbit per second (standard), a 400 kbit fast-mode and high-speed 3.4 Mbit option are now available, as well as a fast-mode plus transfer rate between the latter two. 5.3.2 Memory Various types of memory can be integrated on a chip, including RAM, ROM, EPROM, EEPROM, and flash memory. Semiconductor memory is based on a single transistor or cell that is on or off to generate a bit that is either a one or a zero. Memory is classified as either volatile or nonvolatile. Volatile memory is not stored when the power is disconnected to the MCU. Nonvolatile memory is stored when power is disconnected. The amount of memory in a chip is usually rated in kilobytes (1 KB = 1024 bits). Increasing the amount of memory increases the chip size and the chip cost. Some types of memory, such as EEPROM, can significantly increase the process complexity and also add to the cost. Random access memory (RAM) can be read or written (changed) by the central processing unit (CPU) and is volatile [3]. Read only memory (ROM) can be read but not changed. This nonvolatile memory is included in the design (masked layout) of the chip. Reprogramming a chip once it has been designed is a common practice to correct errors in the original software, to upgrade in order to improve system performance, or to adjust for variation that could have occurred since the system was initially installed. Erasable programmable ROM (EPROM) can be changed by erasing the contents with an ultraviolet light and then reprogramming new values. This nonvolatile memory has a limited number of erasure and reprogramming operations. One-time programmable ROM (OTP ROM) is the same as EPROM, except that it is packaged in a lower cost opaque package. Since ultraviolet light cannot penetrate the package, this memory cannot be erased after it is programmed. Electrically erasable programmable ROM (EEPROM), and frequently E2ROM, is a nonvolatile memory that can be changed by using electrical signals. Typically, an EEPROM location can be erased and reprogrammed thousands of times before it wears out due to field stress. The most common memory for control applications is flash memory. Nonvolatile flash memory is easily reprogrammed in the application and is done faster than EEPROM. Once it is programmed, flash memory contents remain intact until an 5.3 MCUs for Sensor Interface 89 erase cycle is initiated by the software. Program and erase voltages for EEPROM and flash are performed at approximately 12V. Two of the newest memory types are ferroelectric random-access memory (FeRAM or FRAM) and magnetoresistive random-access memory (MRAM). Both can be embedded in controllers. Unlike FeRAM, which is based on charge, MRAM uses the magnetic properties of materials. Table 5.1 compares four different types of memory [5]. The ferroelectric effect is the tendency of dipoles within a crystal to align in the presence of an electric field and to remain polarized after the field is removed [6]. Reversing the field causes polarization in the opposite direction. No current is required to maintain either state, which provides a binary memory capacitor with low power consumption. Advantages of FeRAM for sensing applications include: • Very fast write times (up to 20 times faster than EEPROM; • Write/erase endurance up to 10 million times greater than EEPROM; • Arrays up to eight times larger than prior versions; • Lower voltage, lower power operation to conserve battery life. One company has developed its MRAM process specifically for integration in SOC products, such as the combination of microcontrollers and MRAM on one chip [7]. MRAM can replace flash, EEPROM, and SRAM with a single nonvolatile fast memory with essentially unlimited endurance. Using a few added mask steps, MRAM can be embedded in the last two metal layers of standard CMOS logic processes. 5.3.3 Input/Output Input/output (I/O) is a special type of memory that senses or changes based on external digital elements and not the CPU [3]. I/O ports connect these external elements to the CPU and provide control capability for the system. I/O can be either parallel, transferring eight data bits at a time to the MCU, or serial, transferring data one bit at a time. Table 5.1 Comparison of Semiconductor Memories Property/Design DRAM Flash FeRAM MRAM Nonvolatility No Yes Yes Yes Storage layer Capacitor Floating gate Capacitor Magnetic tunnel junction Storage type Charge Charge Polarization Resistance Data retention 0 10 yr 10 yr 10 yr Write time 50 ns 1–2 μs 50–100 ns 10–50 ns Read time 50 ns 20–110 ns 50–100 ns 10–50 ns Cell size (relative) 1 0.8 1.3 <1 Endurance 10^5 10^12 – 10^15 10^12 (After: [5].) 10^15 90 Using MCUs/DSPs to Increase Sensor IQ General purpose I/O connections (pins) can either be used as an input or an output. A number of pins is typically grouped together and called a port. The program determines the function of each pin. Program instructions evaluate the logic state of each input and drive outputs to logic one or zero in order to implement the control strategy. Input-capture and output-compare functions in the MCU simplify the design of the control strategy. Input-capture is used to record the time that an event occurred. By recording the time for successive edges on an input signal, software can determine the period and/or the pulse width of the signal. Two successive edges of the same polarity are captured to measure a period. Two alternate polarity edges are captured to measure a pulse width [8]. Output-compare is used to program an action at a specified time. For example, an output is generated when the output-compare register matches the value of a 16-bit counter. Specific duration pulses and time-delay are easy to implement with this function. 5.3.4 On-Board A/D Conversion Various types of ADCs were discussed in Chapter 4. An ADC is frequently integrated with the MCU. For MCUs, the successive approximation register (SAR) is the most popular method of performing A/D conversions due to its fast conversion speed and ease of use with multiplexed input signals. An 8-bit ADC in 8-bit MCUs has a theoretical resolution of about 0.39%. For those instances where higher resolution is required, the SPI port of an MCU allows external circuitry to be interfaced. For example, an integrated circuit such as Linear Technologies’ LTC1290 connected to the SPI clock, data in, data out, and one additional programmable output pin of an MCU provides a 4-wire interface for a 12-bit data conversion. The data are transferred in two 8-bit shifts to the MCU in 40 μs. By adding the 12-bit capability, the resolution is improved from 0.39% to 0.0244%. Many modern 8-bit MCUs have higher resolution ADCs, including 10-bit, 12-bit, and even two independent 16-bit SARs. A 32-bit MCU demonstrates the additional capability and flexibility of higherperformance controllers. Designed to address the touch-screen controller (TSC) requirements of consumer electronic products, Freescale Semiconductor’s i.MX25 multimedia applications processor has an embedded 12-bit successive-approximation ADC. Figure 5.2 shows the clock diagram for generating the clock to the ADC. To eliminate the complexity of a multiclock domain, the ADC module uses only one root clock generated from the i.MX25 IPG clock. The i.MX25’s IPG root clock is typically 66.67 MHz, but in low-power mode, it can be reduced to 33.33 MHz or 16.66 MHz. Also, the clock control module (CCM), can gate the ADC module root clock on or off or the ADC clock can be gated off within the ADC module. 5.3.5 Power Saving Capability An advantage of the combination of MCU hardware and software is a variety of power saving approaches. Varying the processing speed or stopping processing 5.3 MCUs for Sensor Interface 91 Figure 5.2 ADC clock generation for the i.MX25 multimedia applications processor. (© Freescale, Inc. Used with permission [9].) altogether can have a significant impact on overall power consumption. In addition, the ability to operate at lower voltages also reduces the power consumption. Reducing the power consumption involves more than reducing the supply current while running processor code. For example, extending the life of battery-powered sensors and other circuitry requires keeping the average current consumption as low as possible [10]. As show in Figure 5.3, through short activation time for periodic measurements, an application can draw much more current and still have the average current consumption remain quite low and very close to the standby current level. Figure 5.3 The average current consumption increases only 1 µA with 1 mA activity for 1 ms. (Courtesy of Texas Instruments [10].) 92 Using MCUs/DSPs to Increase Sensor IQ 5.3.6 Local Voltage or Current Regulation On-board voltage or current regulation is important to sensors that are not ratiometric since the variation in supply voltage over a –40°C to 125°C operating range can be greater than ±5%. The availability of analog control circuitry with high voltage (e.g., 40V or higher) standoff capability allows the integration of a series pass 5V regulator on the MCU [11]. Availability of a similar shunt regulator allows a two-wire self-protected and self-powered system to be designed using only a sensor and an MCU. At higher levels of integration, such as analog voltage and/or current regulation, can both reduce component count and improve accuracy. Furthermore, these regulation schemes can be dynamically altered to improve functionality or reduce power consumption. 5.4 DSP Control DSPs have a hardware arithmetic capability that allows the real-time execution of feedback filter algorithms. In contrast, MCUs use look-up tables to approximate filter algorithms with inherent limitations of flexibility and accuracy. A DSP that executes instructions in less than 100 ns allows a peak execution rate of 20 millions of instructions (or integer operations) per second (MIPS). DSPs are also rated in millions of operations per second (MOPS), where the MOPS rating is several times the MIPS rating. Initial distinguishing characteristics of DSPs include a multiplier or multiply accumulator (MAC) for arithmetic calculations and floating-point unit processing for high dynamic range. However, this has changed over the years. Fixed-point DSPs are quite common today. While many DSPs address high processing power, some also target low-power, cost-sensitive applications, such as portable products [12]. With performance up to 300 MHz for 600 MIPS, Texas Instruments’s C5000 DSP platform provides low power consumption, a high level of peripheral integration, and large on-chip memory to reduce overall system cost. The fixed-point 16-bit DSP includes: • Total active core power at less than 0.15 mW/MHz at 1.05V; • 1–3 low-dropout regulators (LDOs) enable integrated power management; • Standby power at less than 0.15 mW; • On-chip memory options ranging from 64 KB to 320 KB. The need for real-time processing in several systems dictates the need for DSP technology for that portion of the control function. This growing class of functions cannot work effectively with traditional table look-up and interpolate functions to make the control decision. Instead, the MAC unit allows state estimator functions to be implemented with an algorithm defining the state. However, MCUs historically excelled at system control, especially related to timing and sequencing operations. With the increasing need for the capabilities of both an MCU and a DSP, the line between the two has somewhat blurred. For example, Analog Devices Blackfin 16/32-bit processor family is classified both as an MCU and a DSP. The family combines a 32-bit reduced instruction set computing (RISC)-like instruction 5.4 DSP Control 93 set to perform smaller number of instructions at higher speeds and dual 16-bit MAC [13]. Many devices combine an MCU core with a DSP core, such as Texas Instruments’s DaVinci TMS320DM644x and TMS320DM646x, which are both DSPbased devices that are optimized for video/display applications with an ARM9 processor for control functions. The use of the MCU versus the DSP portion can impact the performance of an integrated MCU-DSP. For example, Infineon’s 32bit TriCore MCU-DSP with a 100 MHz core has a sustained 130 MIPs rating and delivers 80 MCU MIPs plus 50 DSP MIPs, or 40 MCU MIPs plus 90 DSP MIPs, depending on the implementation of load sharing in software [14]. 5.4.1 Digital Signal Controllers DSCs are another evolution of DSP technology. In contrast to DSPs that address high-speed processing, DSCs typically target low-speed processing. I/O specific peripherals in DSCs allow them to address sensing requirements in consumer electronics and motor control applications. Definitions of the capabilities of DSCs vary from supplier to supplier. Texas Instruments defines DSCs as “processors that combine the high-performance math and algorithmic capabilities of a DSP with the peripheral, memory integration and ease-of use of traditional microcontrollers (MCUs)” [15]. DSCs have become very popular for computationally-intense sensing applications. Using DSCs, engineers can more efficiently perform many system-level tasks. These include: filtering sensor signal noise, improving signal-to-noise ratio, compensating for sensor degradation over time, and dealing with sensor-to-sensor variability [15]. However, the continued need for MCU functionality in control systems has also blurred the distinction between these controllers. Figure 5.4 shows a block diagram for Microchip Technology’s dsPIC33E DSC and PIC24E MCU for motor control and general purpose applications where one aspect of the core of the separates one device from the other [16]. In addition to the DSP engine that is only in the DSC, the barrel shifter that manipulates data, especially in arithmetic operations associated with DSP operation, is not offered in the MCU. 5.4.2 Field Programmable Gate Arrays FPGAs are another approach to obtain DSP functionality. The highly configurable hardware of FPGAs can provide distributed DSP resources. As shown in Figure 5.5, four different tasks are handled by separate DSPs with their own memory and I/O [17]. This level of computing power and the ability to have it quickly for both development and production volumes has become an enabler for radar sensing and vision sensing in high-end vehicles [18, 19]. For example, an FPGA evaluation board with four cameras can provide a surround view system or can be decoupled into multiple systems, including rear view parking and blind spot detection. 5.4.3 Algorithms Versus Look-Up Tables MCUs use look-up tables to store values that are accessed when the program is running. Algorithms are used to correct for variations from expected results and to 94 Using MCUs/DSPs to Increase Sensor IQ Figure 5.4 In this block diagram for an MCU and DSC, the only aspects separating the two are the DSP engine and barrel shifters that are only in the DSC. (© Microchip Technology, Inc. [16]). Figure 5.5 An FPGA’s DSP resources are allocated to separate tasks that run independently. (Source: Altera [17].) implement a control strategy. The speed of accessing the information from a table or performing a calculation determines the response time of the sensor input to the MCU/DSP portion of the system. This can be the limiting factor to initiating a change to the output in an MCU/DSP-controlled system. 5.5 Techniques and Systems Considerations 95 A control/sensor combination can implement an electronically programmable trim as an alternative to laser trimming. However, all trimming and calibration processes for a sensor require some form of data conversion by the MCU or DSP. The time it takes to perform these conversions by mathematical calculations or get data from a look-up table must be within the control system’s ability to respond to the sensed input. In the application, real-time trimming can be implemented in order to allow adaptive control at the sensor level. This will improve the accuracy of a sensor that has drifted after some time in operation. 5.5 Techniques and Systems Considerations Increased precision can be obtained for sensors by characterizing devices over temperature and pressure (or acceleration, force, etc.) and storing correction algorithms in MCU memory. The MCU can convert the measurement to display different units (i.e., psi, kPa, mmHg, or inches of water for pressure measurements). Other techniques use the MCU’s capability to improve linearization, to provide PWM outputs for control, and to provide auto-zeroing/auto-ranging. The operating frequency and switching capability of the MCU must be considered in system design. Lastly, the MCU’s computing capability can be used in place of sensor(s) when sufficient information exists. These system aspects will be explored in this section. 5.5.1 Linearization Sensor nonlinearity can be improved by the use of table look-up algorithms. The variation in sensor signal caused by temperature can also be improved by using an integrated temperature sensor and a look-up table to compensate for temperature effects while linearizing the output, nulling offsets, and setting full-scale gain from information stored in an EEPROM or flash memory. Look-up tables can be implemented in masked ROM, field programmable EPROM, onboard EEPROM, or flash memory. Compensation for nonlinearity and the number of measurements during the test and calibration procedure can be simplified if a nonlinear output correlates with a sensor design parameter. For example, a strong correlation was found between the span and linearity of a pressure sensor with a thin diaphragm [20]. As Figure 5.6 shows, the nonlinearity increased to almost 5% with the highest span units. Analytical techniques were investigated to improve the nonlinearity. A polynomial regression analysis was performed on 139 sensor samples ranging from 30 to 70 mV full scale span to determine the coefficients B0, B1, and B2 in the formula: ( ) Vout = Voff + B0 + B1 * P + B2 * P 2 + B3 * P 3 + (5.1) where B0, B1, B2, and B3 are sensitivity coefficients. The second order terms were sufficient for calculations to agree with measured data with a worst case value for calculated regression coefficient = 0.99999. The relationship of these values to the span allowed a piece-wise linearization technique with four windows to reduce the linearization error of most sensors to less than 0.5%. These calculations could be 96 Using MCUs/DSPs to Increase Sensor IQ Figure 5.6 Span versus linearity for pressure sensor output. included in the MCU look-up table for improved accuracy in an application. Others have also investigated linearization in great detail as a general means to improve sensor accuracy [21, 22]. 5.5.2 PWM Control The pulse width modulation (PWM) output from the MCU can be used to convert an analog sensor output to a digital format for signal transmission in remote sensing or noisy environments [23]. Figure 5.7 shows the simple, inexpensive circuitry used to create a duty cycle that is linear to the applied pressure. The MCU-generated pulse train is applied to a ramp generator. The frequency and duration of the pulse can be accurately controlled in software. The MCU requires input-capture and output-compare timer channels. The output-capture pin is programmed to output the pulse train that drives the ramp generator, while the input-capture pin detects edge transitions to measure the PWM output pulse width. The pulse width changes from 50 to almost 650 μs for zero to full scale output for this sensor. 5.5.3 Autozero and Autorange Combining a sensor and an MCU to perform a measurement that otherwise would be less accurate or more costly than other available alternatives is feasible today. The cost of many MCUs is comparable or lower than the micromachined sensors that provide their input signal. For example, a signal conditioned pressure sensor has been combined with an MCU to measure 1.5 inch or less of water with an accuracy of 1% of the full scale reading [24]. The MCU provides software calibration, software temperature compensation, and dynamic-zero capability. Also, a digital output compatible with the SPI protocol is provided for the pressure measurement. 5.5 Techniques and Systems Considerations 97 Figure 5.7 PWM output pressure sensor schematic. Auto referencing can be performed by the MCU to correct for common-mode errors, especially with low-level signals. Auto referencing uses the MCU logic and clock signal, combined with a digital-to-analog converter (DAC) and counter. A signal from the MCU initiates the counter. The DAC provides a sample-and-hold and programmable voltage source. The sensor output is summed with the autoreference correction at the input of an amplifier to obtain a corrected output to the system. A calibration-free method for pressure sensors has been designed using a calibrated pressure sensor, an MCU with integral A/D converter, and two additional ICs [25]. As shown in Figure 5.8, two input channels (for V1 and V2) and one output port (P) are used in the calibration portion of this system. The analog switches provide voltages V1 and V2 that are converted and stored in registers in the MCU. The switches are then put in the opposite direction and the new values are stored. The MCU adds the differential results that becomes and input to the A/D converter. All errors from the instrument amplifier are canceled in this circuit using the differential conversion. For a measurement that only requires a full scale accuracy of ±2.5%, the offset of the pressure sensor can be neglected and the system does not require any calibration procedure. For a ±1% measurement, the full scale output is set at 25°C. 98 Using MCUs/DSPs to Increase Sensor IQ Figure 5.8 Calibration-free pressure sensor system. (© Freescale, Inc., 2012. Used with permission [25].) 5.5.4 Diagnostics One of the more valuable contributions that digital control can make to the sensor’s functionality is the ability to self test, analyze status, diagnose, and report problems to an operator or other systems that use the sensor’s output. The problem could be as simple as a warning for maintenance, or calibration or an indication of catastrophic failure that would not allow the system to function when required. For example, an automotive air bag system may operate for years without requiring deployment. However, knowing that the sensor is capable of providing the signal to indicate a crash event is part of the safety that the system can routinely provide to the driver and passenger. In the air bag system, a dash indicator lamp is activated by the MCU to indicate that it has performed a system-ready analysis. A lamp that stays on or flashes indicates that the MCU has detected a fault and that the system needs servicing. 5.5.5 Reducing EMC/RFI Radiated radio frequency interference (RFI) and electromagnetic interference (EMI)—both the transmitting and receiving of unwanted signals or electromagnetic compatibility (EMC)—of a device is becoming an important design consideration with increasingly higher levels of system integration and higher processing bandwidths. These problems can be reduced at the component level with smaller radiation loops and a smaller number of signal lines. Power management in the MCU can also eliminate some self-induced effects that generate RFI to the sensor element. An example of power management is called “quiet time sampling.” This circuit technique performs analog switching when digital switching is not present [26]. Cleaner samples of data are taken by halting high current, high frequency activity while the sensor input is being measured. Normal digital processing functions continue once these values are in memory. 5.5.6 Indirect (Computed not Sensed) Versus Direct Sensing Inputs to the MCU can be manipulated to provide additional data for a system. For example, the MCU can use an input pressure signal to provide maximum pressure, 5.6 Software, Tools, and Support 99 minimum pressure, an integrated (averaged) pressure, and time-differentiated pressure data to a system. An accelerometer signal processed by a signal processor can be integrated once to provide velocity and twice to provide displacement information. Also, a single sensor input to an MCU can replace several switches sensing the same parameter and can provide programmable switch points for outputs. The ability to compute rather than sense is among the solutions that MCUs bring to control applications. For example, in three-phase motor control systems, a Hall-effect sensor is used to sense the location of the magnetic field for each phase or the rotor speed in induction motors. An MCU uses this signal to switch output drivers for pulse-width modulated control. The sensors in this system have been a target for cost reduction for many years. Popular solutions have eliminated the sensors (this is called a sensorless technique) by using the MCU to compute the rotor speed and slip angular frequency from other available information, including the primary resistance [27]. 5.6 Software, Tools, and Support Creating a new approach or alternative to existing control technologies requires much more than the architecture. The software that is used to program the control portion and tools that allow the system to be developed are equally important. Portable code (software compatibility) is essential if future end products may require migration to a higher performance MCU or to a DSP/DSC. Keeping the sensor’s design and process simple and separate from the MCU or DSP allows the implementation with several available processors. One of the main advantages of using existing MCUs, DSCs, or DSPs is the development tools that already exist and allow the designer to quickly and easily develop both system hardware and software. In many cases, the tools and processor are familiar to experts in the design community; the capabilities and limitations are well-understood. The tools include software tools, compliers, and debuggers. Many suppliers offer USB design tools that can address sensor applications. The development tools and the documentation that has been established over several years of customer usage are available for many suppliers for MCUs, DSPs, and DSCs. As a result, the capability exists to develop the smartest sensor that can be defined today. 5.6.1 Design-in Support Touch screen sensing is one of the increasingly popular techniques for human machine interface, especially on portable products. This capability is enabled specifically by MCUs. There are several approaches to perform the sensing. As shown in Figure 5.9, a mutual capacitance approach to sensing provides more sensors and more accurate results than a self-capacitance technique [28]. This is because self-capacitance produces an ambiguity of the touch point, or what is sometimes called a ghost pattern, because two fingers on one line provide the same results as a single finger. In contrast, with the mutual capacitance design, each XY intersection on the screen is individually addressed so all touch points are unam- 100 Using MCUs/DSPs to Increase Sensor IQ Figure 5.9 Self-capacitance versus mutual capacitance in touch screen sensing. (Courtesy of Atmel [28].) biguously sensed. Implementing this technology requires an MCU such as Atmel’s mXT224 maXTouch touchscreen controller. The mXT224 is a 224-node highly configurable touchscreen controller with a touch response greater than 250 Hz that delivers 12-bit × 12-bit resolution. The EVK-mxt224A kit allows evaluation of the capacitive-to-digital conversion (CDC) technique and the overall performance of the chip [29]. The modular kit includes a 4.3-inch touchscreen and printed circuit board with the mXT224 that can be connected to a PC through a USB connection. PC software allows the evaluation the full range of configuration options including the device’s multitouch and built-in gesture capabilities. In addition, the kit has comprehensive documentation and a quick start guide to simplify the evaluation. 5.7 Sensor Integration The fourth level in advancing integration (refer to Figure 1.7) combines a CMOScompatible sensor with integrated analog and digital circuitry. Through wafer-level packaging, several companies have products that combine the digital computing portion with a MEMS sensor. The die size does not increase if the MEMS structure is built over the CMOS logic used for the MCU or DSP as part of the CMOS fabrication process. For example, the MEMSIC MXC6226XC dual-axis thermal accelerometer has integrated signal conditioning circuitry including a DSP [30]. As shown in Figure 5.10, in addition to the DSP, the integrated circuitry includes amplification and ADC, sensitivity thermal compensation and fine gain adjust control, an I2C interface, and more. This is a sensor with an integrated DSP for improving the sensors operation in the system and not a DSP with an integrated sensor. An alternative approach to integrating digital control with the sensor is shown in Figure 5.11. In this case, the MPL3115A2 has a separate pressure sensor and a dedicated ASIC integrated side-by-side in the same package [32]. The digital signal processing and control and trim logic blocks are the digital portion of the ASIC, and the rest of the blocks are analog circuitry. For high accuracy in barometric measurements, the circuitry has 20-bit resolution to detect altitude changes as low as 0.3m. The I2C output operates up to 400 kHz. Power management in the control circuitry has a standby mode current draw of 2 μA or 8.5 μA at 1 Hz in the 5.8 Application Example 101 Figure 5.10 The block diagram of the MXC6226XC shows how a dual-axis sensor is combined with a DSP. (Courtesy of MEMSIC, Inc., [31].) low-power mode. Because the unit handles communications, power management, and algorithms for the sensing application, these functions are offloaded from a host MCU. 5.8 Application Example Electrically-powered cars and trucks, such as electric vehicles (EVs), hybrid electric vehicles (HEVs), and plug-in hybrid electric vehicles (PHEVs) require advanced MCU technology to control their traction motors. For the highest overall efficiency, the motors use Field Oriented Control (FOC) to generate sinusoidal commutation [personal e-mail communication from Renesas, March 14, 2012]. This commutation process requires the transformation of two motor phase currents into the Iq and Id components of the torque and flux vectors using Clarke and Park transforms. The Park transform and the inverse Park transform used in the PWM control algorithm require the current rotor position as an input. While it is possible to use a sensorless design (see Section 5.5.6) and estimate the rotor position fed to the Park transform, the inaccuracy would reduce the efficiency. Consequently, traction motor applications always use a position sensor. Because a resolver (an electromagnetic induction-type angular sensor) generates very accurate position information in fractions of a degree resolution, even when stopped, it is usually the sensor of choice. To provide smooth operation, a traction motor accelerating from stall under a high torque load requires very accurate rotor position information that most encoders would be incapable of providing. Figure 5.12 shows a block diagram of the inverter control circuit for the threephase motor [33]. An MCU designed specifically for the control of these motors integrates the resolver to digital (RD) converter, as well as several additional application peripherals. These include excitation signal generating function timer pattern buffer (TPBA), a high-precision motor control timer (TSG2), ADC with 102 Using MCUs/DSPs to Increase Sensor IQ Figure 5.11 Package-level integration (a) combines sensing and (b) DSP/DSC capability. (Courtesy of Freescale, Inc., 2012. Used with permission [32].) synchronized sample-and-hold function, and three-phase PWM timer. The 32-bit RISC MCU uses a dual-core lockstep system that continually calculates and detects failures to make it compliant with the newest ISO 26262 safety standard for vehicles. 5.9 Summary Trends in the development of microelectronics for MCUs, DSPs, DSCs, ASICs, and FPGAs have been for faster, more complex signal processing and reduced feature 5.9 Summary 103 Figure 5.12 The V850E2/PJ4-E with an integrated resolver-digital (R/D) converter simplifies the system and reduces design costs associated with accurately sensing rotor position. (Courtesy of Renesas [33].) size (critical dimensions) into the sub-μm range. These goals have lead to lower supply voltages (3.3V and less). In addition, customer requirements for increased and more easily programmed memory and reduced development cost and system design cycle time continue to affect the design and methodology used to create these products. The resulting improvements can be useful in the development of smart sensors and can be cost-effective by using other capabilities provided by the MCU, DSP, DSC, ASIC, or FPGA. Communicating the data from smart sensors is among the capabilities that can be integrated on chip and is such a critical part that Chapter 7 will be dedicated to this aspect of the control logic. References [1] [2] [3] [4] [5] [6] [7] Wise, K. D., “Integrated Sensors: Interfacing Electronics to a Non-Electronic World,” Sensors and Actuators, Vol. 3, 1982, pp. 229–237, July 1982, http://deepblue.lib.umich.edu/ handle/2027.42/24532. Jacobsen, E., “Signal Conditioning a Pressure Sensor with a Field-Programmable Analog Array,” Sensors, 1997, pp. 81–86. Sibigtroth, J. M., Understanding Small Microcontrollers, Motorola Technical Bulletin M68HC05TB/D Rev. 1, 1992. http://www.i2c-bus.org/. Namseog K., presentation at IMAPS International Conference and Exhibition on Device Packaging, March 5–8, 2012 Fountain Hills, AZ. “FRAM makes a comeback,” Portable Design, 1996, pp. 14–16. Technology: Embedded MRAM Process, Everspin Technologies website: http://www. everspin.com/technology.php?qtype=5. 104 Using MCUs/DSPs to Increase Sensor IQ [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] M68HC05 Microcontroller Applications Guide, Motorola M68HC05AG/AD. i.MX25 Integrated Analog-to-Digital Converter, Freescale Semiconductor AN3948, http:// cache.freescale.com/files/dsp/doc/app_note/AN3948.pdf. “Choosing An Ultralow-Power MCU,” Texas Instruments Application Report SLAA207,2004, http://www.ti.com/lit/an/slaa207/slaa207.pdf. Frank, R., J. Jandu, and M. Shaw, “An Update on Advanced Semiconductor Technologies for Integrated Smart Sensors,” Proc. of Sensors Expo West, Anaheim, CA, February 8–10, 1994, pp. 249–259. http://www.ti.com/lsds/ti/dsp/platform/c5000/device.page. Blackfin Processor Architecture Overview,” Analog Devices website: http://www.analog .com/en/processors-dsp/blackfin/processors/blackfin_architecture/fca.html. TriCore Unified Processor, Infineon Technologies brochure: http://www.infineon.com/dgdl/ archintro_1.pdf?folderId=db3a304412b407950112b40f8bdc1426&fileId=db3a304412b 407950112b40f8bf61427. “Digital Signal Controllers for Advanced Sensing and Measurement Applications,” Texas Instruments Product Bulletin, http://www.ti.com/lit/ml/sprt301b/sprt301b.pdf. Microchip Technology website: http://www.microchip.com/pagehandler/en-us/press-release/microchips-new-dscs-mcus-bring.html. FPGA vs. DSP Design Reliability and Maintenance,” Altera White Paper: http://www.altera.com/literature/wp/wp-01023.pdf. Lal, S., et al, “An FPGA-based signal processing system for a 77 GHz MEMS tri-mode automotive radar,” Dept. of Electr. & Comput. Eng., Univ. of Windsor, http://ieeexplore.ieee. org/xpl/freeabs_all.jsp?arnumber=5929968. “Four Cameras and Xilinx FPGA Provide Surround View for Vehicles,” http://www.sensortips.com/tag/xilinx/. Derrington, C., “Compensating for Nonlinearity in the MPX10 Series Pressure Transducer,” AN935 in Sensor Device Data / Handbook, DL200/D Rev. 4, 1998. Hille, P., R. Hohler, and H. Strack, “A Linearisation and Compensation Method for Integrated Sensors,” Sensors and Actuators, Vol. A, No. 44, 1994, pp. 95–102. Heintz, F., and E. Zabler, “Application Possibilities and Future Chances of ‘Smart’ Sensors in the Motor Vehicle,” 890304 in SAE Sensors and Actuators SP-771, 1989. Jacobsen, E., and J. Baum, “Using a Pulse Width Modulated Output with Semiconductor Pressure Sensors,” AN1518 in Sensor Device Data/Handbook, DL200/D Rev. 4, 1998. Ajluni, C., “Pressure Sensors Strive to Stay on Top,” Electronic Design, October 3, 1994, pp. 67–74. Burri, M., “Calibration Free Pressure Sensor System,” Freescale Semiconductor, AN1097 Rev. 3, 05/2005, http://cache.freescale.com/files/sensors/doc/app_note/AN1097.pdf. Benson, M., et al., “Advanced Semiconductor Technologies for Integrated Smart Sensors,” Proceedings of Sensors Expo ‘93, October 26–28, 1993, pp. 133–143. Kanmachi, T., and I. Takahashi, “Sensor-Less Speed Control of an Induction Motor,” IEEE Industry Applications Magazine, January/February 1995, pp. 22–27. Bijaj, B., “Multi-Touch Technologies Evolve to Meet the Demands of Larger Screens,” Electronic Design website: http://electronicdesign.com/article/components/ multi-touch-technologies-evolve-to-meet-the-demands-of-larger-screens. EVK-mxt224A kit, Atmel’s website: http://www.atmel.com/tools/EVK-MXT224A.aspx. “MEMSIC Introduces World’s Smallest and Most Robust Digital Accelerometer with Features Never Before Available at This Price-Point,” MEMSIC website: http://investor.memsic.com/releasedetail.cfm?ReleaseID=619035. “Ultra Low Cost ACCELEROMETER: Chip Scale Packaged Fully Integrated Thermal Accelerometer,” MEMSIC MXC622xXC Data Sheet. 5.9 Summary [32] [33] 105 “MPL3115A2: Xtrinsic Smart Pressure Sensor,” Freescale Semiconductor website: http:// www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPL3115A2. V850E2/Px4-E, Renesas website: http://am.renesas.com/products/mpumcu/v850/ V850e2px/v850e2px4e/index.jsp.