logic analyzer tutorial

25
Logic Analyzer Tutorial PC-Based Logic Analyzer with USB Interface Introduction: A logic analyzer (LA) is a very useful tool for testing digital or logic circuits. It displays the logic status (high or low) of a large number of digital signals, so that they can be monitored relative to each other. A logic analyzer may have anywhere between about 32 and 132 channels (much more than a conventional oscilloscope), with each channel monitoring one digital line/signal. The LogicPort Logic Analyzer provides 34 sampled channels. Connection of Logic Port: The LogicPort input connector is a standard 40 pin IDC compatible header. The user can utilize inexpensive IDC connectors and ribbon cable to connect directly to a header on a circuit board, or to create custom test leads. The 40 pin cables used with IDE hard drives make a good starting point for custom test leads. GUI Screenshot of Logic Analyzer Figure 1 The Graphical User Interface

Upload: james-owen

Post on 10-Oct-2014

359 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: Logic Analyzer Tutorial

Logic Analyzer – Tutorial

PC-Based Logic Analyzer with USB Interface

Introduction:

A logic analyzer (LA) is a very useful tool for testing digital or logic circuits. It displays the

logic status (high or low) of a large number of digital signals, so that they can be monitored

relative to each other. A logic analyzer may have anywhere between about 32 and 132 channels

(much more than a conventional oscilloscope), with each channel monitoring one digital

line/signal. The LogicPort Logic Analyzer provides 34 sampled channels.

Connection of Logic Port:

The LogicPort input connector is a standard 40 pin IDC compatible header. The user can utilize

inexpensive IDC connectors and ribbon cable to connect directly to a header on a circuit board,

or to create custom test leads. The 40 pin cables used with IDE hard drives make a good starting

point for custom test leads.

GUI Screenshot of Logic Analyzer

Figure 1 The Graphical User Interface

Page 2: Logic Analyzer Tutorial

Hardware features:

The Timing Model

The timing mode sample rate range is 1 KHz to 500MHz

The timing mode is based on the LA's internally generated sample clock. The rate of this clock is

selectable in finite increments, and is not synchronized to the hardware under test. This mode is

typically used when we want to see the timing relationships between signals such as “WR”,

“ADDRESS” and “DATA”. Real-time sample rates up to 500MHz capture today’s high-speed

digital signals.

Figure 2 The Timing Mode Sample Rate

The Sample Mode

The state mode sampling rate has an upper limit of 200MHz

State mode uses an external clock supplied by the hardware under test to synchronously sample

the data. This mode is useful when we are interested in the data values rather than their timing

relationships. It is especially useful for DSP work when combined with the LogicPort’s ability to

represent a group of signals as an analog waveform.

Figure 3 The Drop Down Menu for the Sample Rate

Page 3: Logic Analyzer Tutorial

Qualified state mode sampling

Qualified state sampling allows capturing of data synchronized with external clock, and a

'qualifier signal'. It enables de-multiplexing of buses and capturing of qualified data which is

useful when working with microprocessors which multiplex data and address onto the same bus.

It can also be used to capture data directed toward a particular device by using that device’s chip

select signal as a qualifier.

Sample Compression (Transitional Sampling)

The data is compressed in the sample buffer, which means much more data can be acquired.

Compression is available both for timing and state mode.

Adjustable Threshold Range

Logic threshold is adjustable over a range of +6 to -6 volts

Combined with the LogicPort’s high sensitivity and wide dynamic range, this allows

compatibility with virtually all logic families including TTL, LVTTL, CMOS, ECL, PECL,

RS232, and others.

Channel to channel skew <1ns

The channel to channel skew gives an accurate representation of the timing relationships

between different signals.

High input impedance

An input resistance of 200kÙ , paralleled by <5pF, provides minimal hardware loading.

Page 4: Logic Analyzer Tutorial

Multi-level trigger

The two trigger levels can be used individually, or logically combined in one of several modes.

Each level can consist of multiple terms including:

• Edges - Rising, Falling, Either (multiple channels, any combination)

• Pattern - True, False, Entered, Exited

• Value - Equal, Not Equal, Less Than, Greater Than, In Range, Not in Range

• Occurrence Count - Range of 1 to 1,048,576 Consecutive or Cumulative

• Duration - Equal, Less Than, Greater Than, In Range (samples or time)

State mode Setup/Hold window adjustable

The sample time can be adjusted +/-2.5ns relative to clock edge, allowing easy capture of signals

with skewed clocks or narrow “data valid” windows.

Hardware-based frequency counter

