+ All Categories

Class11

Date post: 07-Aug-2015
Category:
Upload: sai-santosh-praveen
View: 38 times
Download: 2 times
Share this document with a friend
Popular Tags:
22
Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Interfacing Sensors and Embedded System Diagnostics EE4380 Fall 02 Class 11
Transcript
Page 1: Class11

Pari vallal KannanCenter for Integrated Circuits and SystemsUniversity of Texas at Dallas

Interfacing Sensors and Embedded System Diagnostics

EE4380 Fall 02Class 11

Page 2: Class11

1-Oct-02 2

Analog Devices

l Analog signals are very common inputs to embedded systems– Most transducers and sensors are analog

l Special devices needed to interface analog devices to digital systems

l ADC à Analog to Digital Converter– Between signal input and the embedded system

l DAC à Digital to Analog Converter– Between embedded system and analog signal

output

Page 3: Class11

1-Oct-02 3

ADC - 804

l Commonly used ADC device – ADC804l Specs

– Microprocessor compatible– Single voltage supply (+5V) operation, – Differential analog inputs. 0 - 5V input voltage (Vin+, Vin-)– Variable input voltage range (Pin Vref/2)– Internal Clock Generator (RC on CLK IN, CLK R pins)

l PinOut– CS – Chip Select , active low– RD – Read Digital data from ADC, H-L edge triggered– WR -- Start conversion, L-H pulse edge triggered– INTR -- end of conversion, Goes low to indicate conversion done– Data bits -- D0-D7

Page 4: Class11

1-Oct-02 4

ADC - Parameters

l Resolution– 8 bits for ADC804

l Conversion Time– Greater than 110us for ADC804

l Input Voltage range– Default 0-5V. Can be changed by setting different value for

Vref/2 pin– Range = 0 to 2x Vref/2

l Step Size à Smallest change– (2 x Vref/2)/ 256 for ADC804

l Data Out– Dout = Vin / Step Size

Page 5: Class11

1-Oct-02 5

Interfacing ADC804 to 8051

l Signals to be interfaced (on the ADC804)– D0-D7, RD, WR, INTR, CS

l IO Mapping (easiest)– Connect D0-D7, RD, WR, CS, INTR to some port bits on the 8051 (12

in all). – CS may be unused for IO mapped operation (11 port bits in all)

l Memory Mapping – Connect D0-D7 of ADC804 to the data bus of the 8051 system– Connect RD, WR of the ADC804 to the 8051 system (ensure polarity)– Connect CS of ADC804 to an appropriate address decoder output– Connect INTR of ADC804 to an external interrupt Pin on the 8051

(INT0 or INT1)

Page 6: Class11

1-Oct-02 6

ADC804 - Code Examples

l IO Mapped à P1 to D0-D7, P2.5 to RD, P2.6 to WR, P2.7 to INTR

l Memory Mapped à Try it !

ADC_IO: mov P1, #0xFF ;make P1 input

setb P2.5 ;RD=1

clr P2.6 ;WR=0

setb P2.6 ;WR=1

WAIT: jb P2.7, WAIT ;wait for INTR

clr P2.5 ;RD=0

mov A, P1 ;read digital o/p

ret

Page 7: Class11

1-Oct-02 7

LM34DZ with ADC804

l LM34DZ– Temperature sensor– Linear, +32F to +212F, 10mV/F– 3 pins à Vcc, GND and Vout

l Interfacing LM34DZ with ADC804– ADC804 has 256 steps– LM34 produces 10mV/F, (212-32 = 180) steps– So go for a full scale Vout of 256 x 10mv = 2.56V– Vref/2 should then be 1.28V– ADC O/P : 0x00 à +32F, 0x01 à +33F, 0x02 à+34F …..

0xB4 à+212F

Page 8: Class11

1-Oct-02 8

LM34DZ and ADC804 (contd.)

l Vref/2 of any value can be obtained by – using a Zener diode (eg. LM336 2.5V) and a pot

(very stable)– Resistive network of two resistors (susceptible to

variations in resistors and power supply jitter/noise)

Page 9: Class11

1-Oct-02 9

Digital to Analog Converter - DAC

l Commonly used DAC808 (MC1408)– R/2R ladder– Iout = Iref (D7/2 + D6/4 + D5/8 + …… + D0/256)– Iout converted to voltage by a resistive load or op-amp based

isolator (Rf from Vout to V- and V+ to GND)

l PinOut – Check with the datasheet for setting up the reference current

– D0-D7 à Connected to the Processor’s IO port

l Usage:– Just write a byte to the IO port and the DAC converts it to an

analog value

l Some 8051 clones have ADCs and DACs in built

Page 10: Class11

1-Oct-02 10

Embedded System Debugging

l What to do when your embedded system design is not working as expected ?

l There is no cosmic conspiracy against you !– Most problems have simple causes and solutions

l Know the basics about test equipmentl Know the electrical properties of the

components in your system– Absolute maximum ratings of currents and voltages– Maximum frequency of operation– ESD

