Circuit Note CN-0281 Devices Connected/Referenced Circuits from the Lab™ reference circuits are engineered and tested for quick and easy system integration to help solve today’s analog, mixed-signal, and RF design challenges. For more information and/or support visit www.analog.com/CN0281. ADuC7060/ ADuC7061 ARM7-Based Microcontroller with Dual 24-Bit Σ-Δ ADCs ADT7311 ±0.5°C Accurate ,16-Bit Digital SPI Temperature Sensor AD8628 Precision, Low Power, Zero Drift Op Amp ADP7102 Low Dropout Linear Regulator Automotive SENT Interface-Based Thermocouple Temperature Sensor with Cold Junction Compensation Using the ADuC7060/ADuC7061 Precision Analog Microcontroller EVALUATION AND DESIGN SUPPORT Design and Integration Files Schematic, Layout Files, Source Code CIRCUIT FUNCTION AND BENEFITS This circuit uses the ADuC7060 or the ADuC7061 precision analog microcontroller in an accurate thermocouple temperature monitoring application. The ADuC7060/ADuC7061 integrate dual 24-bit sigma-delta (Σ-Δ) analog-to-digital converters (ADCs), dual programmable current sources, a 14-bit digital-to-analog converter (DAC), and a 1.2 V internal reference, as well as an ARM7 core, 32 kB flash, 4 kB SRAM, and various digital peripherals such as UART, timers, serial peripheral interface (SPI), and I2C interfaces. In the circuit, the ADuC7060/ADuC7061 are connected to a thermocouple and a 100 Ω platinum resistance temperature detector (RTD). The RTD is used for cold junction compensation. As an extra option, the ADT7311 digital temperature sensor can be used to measure the cold junction temperature instead of the RTD. In the source code, an ADC sampling rate of 4 Hz was chosen. When the ADC input programmable gain amplifier (PGA) is configured for a gain of 32, the noise-free code resolution of the ADuC7060/ADuC7061 is greater than 18 bits. The single edge nibble transmission (SENT) interface to the host is implemented by using a timer to control a digital output pin. This digital output pin is then level shifted externally to 5 V using an external NPN transistor. An EMC filter is provided on the SENT output circuit as recommended in Section 6.3.1 of the SENT protocol (SAE J2716 Standard). The data is measured as falling edge to falling edge, and the duration of each pulse is related to the number of system clock ticks. The system clock rate is determined by measuring the SYNC pulse. The SYNC pulse is transmitted at the start of every packet. More details are provided in the SENT Interface section. CIRCUIT DESCRIPTION The following features of the ADuC7060/ADuC7061 are used in this application: • • • • • • • • A primary, 24-bit Σ-Δ ADC with a PGA. The PGA is set for a gain of 32 in the software for this application. The primary ADC was switched continuously between sampling the thermocouple and the RTD voltages. If an RTD is used for measuring the cold junction temperature, programmable excitation current sources force a controlled current through the RTD. The dual current sources are configurable in 200 µA steps from 0 µA to 2 mA. For this example, a 200 µA setting was used to minimize the error introduced by the RTD self-heating. If the ADT7311 is used for measuring the cold junction temperature, the SPI interface is used in master mode to connect the ADT7311 slave device. An internal 1.2 V reference for the ADC in the ADuC7060/ ADuC7061. For measuring the thermocouple voltage, the internal voltage reference was used due to its precision. An external voltage reference for the ADC in the ADuC7060/ ADuC7061. For measuring the RTD resistance, a ratiometric setup was used where an external reference resistor (RREF) was connected across the external VREF+ and VREF− pins. The AD8628 single supply op amp was used to buffer the high impedance reference voltage across RREF to the ADC. The OP193 is another option instead of the AD8628. A DAC that was used to set the thermocouple commonmode voltage to 850 mV above ground. Rev. A Circuits from the Lab™ circuits from Analog Devices have been designed and built by Analog Devices engineers. Standard engineering practices have been employed in the design and construction of each circuit, and their function and performance have been tested and verified in a lab environment at room temperature. However, you are solely responsible for testing the circuit and determining its suitability and applicability for your use and application. Accordingly, in no event shall Analog Devices be liable for direct, indirect, special, incidental, consequential or punitive damages due to any cause whatsoever connected to the use of any Circuits from the Lab circuits. (Continued on last page) One Technology Way, P.O. Box 9106, Norwood, MA 02062-9106, U.S.A. Tel: 781.329.4700 www.analog.com Fax: 781.461.3113 ©2012–2013 Analog Devices, Inc. All rights reserved. CN-0281 • • • • Both the thermocouple and the RTD generate very small signals; therefore, a PGA is required to amplify those signals. As the auxiliary ADC on the ADuC7060/ADuC7061 does not have a PGA, both were connected to the primary ADC, and switching between the two was done in software. An ARM7TDMI® core. The powerful 16-/32-bit ARM7 core with integrated 32 kB flash and SRAM memory runs the user code that configures and controls the ADC, processes the ADC conversions from the RTD, and controls the communications over the SPI interface. Timer1 and a digital output pin are used to generate the SENT output signal. An optional PESDLIN protection diode for suppression of ESD, electrical fast transients (EFT), and surge transients up to 23 kV. An EMC filter on the SENT output as recommended in Section 6.3.1 of the SAE J2716 standard (SENT Protocol). Two external switches are used to force the part into its flash boot mode. By holding S1 low and toggling S2, the ADuC7060/ADuC7061 enter boot mode instead of normal user mode. In boot mode, the internal flash can be reprogrammed through the UART interface. 5V PWRIN DVDD ADP7102 10Ω VIN VOUT GND 0.1µF The RTD was used for cold junction compensation. In this circuit, a platinum, 100 Ω RTD, Enercorp PCS 1.1503.1 was used. It is available in a 0805 surface-mount package. This RTD has a temperature variation of 0.385 Ω/°C. Note that the reference resistor, RREF, should be a precision 5.6 kΩ (±0.1%). AVDD AVDD BEAD (ADJ) The thermocouple used in this application is a Type T (copperconstantan), which has a temperature range of −200°C to +350°C. Its sensitivity is approximately 40 µV/°C; therefore, in bipolar mode, the ADC, with a PGA gain of 32, can cover the entire temperature range of the thermocouple. 0.1µF 1.6Ω 5V PWRIN 0.1µF 0.1µF 2.5V DVDD 10kΩ 4.7µF AVDD SENT R1 DVDD AVDD IEXC0 100Ω Pt RTD ONLY REQUIRED FOR ADT7311 TEMPERATURE SENSOR OPTION PWRIN (ADJ) 10Ω PESD1LIN P0.0 ADuC7061 PWRIN 0.1µF P0.1 AD8628 SPI VREF+ RREF 5.6kΩ (0.1%) P0.2 P0.3 VREF– 2.7V P0.0 SCLK P0.1 DOUT VDD ADT7311 SPI P0.2 DIN P0.3 CS THERMOCOUPLE JUNCTION C2 ADC1 0.1µF VOUT GND 0.1µF C1 ADC0 ADP7102 VIN 2N3904 0.1µF 2.7V 10Ω P0.4 10Ω 10Ω ADC2 0.1µF RESET S2 10Ω ADC3 0.1µF NTRST S1 DAC0 P1.0/SIN P1.1/SOUT GND 5V PROGRAMMABLE INTERFACE Figure 1. ADuC7060/ADuC7061 as a Temperature Monitor Controller with a Thermocouple Interface (Simplified Schematic, All Connections Not Shown) Rev. A | Page 2 of 6 10889-001 • Circuit Note Circuit Note CN-0281 SENT Interface Code Description The SENT interface is a single pin, unidirectional (sensor to host), time modulated signal used mainly in automotive systems for interfacing distributed sensors to host CPUs. Timer1 is used to control the SENT output pin, P0.4. When a temperature result is been calculated from the ADC results for the thermocouple and the cold junction temperature, the SENT packet structure, SENT_PACKET, is updated, and Timer1 started. The fields of the structure are clocked out on the P0.4 pin, as shown in Figure 2. The first stage of the packet is the sync sequence. The host determines the clock period from this pulse, and it determines the subsequent nibble values from this. The main requirements for SENT include the following: • • • It must have a 0 V to 5 V signal swing with EMC filtering. The clock used for the SENT signal must be accurate to ±20%. The SENT output circuit must be robust enough to tolerate short circuit to ground and short circuit to supply voltages. The associated source code uses the P0.4 digital pin of the ADuC7061 as the SENT output pin. The packet format used is the single sensor packet format as detailed in A.4 section of the SAE J2716 standard (SENT Protocol) document. The source code, particularly the SENT.h and Sent.c files can be modified to support other packet formats. The overall temperature result is returned in /°C format in Data Nibble 1 to Data Nibble 3. In summary, the returned output packet is • • • • • • • • First, the voltage between the two wires of the thermocouple (V1) is measured. Then, the RTD voltage is measured and converted to a temperature via a lookup table. This temperature is then converted to its equivalent thermocouple voltage (V2). V1 and V2 are then added to give the overall thermocouple voltage, and this value is then converted to the final temperature measurement. 56 clock ticks for sync pulse Status pulse (7 ticks to 15 ticks) Data Nibble 1 (Bit 11 to Bit 8 of the temperature result) Data Nibble 2 (Bit 7 to Bit 4 of the temperature result) Data Nibble 3 (Bit 3 to Bit 0 of the temperature result) Data Nibble 4 (Bit 7 to Bit 4 of the counter) Data Nibble 5 (Bit 3 to Bit 0 of the counter) Data Nibble 6 (inverse of Nibble 1) A piecewise linearization scheme is used to calculate the final temperature value. The respective temperatures for a fixed number of voltages are stored in an array, and values in between are calculated using a linear interpolation between the adjacent points. Figure 3 gives the algorithm error using the ideal thermocouple voltages. Figure 4 shows the error obtained when using the ADC0 pin on the ADuC7060/ADuC7061 to measure the 52 thermocouple voltages over the full thermocouple operating range. The overall worst-case error is <1°C. An example packet is shown in Figure 2. 56 CLOCK TICKS To get a temperature reading, measure the temperature of the thermocouple and the RTD. The RTD temperature is converted to its equivalent thermocouple voltage via a lookup table. These two voltages are added together to give the absolute value of the voltage at the thermocouple. 0.30 0 1 0 7 1 2 8 0 0.25 ERROR (°C) 0.20 0.15 0.10 0.05 D1 TO D6 CRC PULSE –0.05 –210 –140 –70 0 70 140 210 280 350 TEMPERATURE (°C) Figure 2. Example SENT Packet Measured at the P0.4 Pin The circuit must be constructed on a multilayer printed circuit board (PCB) with a large area ground plane. Proper layout, grounding, and decoupling techniques must be used to achieve optimum performance (see Tutorial MT-031, Grounding Data Converters and Solving the Mystery of "AGND" and "DGND," Tutorial MT-101, Decoupling Techniques, and the ADuC7060/ ADuC7061 evaluation board layouts). Rev. A | Page 3 of 6 Figure 3. Error When Using Piecewise Linear Approximation Using 52 Calibration Points and Ideal Measurements 10889-003 SYNC STATUS PULSE PULSE 10889-002 0 CN-0281 Circuit Note For a wider temperature range, a different thermocouple can be used, such as a Type J. To minimize the cold junction compensation error, a thermistor can be placed in contact with the actual cold junction instead of on the PCB. 1.0 0.9 0.8 ERROR (°C) 0.7 Instead of using the RTD and external reference resistor for measuring the cold junction temperature, an external digital temperature sensor can be used. For example, the ADT7311 can connect to the ADuC7060/ADuC7061 via the I2C interface. 0.6 0.5 0.4 0.3 For additional information on cold junction compensation, see the Sensor Signal Conditioning, Analog Devices, Chapter 7, "Temperature Sensors." 0.2 0.1 –140 –70 0 70 140 210 280 350 TEMPERATURE (°C) CIRCUIT EVALUATION AND TEST 10889-004 0 –210 SENT Interface Tests Figure 4. Error When Using Piecewise Linear Approximation Using 52 Calibration Points Measured by the ADC0 Pin of the ADuC7060/ADuC7061 The RTD temperature is calculated using lookup tables and is implemented for the RTD the same way as for the thermocouple. Note that the RTD has a different polynomial describing its temperatures as a function of resistance. The SENT interface output was evaluated using a digital oscilloscope and a logic analyzer. The SENT interface was only tested with a SENT clock period of 100 µs, which is the maximum allowed by the SENT standard. The limiting factors in this implementation include the following: • The source code in the design support package was generated using KEIL µVision V3.90. For details on linearization and maximizing the performance of the RTD, refer to Application Note AN-0970, RTD Interfacing and Linearization Using an ADuC706x Microcontroller. COMMON VARIATIONS Instead of using an external RTD, the ADT7311 temperature sensor can be used to measure the cold junction temperature. • Source code using the ADT7311 is provided with the software package in the design support package: www.analog.com/CN0281-DesignSupport. Variation in FIQ interrupt latency for the timer. The interrupt latency of an ARM7 can be up to 45 CPU clocks. With a 10.24 MHz CPU clock, this is up to 4.4 µs. The minimum is 5× CPU clocks (0.5 µs). The worst-case latency occurs when the ARM7 core is executing a LDMIA or STMIA (load or store multiple values to/from memory). Select the Split Load and Store Multiple compiler option to minimize this, and see Figure 5 to see how to do this. The 10.24 MHz oscillator on the ADuC7060/ADuC7061 has a worst-case accuracy of ±3% over the −40°C to +125°C operating temperature range. An extra external regulator is required to power the ADT7311. When using the external reference resistor as the reference source for the RTD measurement, it is recommended to buffer the input to the VREF+ pin using an op amp in unity-gain mode. This is to ensure that the input leakage current to the VREF+ pin does not distort the measurement accuracy. In Figure 9, the OP193 was used for this purpose. Figure 1 shows the AD8628 which is characterized to work in the −40°C to +150°C operating range. 10889-005 If more GPIO pins are required on the microcontroller, the ADuC7060, which comes in a 48-lead LFCSP or a 48-lead LQFP, is another option. Note that the ADuC7060/ADuC7061 can be programmed or debugged via a standard JTAG interface. Figure 5. Selecting Split Load and Store Multiple Option Despite these limitations, this implementation is well within the required ±20% timing accuracy of the SENT specification when a SENT clock period of 100 µs is selected. Rev. A | Page 4 of 6 Circuit Note CN-0281 An EMC filter has been catered for on the SENT output in Figure 1. Chose values for this filter (R1, C1, C2) to meet the targeted transmitter output waveform, as shown in Figure 6, to reduce EMC emissions due to the SENT output. Only limited testing of this filter has been done; therefore, the resistor and capacitor values for the output filter were omitted, as is shown in Figure 1 (R1, C1, and C2). 4.5 To evaluate the accuracy of the lookup algorithm, 551 voltage readings, equivalent to temperatures in the range of −200°C to +350°C spaced at +1°C, were passed onto the temperature calculation functions. Errors were calculated for the linear method and the piecewise linear approximation method as can be seen in Figure 3 and Figure 4. 4.0 3.5 AMPLITUDE (V) A Wavetek 4808 multifunction calibrator was used to fully evaluate the error, as shown in Figure 3 and Figure 4. In this mode, the thermocouple was replaced with the calibrator as the voltage source, as shown in Figure 7. To evaluate the entire range of a Type T thermocouple, the calibrator was used to set the equivalent thermocouple voltage at 52 points between −200°C to +350°C for the negative and positive ranges of the Type T thermocouple (see the ITS-90 Table for Type T thermocouple). 3.0 2.5 2.0 RTD Measurement Test 1.5 To evaluate the RTD circuit and linearization source code, the RTD on the board was replaced with an accurate, adjustable resistance source. The instrument used was the 1433-Z decade resistor. RTD values from 90 Ω to 140 Ω, which represent an RTD temperature range of −25°C to +114°C, was the range of the RTD values tested. 1.0 0 0 5 10 15 20 25 TIME (µs) 30 35 40 10889-006 0.5 Figure 6. Example SENT Shaped Waveform Transmitter Output The error results for the RTD tests are shown in Figure 8, and the setup circuit is shown in Figure 9. To further test and evaluate the circuit, the thermocouple measurements and the RTD measurements were evaluated separately. 0 –0.01 Thermocouple Measurement Test –0.02 The basic test setup is shown in Figure 7. Two methods were used to evaluate the performance of the circuit. Initially, the circuit was tested with the thermocouple attached to the board and used to measure the temperature of an ice bucket, and then the temperature of boiling water. ERROR (°C) –0.03 –0.04 –0.05 –0.06 –0.07 EVAL-ADuC7061MKZ –0.08 THERMOCOUPLE JUNCTION J2-9 –0.09 –0.10 –25 SEE TEXT J2-5 –5 15 35 55 75 TEMPERATURE (°C) 95 115 10889-009 J2-8 Figure 8. Error in °C of the RTD Measurement Using Piecewise Linearization Code and ADC0 Measurements USB CABLE WAVTEK 4808 MULTIFUNCTION CALIBRATOR 10889-007 PC Figure 7. Test Setup Used to Calibrate and Test the Circuit Over Full Thermocouple Output Voltage Range Rev. A | Page 5 of 6 CN-0281 Circuit Note AVDD DVDD USB HEADER 5V D– D+ GND SHIELD BEAD ADP3333-2.5 IN BEAD OUT 4.7µF 0.1µF FT232QN BEAD 10Ω AVDD DVDD 4.7µF 0.1µF 0.1µF AVDD RxD TxD DVDD IEXC0 1433-Z DECADE RESISTOR 10Ω ADuC7061 ADC0 0.01µF 10Ω RREF 5.6kΩ (0.1%) + – ADC1 0.01µF AVDD OP193 VREF+ P1.0/SIN P1.1/SOUT RxD TxD 10889-008 VREF– Figure 9. Test Setup Used to Calibrate and Test the RTD Output Voltage Range from −25°C to +114°C LEARN MORE Data Sheets and Evaluation Boards CN0281 Design Support Package: http://www.analog.com/CN0281-DesignSupport. ADuC7060/ADuC7061 Data Sheet ADuC7060/ADuC7061 Evaluation Kit ADIsimPower Design Tool. Kester, Walt. 1999. Sensor Signal Conditioning. Analog Devices. Chapter 7, "Temperature Sensors." ADM3202 Data Sheet ADT7311 Data Sheet Kester, Walt. 1999. Sensor Signal Conditioning. Analog Devices. Chapter 8, "ADCs for Signal Conditioning." AD8628 Data Sheet Looney, Mike. RTD Interfacing and Linearization Using an ADuC706x Microcontroller. AN-0970 Application Note. Analog Devices. REVISION HISTORY MT-022 Tutorial, ADC Architectures III: Sigma-Delta ADC Basics. Analog Devices. MT-023 Tutorial, ADC Architectures IV: Sigma-Delta ADC Advanced Concepts and Applications. Analog Devices. ADP7102 Data Sheet 7/13—Rev. 0 to Rev. A Change to Figure 1 ............................................................................2 Changes to Common Variations Section .......................................4 7/12—Revision 0: Initial Version MT-031 Tutorial, Grounding Data Converters and Solving the Mystery of "AGND" and "DGND." Analog Devices. MT-101 Tutorial, Decoupling Techniques. Analog Devices. ITS-90 Table for Type T Thermocouple. SAE J2716 Standard (SENT Protocol). (Continued from first page) Circuits from the Lab circuits are intended only for use with Analog Devices products and are the intellectual property of Analog Devices or its licensors. While you may use the Circuits from the Lab circuits in the design of your product, no other license is granted by implication or otherwise under any patents or other intellectual property by application or use of the Circuits from the Lab circuits. Information furnished by Analog Devices is believed to be accurate and reliable. However, Circuits from the Lab circuits are supplied "as is" and without warranties of any kind, express, implied, or statutory including, but not limited to, any implied warranty of merchantability, noninfringement or fitness for a particular purpose and no responsibility is assumed by Analog Devices for their use, nor for any infringements of patents or other rights of third parties that may result from their use. Analog Devices reserves the right to change any Circuits from the Lab circuits at any time without notice but is under no obligation to do so. ©2012–2013 Analog Devices, Inc. All rights reserved. Trademarks and registered trademarks are the property of their respective owners. CN10889-0-7/13(A) Rev. A | Page 6 of 6