The hardware-based frequency counter allows real-time measurement of signals up to 300MHz

regardless of the current sample mode and rate.

USB Powered

The USB connection to the computer means there is no need for an external power supply.

Software features

User friendly

The LogicPort logic analyzer is easy to use. The graphical user interface (GUI) has been

designed to maximize the display area. There are drop down menus for the sample rate,

frequency rate, and the logic threshold. The GUI graphically shows the captured signals as both

waveforms and as values. The LogicPort also displays the captured data in a signal list.

The LogicPort operates in “Demo” mode when no hardware is present

The LogicPort allows acquired data to be viewed off-line when the LogicPort is not connected.

Any data in the buffer can be saved to a file for future loading and viewing in both waveform

and signal list format.

Fast acquisition rate

The LogicPort can typically perform 4 acquisitions per second on a 400MHz Pentium II desktop

PC

Includes interpreters for I2C, SPI and RS232 protocols

Page 5: Logic Analyzer Tutorial

The software can interpret and display any combination of up to 17 I²C bus interfaces, 8

synchronous serial (SPI) interfaces, and 34 asynchronous serial (RS232) data channels.

Printing

Print just the data you want to see

Simple file format

Each project file contains settings, notes, and sampled data for the project. Sampled data can be

exported to a separate file in a variety of formats, e.g. Microsoft Excel.

Few General Steps to operate the Logic Analyzer:

1. To create a new Project, File -> New

Figure 4 Create a New FIle

A default set of signals is displayed. The wire status changes without the cable plugged in.

2. From the Setup Menu select Signal Names to edit the signal names. The signals can

also be grouped for classifying data signals.

3. By right clicking on the signal cell, the user can edit or add signals to the list.

4. If using the CLK frequency f1, the Sample rate should be a minimum of 4 times f1 to

meaningfully acquire the data. The sample rate can be found in the tool bar near the

Page 6: Logic Analyzer Tutorial

top of the screen. The first drop-down menu has a “Sample Rate” option. Select this

option and then select the frequency from the drop-down menu next to it.

Figure 5 The Sample Rate Menu

5. The Logic Threshold is the threshold for the logic. For our logic circuit a voltage of

1.6V works fine.

6. Now, to acquire the data immediately we use the Trigger Immediate command (F7)

from the Acquisition menu.

Figure 6 The drop down menu for the Aquistion Menu

7. The buffer will be loaded with the captured data. The buffer position bar in the upper

right of the screen shows where the displayed data is located within the buffer.

Page 7: Logic Analyzer Tutorial

Figure 7 The Buffer SLider Bar

8. Cursors can be added to the waveform screen. There are 6 cursors (A,B,C,D,E,F) that

can be placed on the waveforms. The cursors can be moved along the waveforms and the

value of each signal is displayed in the Cursor column.

To add a cursor:

1. Move the mouse to the waveform. Right click on the waveform. Select the first menu

item – Place cursor. Then select a letter for the cursor (There can only be one cursor

for each letter). The cursor will appear on the waveform. Now you can move the

cursor by clicking on it with the mouse, holding the mouse key down, the cursor will

move with the mouse.

Figure 8 Inserting a Cursor

2. To see the values of the waveforms at the cursor – add a column for the cursor.

Page 8: Logic Analyzer Tutorial

3. To add a column:

1. Move the mouse to the column section.

2. Right click on the column

3. Select the insert column command.

4. Select the cursor command

5. The select the letter of the cursor you wish to see in a column.

6. The new column will appear to the left of the column selected.

As the cursor moves the values will change to reflect the waveform.

Figure 9 Adding a Cursor Column

Page 9: Logic Analyzer Tutorial

9. The State List tab lists the values in a state list table.

Figure 10 The State List

10. The Notes Tab is used to record any notes or information pertaining to the data saved.

Figure 11 The Note List

Page 10: Logic Analyzer Tutorial

LOGIC ANALYZER - Studying the 8051 Microcontroller

The Logic Analyzer software has several examples of sampled data that can be studied. This tutorial will

examine the 8051 Microcontroller examples.

The 8051 Microcontroller

Block Schematic

Refer to the block schematic. Note that the 8051 uses Port 0 for Address and Data, similar to the

8088 and the 8086. It also has an ALE, Read, and Write signals, like the 8088 and the 8086.

Therefore we can study the Read and Write cycles of the 8051 and gain a clearer understanding

of the 8088/86.

Typical usage the latched data and address are not accessible outside the microcontroller. To

look at them the UUT (unit under test) has an external register to capture the lower bits of the