Page 11: Class11

1-Oct-02 11

Types of problems

l Always present (reproducible)– Dead board– No activity of a certain subsystem (display, keypad,

etc)l Erratic (sometimes irreproducible)

– Happens occasionally– Usually difficult to debug and demands the most

skill

l Hardware problemsl Software prolems

Page 12: Class11

1-Oct-02 12

Test Equipmentl DMM, logic probe

– Continuity tests, voltage measurements– Most trouble-shooting and fixing happens with these– Cheap, highly portable, versatile

l CRO– For checking fast changing signals– Quick check on activity of important pins on clocks,

processors, memory, decoders, chip_selects etc

l Logic Analyzer– For detailed analysis of a number of signals simultaneously

over a time-span– For debugging data accesses, DMAs, interrupts, I2C, etc– Identify and trouble-shoot timing violations (setup and hold

times) etc.– High $$$

Page 13: Class11

1-Oct-02 13

Problem Domains in Emb. Systemsl Power related

– Insufficient drive, switching induced noise, brown outs– No power at all. Disconnected or dry solder joints on Vcc, GND pins

l Design related - Schematic– Bad netlist, wrong connections, wrong pin-out

l Design related - Logic and Timing– Poor logic design (state machines, decoders, address generators,

PLDs, etc)– Timing violations (setup and hold times, memory accesses, DMAs,

interrupts, etc)

l Manufacturing related– General open circuits and shorts– Dry solder, bad wire-wrap,stray metal pieces, bent pins etc

l Random

Page 14: Class11

1-Oct-02 14

Trouble-shooting – Broad Outline

l Analytical thinking– Think about possible “reasons” that can cause the

problem seen– Check the input to the system – your design and its

schematics (remember GIGO)

l Problem domain identificationl Eliminate hardware issues. Then it’s the

software’s turn

Page 15: Class11

1-Oct-02 15

Hardware Debugging

l Check power and gnd connectivity on all Ics and discretes

l Check clock connectivityl Check if the processor is out of RESETl Check for activity on signals known for continuous

activity– 8051 – ALE, PSEN, AD[], A[]– Memory – address lines and data lines (LSBs are best)– All ICs – Chip selects, WR and RD

l Check voltage levels on all transceivers– RS232 interfaces (MAX232s), transducers etc

l Check HOST settings– Port settings (COM, LPT), etc

Page 16: Class11

1-Oct-02 16

Hardware Debugging - Elimination

l Power OK ?l Clock OK ?l Processor OK ?

– ALE, PSEN, RD, WR etc

l Memory OK ?– Address and data lines, Chip-selects

l Peripherals OK ?l Not done yet ?

– Timing analysis (data sheets, LA etc)– Analyze data transfers (LA)

Page 17: Class11

1-Oct-02 17

Real world scenario 1l System Under Test – old Pentium Motherboard l Symptoms

– Motherboard does not boot– CPU fan ON– Everything else fine (VGA, memory, etc)

l Diagnosis– Maybe the CPU is dead or not powered ???– Turn on the board and feel the CPU– CPU cold : maybe no power ? But Fan is on. But fan takes 12V.

CPU uses 5V. Maybe 5V supply is dead– Check 5V pin on the PS. Dead. – Use another PS and turn ON the board– Board boots fine !

Page 18: Class11

1-Oct-02 18

Scenario 2l 8051 board not communicating with Hostl Symptoms

– 8051 board powers up. – No communication with host. Host settings fine

l Diagnosis– Check power for all ICs. Passed– Check ALE and PSEN activity. Passed (8051 fine and out of

RESET)– Check voltage levels on MAX232 pins. Wrong voltage on Rx

pin.– Check serial cable connectivity. Monitor Rx on CRO while

punching keys on the Host terminal. No activity. Possibly, OC on the Rx pin/header.

– Replace serial port header. Communication successful.

Page 19: Class11

1-Oct-02 19

Software Issues

l Embedded systems are highly affected by the software ! (duh)

l Software based diagnostics running on the system are indispensable

l Bad code– Wrong programming of control registers– Wrong assembly. Corrupt PROMs– Code in infinite loop with no termination condition

l Address issues– Mismatch between hardware’s memory map and

programmer’s memory map– Timing violations in code for DMAs, LCDs, ports etc

Page 20: Class11

1-Oct-02 20

In system Diagnostics

l Very simple code snippets included in the PROM (along with the system’s main code)

l Simple tests– Light up a status LED– Display register contents on a 7seg LED display– Put out a string on serial port

Page 21: Class11

1-Oct-02 21

In system Diagnostics

l Detailed tests– Memory test routines (bit walk, AA55 tests, etc)– Peripheral tests

l Tests for keypad, LCD, ADC/DAC, etc

– Host communication tests– Register and stack read write tests– DMA and interrupt tests

l Effective debugging involves using diagnostics and hardware tests

Page 22: Class11

1-Oct-02 22

Thanks


Recommended