Application Note AN8000.14 Semtech Sensor Demo AN8000.14 Application Note Semtech Sensor Demo Rev 1 February 2006 www.semtech.com 1 Application Note AN8000.14 XEMICS Table of Contents 1 Introduction...................................................................................................................................................... 3 1.1 Purpose of the document ......................................................................................................................... 3 1.2 Sensor demo principle ............................................................................................................................. 3 2 Sensor board ................................................................................................................................................... 4 2.1 Pin assignments ....................................................................................................................................... 4 2.2 Applications examples: ............................................................................................................................ 4 2.2.1 Minimum system ............................................................................................................................... 4 2.2.2 Two sensors system ......................................................................................................................... 5 2.2.3 Two sensors and EEPROM system ................................................................................................. 5 3 Demo board..................................................................................................................................................... 6 3.1 Bloc diagram ............................................................................................................................................ 6 3.2 Schematic................................................................................................................................................. 6 3.3 Hardware layout ....................................................................................................................................... 7 3.4 Electrical specifications ............................................................................................................................ 7 4 Embedded software......................................................................................................................................... 8 4.1 System default values .............................................................................................................................. 8 4.2 Noise cancellation .................................................................................................................................... 8 4.3 Flowcharts ................................................................................................................................................ 9 4.4 Flowcharts Continued ............................................................................................................................ 10 5 Zooming ADC ................................................................................................................................................ 11 5.1 Bloc diagram .......................................................................................................................................... 11 5.2 ZoomingADC™ Registers...................................................................................................................... 11 6 SEMTECH ZoomingADC™ Excel sheet ....................................................................................................... 13 7 GUI Software description .............................................................................................................................. 14 7.1 Installation .............................................................................................................................................. 14 7.2 Description ............................................................................................................................................. 14 7.3 Main screen............................................................................................................................................ 14 7.4 Display settings (Span) .......................................................................................................................... 15 7.5 Advanced Settings ................................................................................................................................. 16 7.6 About Box............................................................................................................................................... 16 8 Hyperterminal Alternative .............................................................................................................................. 17 8.1 Configuration .......................................................................................................................................... 17 8.2 Usage ..................................................................................................................................................... 17 8.3 Commands ............................................................................................................................................. 18 8.3.1 Reset............................................................................................................................................... 18 8.3.2 Version ............................................................................................................................................ 18 8.3.3 Read Address ................................................................................................................................. 18 8.3.4 Write Address.................................................................................................................................. 18 8.3.5 Configure the averaging.................................................................................................................. 19 9 Sensor Demo files ......................................................................................................................................... 20 9.1 Database structure................................................................................................................................. 20 10 Conclusion ................................................................................................................................................. 20 ©Semtech 2006 www.semtech.com 2 Application Note AN8000.14 XEMICS 1 1.1 INTRODUCTION PURPOSE OF THE DOCUMENT Sensor interfacing with XE8000 Sensing Machine is quite easy. The ZoomingADC™ adapts easily to most types of sensors. However one must have good understanding of the microcontroller basic features such as programming, usage of the RC oscillator and of the UART serial interface, in order to first have operational software. These are all things that may not be the first priority when one wants to have a quick overview of the Sensing Machine possibilities with a selected sensor. In this context, Semtech provides a demonstration system that gives access to the sensor through the ZoomingADC™ using a predefined graphical user interface (GUI) that requires a minimum of work in terms of software and hardware. This document describes the sensor demo and its graphical user interface developed by Semtech for demonstrations purposes. All the files necessary to reproduce this board and use the GUI are available on Semtech web site in ZIP format. 1.2 SENSOR DEMO PRINCIPLE Sensor Demo bloc diagram GUI Serial cable Demo board Sensor Dedicated connector ZoomingADC™™ Excel sheet SEMTECH Sensing Machine RS232 Level Shifter XE8805A Or XE8801A Or XE8802 Power supply 32k XTAL, Vreg cap 3xAAA batteries PC with a serial COM port As shown in the figure above, the sensor demo is split into three different parts: The sensor board: the sensor board holds the sensor and eventually its external components; this board has a dedicated connector that connects to the demo board. The demo board: this PCB has the minimum components necessary to run the XE8000 microcontroller and to communicate with a PC through serial communication. The microcontroller has embedded software that enables the access to the ZoomingADC™ registers from the PC. The PC with a dedicated graphical user interface that allows one to read and write ZoomingADC™ registers, displays it’s output on a chart and the Semtech excel sheet that allows one to compute the values to set in the ZoomingADC™ registers. ©Semtech 2006 www.semtech.com 3 Application Note AN8000.14 XEMICS 2 SENSOR BOARD The sensor board is made to carry the sensor; the connector of this board is a STD 1 row 2.54mm pitch connector. 2.1 PIN ASSIGNMENTS The pin assignment is as follows: Pin assignment Physical dimensions Minimum system Two sensors with the same reference Optionnal digital interface VBIAS / + Power supply 2.54 AC R1,R3 / + Reference voltage 2.54 AC_A A1,A7 / + Measured signal 2.54 AC_A0,A6 / - Measured signal 2.54 AC_ R0,R2 / - Reference voltage 2.54 VSS/ - Power supply 5.08 AC_A3,A5 / + Measured signal 2.54 AC A2,A4 / - Measured signal 2.54 2.54 2.54 2.54 2.54 2.54 PC0 / PC1 / SCK PC2 / NSS PC3 / MISO PC4 / VDIG All dimensions are in milimeters As shown in the picture above, the board may have three sizes depending on which kind of application is being used: The minimum system includes the power supply, the references inputs and two analog inputs. The next size offers two more analog inputs.*1 Then the last version offers the access to digital I/O that may allow the connection of an EEPROM or another system that the sensor may need to work correctly.*1 *1 Note that these mode are not included in the embedded software of the Microcontroller. 2.2 APPLICATIONS EXAMPLES: 2.2.1 Minimum system Minimum system VBIAS / + Power supply AC_R1,R3 / + Reference voltage AC_A A1,A7 / + Measured signal AC_A0,A6 / - Measured signal AC R0,R2 / - Reference voltage VSS/ - Power supply ©Semtech 2006 www.semtech.com 4 Application Note AN8000.14 XEMICS 2.2.2 Two sensors system Two sensors with the same reference VBIAS / + Power supply AC_R1,R3 / + Reference voltage AC_A A1,A7 / + Measured signal AC_A0,A6 / - Measured signal AC_ R0,R2 / - Reference voltage VSS/ - Power supply AC_A3,A5 / + Measured signal θ AC_A2,A4 / - Measured signal 2.2.3 Two sensors and EEPROM system Optionnal digital interface VBIAS / + Power supply AC_R1,R3 / + Reference voltage AC_A A1,A7 / + Measured signal AC A0,A6 / - Measured signal AC R0,R2 / - Reference voltage VSS/ - Power supply SPI EEPROM θ AC_A3,A5 / + Measured signal AC A2,A4 / - Measured signal PC0 / MOSI PC1 / SCK PC2 / NSS PC3 / MISO PC4 / VDIG ©Semtech 2006 www.semtech.com 5 Application Note AN8000.14 XEMICS 3 DEMO BOARD The demo board holds the XE8805A, the power supply and the RS232 transceiver. In the XE8805A, the embedded software manages the ZoomingADC™ and the communication with the PC. 3.1 BLOC DIAGRAM SEMTECH Microcontroller From The sensor XE8805A or XE8801A or XE8802 32k XTAL, Vreg cap 3.2 RS232 Level Shifter To the PC Power supply 3xAAA batteries SCHEMATIC XEMICS ©Semtech 2006 www.semtech.com 6 Application Note AN8000.14 XEMICS 3.3 HARDWARE LAYOUT Core 3XAAA Batteries the back on RS232 Interface Analog interface Power supply Engineering zone On/Off switch XE8805A Programming Interface digital Interface 3.4 ELECTRICAL SPECIFICATIONS Parameter Power supply Main power supply Regulated VDIG VBAT VREF Current consumption Micro controller Sensor RS323 interface Estimated autonomy Min Typ Max Units Comment 3.6 4.5 3.3V 3.3 3.26 3.24 4.8 Vdc Vdc mVdc mVdc mVdc Energizer EN92 2 2 3.2 100 mAdc mAdc mAdc Hrs ©Semtech 2006 Energizer EN92 www.semtech.com 7 Application Note AN8000.14 XEMICS 4 EMBEDDED SOFTWARE The embedded software monitors the UART communication and the ZoomingADC™ handling; the source code is available on SEMTECH web site. This software may be considered as a base for future applications, multi sensors handling and EEPROM management are not included in this basic version. 4.1 SYSTEM DEFAULT VALUES Periph Parameter RC Frequency XTAL 32k UART speed UART number of bits UART parity UART Stop bits UART Flow control Vbat = Vref Sampling freq. Input impedance Gain of PGA1 Gain of PGA2 Gain of PGA3 Total PGA gain Offset of PGA2 Offset of PGA3 Total equivalent input offset Oversampling rate Elementary conversions Resolution Conversion time LSB equivalent input voltage Equivalent input noise PGA settling time Clock UART ZoomigADC Value (typ) 1.8432 on 57600 8 none 1 no 3.26 450 170.6667 10 10 5.00 500.00 0.20 0.00 6.52 1024 8 16.0 18.22 9.94E-08 2.41E-07 1.295 Unit MHz bps bits bit V kHz kohm vref vref mV bit (1) ms V Vrms (2) ms (1) quantization noise only (2) white noise included 4.2 NOISE CANCELLATION In order to completely cancel the white noise generated by the ADC and PGA, we have to average the measured value. To get a stable reading, you need to reduce the equivalent input noise to VLSB/√12. The averaging value is calculated as follow 2 2 ⎛ InpNoise ⎞ ⎛ 2.41E - 07 ⎞ ⋅ 12 ⎟ = ⎜ ⋅ 12 ⎟ = 70 ⎜ ⎝ LSB ⎠ ⎝ 9.94E - 08 ⎠ ©Semtech 2006 www.semtech.com 8 Application Note AN8000.14 XEMICS The averaging method chosen is the sliding window method, this introduces a delay of the number of averages but the data flow stays fluent. 4.3 FLOWCHARTS Main UART interrupt Reset InitMicro OnCom UART RX int. OnCom Software FIFO write FIFO empty ? yes FIFO = R? yes FIFO = v? yes FIFO = r? yes Get average type FIFO = w? yes Change average global variables FIFO = c? yes OnCom Mode 0 UART RX Int. END Mode 0 Configure Mode 0 Configure Start ADC Send Prompt Reset Version Process Send Measurements results Get average value ReadRAM Send Prompt ReadRAM ReadRAM Send Prompt Get Address Read at given address WriteRAM Configure Send Acknowledge Send Result Other flowcharts on next page ©Semtech 2006 www.semtech.com 9 Application Note AN8000.14 XEMICS 4.4 FLOWCHARTS CONTINUED WriteRAM Process WriteRAM Process Send Prompt Std Get Address Send Prompt Sliding win Avg type? Does standard averaging Does sliding window averaging Get data Write given data at given address Send Acknowledge Reset Reset Reset the micro Send ack Version Version Send Version ©Semtech 2006 www.semtech.com 10 Application Note AN8000.14 XEMICS 5 ZOOMING ADC™ This chapter is a reminder of the main functions of the ZoomingADC™, its registers and their definitions. It intends to avoid consulting the datasheet to fill the excel sheet described in the next chapter. However more complete information can be found in the XE8805A datasheet on the Semtech website. 5.1 BLOC DIAGRAM ZoomingADC™ 5.2 ZOOMINGADC™ REGISTERS Physical Address 0x0062 0x0063 0x0064 0x0065 0x0066 0x0067 Bit Position Register Name 7 RegACCfg0 Default values: RegACCfg1 Default values: RegACCfg2 Default values: RegACCfg3 Default values: RegACCfg4 Default values: RegACCfg5 Default values: 6 START 0 IB_AMP_ADC[1:0] 11 FIN[1:0] 00 PGA1_G 0 0 BUSY 0 5 SET_NELC[1:0] 01 DEF 0 4 3 SET_OSR[2:0] 010 2 1 0 CONT 0 IB_AMP_PGA[1:0] ENABLE[3:0] 11 0001 PGA2_GAIN[1:0] PGA2_OFFSET[3:0] 00 0000 PGA3_GAIN[6:0] 0000000 PGA3_OFFSET[6:0] 0000000 AMUX[4:0] 00000 TEST 0 VMUX 0 With: • OUT: (r) digital output code of the analog-to-digital converter. (MSB = OUT[15]) • START: (w) setting this bit triggers a single conversion (after the current one is finished). This bit always reads back 0. SET_NELC[1:0] . To compensate for offsets, the input signal • SET_NELC: (rw) sets the number of elementary conversions to 2 is chopped between elementary conversions (1,2,4,8). (3+SET_OSR[2:0]) . OSR = 8, 16, 32, ..., • SET_OSR: (rw) sets the over-sampling rate (OSR) of an elementary conversion to 2 512, 1024. • CONT: (rw) setting this bit starts a conversion. A new conversion will automatically begin as long as the bit remains at 1. • TEST: bit only used for test purposes. In normal mode, this bit is forced to 0 and cannot be overwritten. • IB_AMP_ADC: (rw) sets the bias current in the ADC to 0.25*(1+ IB_AMP_ADC[1:0]) of the normal operation current (25, 50, 75 or 100% of nominal current). To be used for low-power, low-speed operation. • IB_AMP_PGA: (rw) sets the bias current in the PGAs to 0.25*(1+IB_AMP_PGA[1:0]) of the normal operation current (25, 50, 75 or 100% of nominal current). To be used for low-power, low-speed operation. • ENABLE: (rw) enables the ADC modulator (bit 0) and the different stages of the PGAs (PGAi by bit i=1,2,3). PGA stages that are disabled are bypassed. • FIN: (rw) These bits set the sampling frequency of the acquisition chain. Expressed as a fraction of the oscillator frequency, the sampling frequency is given as: 00 Æ 1/4 fRC, 01 Æ 1/8 fRC, 10 Æ 1/32 fRC, 11Æ ~8kHz. • PGA1_GAIN: (rw) sets the gain of the first stage: 0 Æ 1, 1 Æ 10. ©Semtech 2006 www.semtech.com 11 Application Note AN8000.14 XEMICS • • • • • • • • PGA2_GAIN: (rw) sets the gain of the second stage: 00 Æ 1, 01 Æ 2, 10 Æ 5, 11 Æ 10. PGA3_GAIN: (rw) sets the gain of the third stage to PGA3_GAIN[6:0]⋅1/12. PGA2_OFFSET: (rw) sets the offset of the second stage between –1 and +1, with increments of 0.2. The MSB gives the sign (0 → positive, 1 → negative); amplitude is coded with the bits PGA2_OFFSET[5:0]. PGA3_OFFSET: (rw) sets the offset of the third stage between –5.25 and +5.25, with increments of 1/12. The MSB gives the sign (0 → positive, 1 → negative); amplitude is coded with the bits PGA3_OFFSET[5:0]. BUSY: (r) set to 1 if a conversion is running. DEF: (w) sets all values to their defaults (PGA disabled, max speed, nominal modulator bias current, 2 elementary conversions, over-sampling rate of 32) and starts a new conversion without waiting the end of the preceding one. AMUX(4:0): (rw) AMUX[4] sets the mode (0 Æ 4 differential inputs, 1 Æ 7 inputs with A(0) = common reference) AMUX(3) sets the sign (0 Æ straight, 1Æ cross) AMUX[2:0] sets the channel. VMUX: (rw) sets the differential reference channel (0 Æ R(1) and R(0), 1 Æ R(3) and R(2)). (r = read; w = write; rw = read & write) ©Semtech 2006 www.semtech.com 12 Application Note AN8000.14 XEMICS 6 SEMTECH ZOOMINGADC™ EXCEL SHEET In order to ease the calculation of the parameters entered in the different registers, we create an excel sheet that implements all the formulas that can be found in the datasheet. Using this spreadsheet allows you to trim the values to be put in registers RegACCfg0-5 The figure below shows the spreadsheet Input zone Place the parameters of your application here Hints / Optimization zone Follow the hints in order to reach one optimization level or another Results zone This area shows the different values calculated following your parameters inputs Register contents Binary and Hex code to be programmed in RegACCfg0-5 registers ©Semtech 2006 www.semtech.com 13 Application Note AN8000.14 XEMICS 7 7.1 GUI SOFTWARE DESCRIPTION INSTALLATION To use the GUI on a PC you simply need to launch the executable file named SensorDemo.exe. There is no need to install anything; you can launch it from network or a CD ROM. 7.2 DESCRIPTION This window is the main window, it shows you the data coming from the demo board, and the functions available are described below. 7.3 MAIN SCREEN Data display Version of demo board RAW data display COM port control Advanced functions ©Semtech 2006 the Display settings www.semtech.com 14 Application Note AN8000.14 XEMICS 7.4 DISPLAY SETTINGS (SPAN) This window allows the user to change the span on the chart of the main window, this window does not need to be closed at each action on the span value, and this is useful to try several configurations. Note that there is no signal tracking and it is possible that the signal goes out of range due to an external event (i.e. door or window opening). The way to retrieve the signal is to do an auto scale again. Resets the chart to its maximum values Validate the current span displayed Close this window Does an autoscale based on the 100 last measurements Value of the span where the signal will fit. Note that this value can be changed by the user. The auto scale function calculates a display range with the specified span around the average value of the last 100 measurements. ©Semtech 2006 www.semtech.com 15 Application Note AN8000.14 XEMICS 7.5 ADVANCED SETTINGS This window allows the user to change different configurations of the measurement such as the averaging method and value. But the main interest of this window is that the user can change every XE8805A register on the fly by using the read and the write functions. Using this tool with the standard Semtech MS Excel ZoomingADC™TM calculation sheet allows the user to quickly change the configuration of the ADC. This window does not need to be closed at each action on the span value, and this is useful to try several configurations. Resets the demo board and the chart Queries the version of the demo board Read the value at the given address Write the wanted value at the wanted address Applies average values 7.6 changes method on and Averaging value Averaging method used. Close this window ABOUT BOX This window can be displayed with a right click action on the title bar of the main window. It gives you the version of the GUI. ©Semtech 2006 www.semtech.com 16 Application Note AN8000.14 XEMICS 8 HYPERTERMINAL ALTERNATIVE Since the interface between the PC and the demo board is through ASCII protocol, a simple hyper terminal application can be used. 8.1 CONFIGURATION The configuration of the COM port must be as shown in the picture below . 8.2 USAGE The HyperTerminal will display RAW data continuously, the user can log the data using the capture function, and the user can also send the two commands offered by the GUI interface by typing the letter corresponding to the command. See example in picture below ©Semtech 2006 www.semtech.com 17 Application Note AN8000.14 XEMICS 8.3 COMMANDS The available commands are Reset and version requests, 8.3.1 Reset To reset the demo board the user must type “R” in the hyper terminal screen (no need of a carriage return) Note that it is a capital letter to prevent unwanted reset. 8.3.2 Version To get the version of demo board the user must type “v” in the hyper terminal screen (no need of a carriage return) Then the version is displayed on the screen, the user must acknowledge with a carriage return. 8.3.3 Read Address In order to read an address the user must type “r” in the hyper terminal screen (no need of a carriage return) Then the display will be as follow: Read Address: 0x_ Then type the address you want to read Read Address: 0x0064 Once the last digit is typed the result will appear as follow: Value Read at 0x0064 : 0x31 Now acknowledge with a carriage return 8.3.4 Write Address In order to write a data to an address the user must type “w” in the hyper terminal screen (no need of a carriage return) Then the display will be as follow: Write Address: 0x_ Then type the address you want to write Write Address: 0x0064 Once the last digit is typed the display will appear as follow: Write Address: 0x0064 Data: 0x_ Then type the data you want to write at the address Write Address: 0x0064 Data: 0x32 Once the last digit is typed the result will appear as follow: Value Written at 0x0064 : 0x32 Now acknowledge with a carriage return. ©Semtech 2006 www.semtech.com 18 Application Note AN8000.14 XEMICS 8.3.5 Configure the averaging To configure the averaging, the user must type “c” in the hyper terminal screen (no need of a carriage return) Then the display will be as follow: Config: Average on (max = 0xFF) :_ Then type the value of averaging you want to use Config: Average on (max = 0xFF) :20 Once the last digit is typed the result will appear as follow: Now averaging on 0x20 Average type (0 :std, 1 :sliding window) : Choose the method of averaging: Average type (0 :std, 1 :sliding window) :1 The display will look as follow: Average type chosen : 1 Now acknowledge with a carriage return. ©Semtech 2006 www.semtech.com 19 Application Note AN8000.14 XEMICS 9 SENSOR DEMO FILES This chapter explains the structure of the zip file annexed to this technical note. 9.1 DATABASE STRUCTURE The picture below show the database once the ZIP file is unzipped. The database is split in 3 sub folders: • SensorDemo Application This folder holds the binaries and executable for the GUI and the embedded software. Source files are available under the source folders; the embedded software is in RIDE format and the GUI under Microsoft visual studio .net 2003. The ZoomingADC™ Excel sheet directory contains the excel sheet described in this document. • SensorDemo Documentation This folder contains An example of application made with the pressure sensor from Motorola MPX2202AP This document A white paper speaking about sensor interfacing with XE8000 The Sensor Demo user’s guide (Quick start) • SensorDemo PCB_E068V01A This folder all the necessary data to rebuild the PCBs, the bill of material, the schematics, the layer description and the gerber files. The design database is available on request 10 CONCLUSION Sensor interfacing with XE8000 Sensing Machine is quite easy. The demonstrator for the Sensing Machine makes it possible to evaluate the ZoomingADC™ performances with a sensor without having to bother about the MCU programming. Customers that start their evaluation with this board can continue their development on this basis by getting all the related technical information from the SEMTECH web site – http://www.semtech.com ©Semtech 2006 www.semtech.com 20 Application Note AN8000.14 XEMICS © Semtech 2006 All rights reserved. Reproduction in whole or in part is prohibited without the prior written consent of the copyright owner. The information presented in this document does not form part of any quotation or contract, is believed to be accurate and reliable and may be changed without notice. No liability will be accepted by the publisher for any consequence of its use. Publication thereof does not convey nor imply any license under patent or other industrial or intellectual property rights. Semtech. assumes no responsibility or liability whatsoever for any failure or unexpected operation resulting from misuse, neglect improper installation, repair or improper handling or unusual physical or electrical stress including, but not limited to, exposure to parameters beyond the specified maximum ratings or operation outside the specified range. SEMTECH PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS. INCLUSION OF SEMTECH PRODUCTS IN SUCH APPLICATIONS IS UNDERSTOOD TO BE UNDERTAKEN SOLELY AT THE CUSTOMER’S OWN RISK. Should a customer purchase or use Semtech products for any such unauthorized application, the customer shall indemnify and hold Semtech and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs damages and attorney fees which could arise. Contact Information Semtech Corporation Wireless and Sensing Products Division 200 Flynn Road, Camarillo, CA 93012 Phone (805) 498-2111 Fax : (805) 498-3804 ©Semtech 2006 www.semtech.com 21