address when ALE is high.

Note the XTAL, the clock, on the schematic. The examples are listed as “8051 With XTAL1”

and “8051 No XTAL1”. The first example demonstrates the waveforms sampled on the clock.

The second demonstrates the waveforms sampled on the falling edge of WR.

INSERT THE BLOCK SCHEMATIC

The Timing Diagram

The 8051 multiplexes its data and the lower 8 bits of its address on pins AD[7..0], on the

waveform these are signals AD[7..0]. The externally latched address bits are the signals Latched

A[7..0].

When PSEN is high --- DATA memory is being accessed.

When PSEN is low --- PROGRAM memory is being accessed.

INSERT THE TIMING DIAGRAM

Page 11: Logic Analyzer Tutorial

Load the Example

Figure 12 Loading the NoXtal Example

Load the NoXTAL example.

File → Open → Examples → 8051 No XTAL1.LPF

The logic analyzer will load the waveforms sampled when the trigger was the negative edge of

WR.

Note the time span of the sample: _________________

(This time will be different when we examine the waveforms with the XTAL trigger)

The far left column lists the names for all the waveforms. The Wire ID corresponds to the wire

that is physically delivering the data and the Cursor A and Cursor B columns list the values for

the waveforms at the cursor location.

Figure 13 The Columns listing the Values of the Signals

Page 12: Logic Analyzer Tutorial

The Buffer

The Buffer is continuously loaded, discarding the oldest data to save the newest data. The size of the

buffer is set, but the amount of time saved in the sample can vary depending on how the trigger is

configured. For the NoXTAL example, the trigger is set for the negative edge of the write signal. With

the XTAL example the trigger is based on the XTAL1. The result is that with each clock edge the data for

each waveform is loaded into the buffer. The buffer is a constant size, so a much greater amount of time

can be stored in the buffer of the NoXTAL sample. (Compare the time for the examples.)

Figure 14 The Entire Buffer Displayed

Page 13: Logic Analyzer Tutorial

The Memory Write Cycle - A cursor

Look at the waveforms at the A cursor:

RD = 1, WR = 0, PSEN = 1, ALE = 0 - The configuration for writing a value to data

memory address.

The lower 8 bits of the address to be written is already latched in the external latches:

A[15..0] = 2h LatchedA[7:0] = D1h

The memory address to be written is ….2D1h.

The AD[7..0] (which is shared by the A[7..0] and D[7..0]) contains the data to be written: 0h.

Figure 15 Close up of the A curosr

Page 14: Logic Analyzer Tutorial

The Memory Read Cycle at the B cursor.

RD = 1, WR =1, PSEN = 0, ALE = 0 The configuration for reading a value from program

memory address.

The data in Latched A[7..0] now contains the lower 7 bits of the address to be read.

The address to be read is : A[15..8]Latched A[7..0] = 2CDh.

The value at this address is Latched A[7..0] = D2h.

Use the zoom feature to examine the values in the Latched A. You will note with each positive

level of ALE the Latched A[7..0] changes.

Explain this behavior. Draw the relevant waveforms.

Figure 16 Close up of the B cursor

Page 15: Logic Analyzer Tutorial

The State List

Click on the State List tab at the top of the window. A full listing of the states for the waveforms

is shown. Cursor A (the red cursor) is shown in red; Cursor B (the blue cursor) is shown in blue

on the state table.

Figure 17 The State List

Page 16: Logic Analyzer Tutorial

Return to the wave forms page. Add a third cursor “C” in yellow. Then click back to the State

List. The state line corresponding to cursor “C” will be yellow.

The 8051 With XTAL1.LPF

Load the 8051 with the clock example.

File → Open → Examples → 8051 with XTAL1.LPF

The XTAL example is sampled on every positive clock edge. Note that the amount of time

covered by the sampling is much less than that for the NoXTAL example. The buffer is a fixed

size; the time span saved in the buffer is dependent upon the number and size of the samples.

The waveforms – zoom in, zoom out. Click on the States page – scroll down find the trigger.

Page 17: Logic Analyzer Tutorial

Finally, read the information posted in the notes page.

Figure 18 The Buffer of the XTAL Example

Figure 19 The Buffer of the No-Xtal Buffer

Page 18: Logic Analyzer Tutorial

Sample Exercise:

Objective:

In this exercise we will create and setup a complete project from start to finish. The project will

be based on an imaginary microprocessor circuit with the following characteristics:

8 Data lines,

16 Address lines

RST, CLK, RD, WR and IRQ signals

25MHz CPU clock

CMOS Logic with a +5V power supply.

We will setup to monitor all signals in timing mode, and to trigger on the rising edge of the IRQ

signal only if the RST signal is low. For the purpose of this exercise we are most interested in the

events which led up to the trigger event.

The LogicPort software should be running in Demo mode as you go through this exercise.

Demo mode is only available when the LogicPort hardware is not connected. If you have the

LogicPort connected, you can enter Demo mode by closing the LogicPort software,

disconnecting the LogicPort, then restarting the software.

As you open different dialogs during this exercise, you may need to rearrange the help and

dialog windows for more convenient access. You can use the left mouse button to drag any of the

windows by their title bar.

1. Create New Project:

From the File menu select New... to create a new project file.

A window will open asking for the name and location of your new project file.

Specify the name CPU and click.

2. Save. You do not need to add an extension, the software will append the correct

extension before saving the file.

Page 19: Logic Analyzer Tutorial

3. Step-by-step: Edit Signal Names:

New project files start with a default set of signals. Usually you will want to edit the

signal names to match your hardware.

From the Setup menu select Signal Names... to open a dialog which enables you to edit

the signal name for each wire. Wires D0 through D7 already have signal names Data0

through Data7 which are appropriate for our project, so we will leave the defaults for

these wires. Click on Data8 to edit the signal name for wire D8. Type Address0 in the

box at the top of the dialog. Continue editing the signal names for wires D9 through D23

in the same fashion using the signal names Address1 through Address15. Note that you

can use the Up and Down Arrow keys on the keyboard to scroll the signal list. Edit the

signal names for wires D24 through D27 and CLK1 as follows (CLK1 is at the bottom of

the list):

D24 : RST,D25 : RD,D26 : WR,D27 : IRQ,CLK1 : CLK

Click OK to dismiss the signal edit dialog

Page 20: Logic Analyzer Tutorial

4. Edit Groups:

New project files start with a default set of groups which can be edited or deleted as

desired. It’s not necessary to delete unused groups.

From the Setup menu select Groups... to open a dialog which enables you to edit the

groups contained in the project. The group named Data[7..0] is already setup

appropriately for our project. Click to highlight the group named Data[15..0]. Now right-

click to bring up the context sensitive menu, and click Edit Selected... to edit the group. A

dialog will open showing the group name Data[15..0] near the top. Change this name to

Address[15..0].

The default wires for this group are D0 through D15. We need to edit this group to

include only wires D8 through D23 (signals Address0 through Address15). Start by

selecting signals Data0 through Data7 in the Signals In Group list. You can use standard

Windows editing shortcuts to select signals. For example click Data0 then hold down the

Shift key on the keyboard and click Data7 to select the range of signals. Now click the <

button to remove these signals from the group.

Next select signals Address8 through Address15 in the Signals Available list, and click

the > button to add these signals to the group. The group should now include only signals

Address0 through Address15.

Click OK to dismiss the group edit dialog.

Select the Data[31..0] group, then right-click to bring up the context-sensitive menu.

Click Delete.

Selected to delete this unused group. Notice that the group disappears from the waveform

display as well.

Page 21: Logic Analyzer Tutorial

Click OK to dismiss the dialog.

5. Setup Waveform Display:

New projects start with a default set of signals and groups in the waveform display. For

this exercise we will edit the waveform display to better suit our needs.

Right-click the Clock2 cell in the waveform table to bring up a context-sensitive menu.

Click Remove Signal to remove this signal from the display.

Right-click the Signal cell in the waveform table to bring up a context-sensitive menu.

Click Add Signal... to open a dialog which enables you to select signals to be displayed in

the waveform window. You can select multiple signals by holding down the Control key

on the keyboard while selecting the signals. Scroll down the list and select all of the

following signals:

RST RD WR IRQ

Once all of these signals have been highlighted, release the Control key and click OK to

dismiss the dialog and add them to the display.

Right-click the Signal cell in the waveform table to bring up a context-sensitive menu.

Click Add Group... to open a dialog which enables you to select groups to be displayed in

the waveform window. Hold down the Control key on the keyboard and select both

groups Address [15..0] and Data[7..0].

Release the Control key and click OK to dismiss the dialog and add these two groups to

the display. With the left mouse button, click and drag the RST cell up one row to

rearrange the waveform table. From the Options menu, select Reference Position, then

click Right/Bottom to set the reference to the right-hand side of the display.

Page 22: Logic Analyzer Tutorial

6. Setup Sample Conditions:

From the Setup menu, select Sample Mode... to open the sample mode setup dialog.

Notice that timing mode is selected by default for new projects. Compression is also

enabled with typical Pre/Post-Fill Time Limits selected. These settings are correct for this

exercise, so dismiss the dialog by clicking the OK button.

The controls along the top of the Waveforms tab enable you to set other sample related

parameters. Since the CPU clock is 25MHz, we need a minimum sample rate of about

100MHz to acquire meaningful data. In this exercise, we are interested in seeing the

timing relationships between signals so we will use a higher sample rate of 200MHz to

get better resolution. Use the Sample Rate slider or drop-down list to select the 200MHz

sample rate.

Figure 20 The GUI Toolbar

The threshold for the CMOS logic in our imaginary circuit is 50% of the +5v power

supply voltage. Use the Logic Threshold slider to set the threshold to 2.50v.

Page 23: Logic Analyzer Tutorial

For the purpose of this exercise, we are most interested in the events which led up to the

trigger event, so use the Pre-Trigger Buffer control to reserve 99% of the sample buffer

for pre-trigger data (move the slider all the way to the right).

7. Setup Trigger Conditions:

From the Setup menu, select Trigger... to open the trigger setup dialog.

For this exercise we only need one level of trigger conditions, so at the top of the dialog

select Trigger When level B is satisfied from the drop-down list.

We will use edge B to detect the rising edge of the IRQ signal, and we will use pattern B

to prevent trigger from occurring unless RST is low. We don’t need the pattern B term to

be prequalified for this exercise, so make sure the Prequalify Pattern/Value Terms check-

box is not selected (this is the default for new projects).

Confirm that the check-box next to Edge B occurs is “checked” to enable the edge term

for trigger level B (this is the default for new projects). Since we are only interested in the

first occurrence of edge B, it doesn’t matter whether we select Cumulative or

Consecutive for this exercise.

Click the check-box next to Pattern B is to enable the pattern term for trigger level B.

Confirm that the drop down box is set to indicate Pattern B is True (this is the default for

new projects).

Page 24: Logic Analyzer Tutorial

Click OK to dismiss the trigger setup dialog.

We will set up trigger Pattern B and Edge B in the waveform table. The Pattern A and

Edge Columns are included by default for new projects. Since these columns are not

required for this exercise, we will set them to show Pattern B and Edge B instead.

You can do this by right-clicking the Pattern A cell at the top of the table to bring up a

context sensitive menu, then selecting Set Column>Pattern>B. Use the same method to

set the Edge A column to show Edge B.

Click once in the Pattern B cell for the RST signal to setup pattern B.

Click once in the Edge B cell for the IRQ signal to setup edge B.

We have now set the trigger conditions such that trigger will occur on the rising edge of

IRQ, but only when RST is low.

From the File menu, select Save to save all settings for the project file.

8. Connect to the Circuit:

First, expand the signal groups in the waveform table by right-clicking the Signal cell and

then clicking Expand All. We do this to make the color codes for all wires visible in the

Wire ID column.

The wires are organized as four groups of eight wires, plus two clock wires and four

ground wires.

Each group of eight wires shares a common color for the contact insulator. This color

matches the background colors in the wire ID column. Each of the eight wires within

these groups has a wire insulation color which matches the foreground (text) color in the

wire ID column. You can use these color codes to determine which wires connect to

specific signals in your hardware.

8. Acquire Data:

From the Acquisition menu, select Single to make a single data acquisition.

New data appears in the waveform window. Since the LogicPort software is running in

Demo mode, this will be simulated data. Note that the content of the simulated data

generated in Demo mode is not affected by any settings. It is there only to give an idea of

how the LogicPort represents signals.

Now select Recurring from the Acquisition menu.

New (simulated) data is now acquired and displayed in the waveform window on a

recurring basis.

Select Halt from the Acquisition menu to stop the recurring acquisition.

Note that with real hardware, acquisitions will not occur unless the trigger conditions are

met.

The last method of initiating acquisition is the Trigger Immediate command. This

command tells the LogicPort hardware to ignore the trigger settings and acquire new data

right now. You may want to use this command if your trigger settings are preventing

acquisition from occurring. With the Trigger Immediate command you can get a look at

Page 25: Logic Analyzer Tutorial

the hardware's activity without having to meet any trigger conditions. This is essentially

the same as selecting Trigger immediately when acquisition starts in the trigger setup

dialog.

Reference:

This tutorial is based on Intronix LogicPort Logic Analyzer. For more information, see

http://www.pctestinstruments.com