Agilent 16700A Demo Guide

Demo Guide
Publication number 16700-97003 March 1998
For Safety and Warranty information, see the pag e s be hind the index.
© Copyright Hewlett-Packard Company 1998
All Rights Reserved
HP 16700A-Series Logic Analysis System
The HP 16700A-Series Logic Analysis System Reduces Time to Insight
With the HP16700A-series logic analysis system:
Y ou can view target system behavior at many different levels of the design hierarchy: from analog signals (using an oscilloscope module), to the timing re la tionships of signals , to m icroprocessor execution, to source code, to bus execution, to overall system performance. Being able to look at a problem from many perspectives helps you gain insight into problems faster.
You can time-correlate different views of target system behavior (and use multiple views) to analyze the same target system event in different ways.
You can use a pattern generat or m o dule to provide stimulus to parts of the target system when testing hypotheses or analyzing the target system’s response to specific inputs.
You can use an emulation module to control microprocessor execution (run, stop, step, breakpoints) and display and modify the contents of microprocessor registers and memory.
You can explore data collected from your target system, perhaps data that captures a rarely occurring problem, in a more efficient way by taking deep-memory traces and by using post-processing filtering tools. Yo u can also trig ger on a specific s equence of event s and store only the data of interest to capture execution over a longer time.
You can export critical data from your target system, import it later, and compare it to new data.
You can share the networked logic analysis system among project team members to facilitate communication and collaborative debugging.
You can solve problems quickly and move on to the next problem, speeding up your overall development time.
These capabilities let you identify problems and track them to their root cause. They let you explain all the symptoms of a problem and give you confidence in your solution.
3

In This Book

This demo guide shows many of the things you can do with the
HP 16700A -series logic analysis system. It’s part of a demo kit that includes a MPC860 microprocessor-based system.
Y o u can probe the MPC860 de mo board by conn ecting the log ic analyzer modules and emulation modules. Later you will connect the oscilloscope, pattern generator, and high-speed logic analysis modules. Then, you can follow the instructions in this guide to capture and analyze MPC860 demo board execution. You will see some of the more powerful ways you can use the logic analysis system to debug and verify your own target systems.
This demo guide shows:
You can quickly set up the logic analysis system to capture hundreds of waveforms. You can also use the Setup Assistant to quickly trace microprocessor execution, inverse assemble the microprocessor trace, perform run control functions, and correlate source code.
You can quickly find hardware and software interaction problems by correlating views of the captured data with traces of microprocessor execution, and by analyzing system performance.
You can quickly find the cause of difficult hardware problems using HP’s deep-memory logic analyzers, high-speed logic analyzers, and pattern generators.
This demo guide also contains an appendix that describes the MPC860 demo board and its firmware in more detail and state and timing.

Contents

The HP 16700A-Series Logic Analysis System Reduces Time to Insight
In This Book
1 Getting Started
Connecting the demo board to analyzer 10 Connecting the demo board to the em ul ati on m o dule 13
2 Quickly Set Up the Analysis System
Tracing Hundreds of Your Target’s Signals 16
Connecting the analyzer to your target 17 Using an HP logic analysis module 18
Tracing Processor Code Execution with Source Code Correlation 24
HP’s Processor Solutions 24 Using the Setup Assistant 29
3 Quickly Find the Cause of Difficult HW/SW Interaction
Problems
Looking at Correlated Hardware/Software Traces 44
Correlating processor execution with external buses 45 Tracking hardware problems to their software causes 54 Tracking software problems to their hardware causes 63
Looking at Firmware Driver Issues 71
Controlling and modify ing processor execution 72 Downloading code to RAM or Flash ROM 81
5
Contents
Synchronizing stim ulus to processor exec uti o n 84
Looking at Software Issues 89
Analyzing system performance 90 Tracking processor execution with caches turned on 98
4 Quickly Find the Cause of Difficult Hardware Problems
Capturing Very Deep Traces 104
Using logic analyzers with deep memory 105
Creating Stimulus for Target Hardware 110
Using the pattern ge nerator 111
Verifying Setup/Hold Violations 120
Using the high-speed logic analyzers 121
A About the MPC860 Demo Board
Demo Board Hardware 130
Introduction 130 Configuring the Logic Analysis System for the Demo Board 130 Demo Board Connector Mapping 134 Demo Board Features 138
Demo Board Firmware 143
Introduction 143 Overview of main() 143 Overview of proc_specific 146 Variables 147 Using the PowerPC 860 Emulation Module 150
Recommended Demo Configuration 151
Why use Recommended Demo Configuration 151
6
Contents
B Concepts
Timing Analysis vs. State Analysis in Logic Analyzers 154
Glossary
Index
7
Contents
8
1

Getting Started

9
Chapter 1: Getting Started

Connecting the demo board to analyzer

The following provides instructions for connecting the demo board to the logic analyzer. The instructions, as well as the entire guide, assume that your analysis system has the recommended configuration of modules.
Go to “Recommended Demo Configuration” on page 151 for instructions on verifying your configuration.
If the logic analysis system does not have the recommended configuration, you can still connect the demo board by following the instructions provided by the Setup Assistant (go to “Using the Setup Assistant” on page 29) . However, some of the exercise may not work properly; this will depend on the particular configuration you use.
First connect the logic analysis modules. There are two, four pod modules that provide the five pods of logic analysis required for some of the exercises. The analyzers are connected together internally, with the module in slot E serving as master and the module in slot D serving as expansion.
A B C D E
Five Slots for Measurement Modules
Pod 3
Pod 4
Pod 3
Pod 4
Pod 1
Pod 2
Pod 1
Pod 2
1
2
Two Slots for Emulation Modules
Connecting the first two pods are straight forward, connect pod 1 and 2 of the master analysis module to the 1 and 2 pod locations on the lower edge demo board, away from the LCD
Chapter 1: Getting Started
display. The remaining connections are less straight forward and are as follows:
'HPRERDUG /RJLF$QDO\]HU
3RG 6ORW'3RG
3RG 6ORW'3RG
3RG 6ORW(3RG
Slot D, Pod 1 Slot D, Pod 2
Digital Systems Debug Demo
Slot E, Pod 3
Slot E, Pod 1 Slot E, Pod 2
As you can see in the picture above, there are two pod s 1 and 2. Follow the table carefully to get the right connections. The pods must be connected in the order described above so the
11
Chapter 1: Getting Started
timing measurements, pod 5 on the demo board, can be made on the master analysis module.
NOTE: Only connect the pattern generator data pods when a particular demo
exercise requires them. When the pattern generator data pods are connected, the pattern generator by default takes control of the L CD display . When this h appens, th e processor wil l make 2,000 at tempts at writing to the display before going on with program execution. Needless to say, this significantly slows down the execution of the demo board code and will affect measurement results.
Chapter 1: Getting Started

Connecting the demo board to the emulation module

Now, connect the emulation module.
Emulation Module
Notice in the previous picture of the back of the logic analysis system that there are two emulation module slots. This is so that you may control more than one processor at a time.
If the emulation module cable is not connected to the emulation module, do so now. Connect the other end of the cable to the demo board. It goes on the edge with no logic analyzer cables connected to it.
13
Chapter 1: Getting Started
2

Quickly Set Up the Analysis System

15
Chapter 2: Quickly Set Up the Analysis System

Tracing Hundreds of Your Target’s Signals

Tracing Hundreds of Your Target’s Signals
Being able to capture and display a large number of logic analyzer channels helps you look at more target system execution at one time.
By using a logic analyzer’s flying lead set, you can probe and look at digital signals in any part of a target system.
By loading the HP 16700A-series logic analysis system with logic analyzer cards and using the logic analysis system’s display capabilities, you can easily view and manage a large number of waveforms.
Chapter 2: Quickly Set Up the Analys is Sy stem
Tracing Hundreds of Your Target’s Signals

Connecting the analyzer to your target

The most common way to probe a target system is with a f lying lead set. The flying lead sets connect to logic analyzer pods to provide 16 individual data connections and one clock connection. HP provides a variety of clips and connections that attach to the flying leads and make it easier to attach to fine­pitch leads.
Two other methods for attaching the analyzer to your target system are discussed at the beginning of the next exercise.
17
Chapter 2: Quickly Set Up the Analysis System
Tracing Hundreds of Your Target’s Signals

Using an HP logic analysis module

HP has a variety of logic analysis modules for tracing your
target system’s signals. They range in channel count, trace depth, and acquisition speed. This exercise uses two of the HP 16555D logic analysis modules that have been tied together to function as one analyzer. However, it pretty much applies to all HP analysis modules. For an exercise specific to deep trace, go to “Capturing Very Deep Traces” on page 104.
In this exercise, you will see how the large windows and features of the HP 16700A-series logic analysis system make it easy to manage a large number of waveforms. The HP 16700A­series logic analysis systems can be configured with as many as 1,020 channels of analysis.
1 Probe the MPC860 demo board.
Follow the instructions in the “Getting Started” chapter on page 9 for connecting the logic analysis module to the demo board.
NOTE: The emulation module connection should NOT be made; it could put
the processor into reset, preventing it from running, which is necessary for this exercise.
2 Start with the default configuration.
T o get a defau lt configurat ion, go to the “ 16700A Logic Anal ysis System” window, select the “Exit” button in the lower right­hand corner, and click “OK” in the dialog that comes up.
When the session has ended, go to the “Session Manager” window, and select “Start Session on This Display”.
Chapter 2: Quickly Set Up the Analys is Sy stem
Tracing Hundreds of Your Target’s Signals
3 Set up trigger, and run measurement
When the “16700A Logic Analysis System” window has come up, select the “HP16555D” button on the left-hand side and select “Waveform<1>...” from the popup menu.
Click the green “Run” button to take a trace of the lower 16 bits of the address bus.
4 Display the captured data.
Maximize the “Waveform<1>” window. You are looking at an overlaid trace of 16 bits of the address
bus; in other words, each of the individual traces of the address bus bits are displayed in this one trace. You can see the hexadecimal value of the address bus where there is space to display it.
19
Chapter 2: Quickly Set Up the Analysis System
Tracing Hundreds of Your Target’s Signals
T o see e ach individual address line, right-click on “Lab1 all” and select “Expand”. Notice that each “Lab1” is now individually numbered.
To overlay the lines again, right-click on one of the “Lab1” signals, and select “Overlay”.
5 Replicate the one occurrence of “Lab1 all” several times.
T o get to the point of this exe rcise, managi ng a large number of waveforms, the Lab1 trace will be replicated multiple times.
Right-click on “Lab1 all”, select “Insert after...”, and a label dialog comes up. This dialog lets you add more labels to the display, either one bit at a time or as overlaid signal sets. The default is overlaid. Add 9 more of the overlaid “Lab1 all” to the Waveform<1> window by clicking “Apply” 9 times; then, close the dialog.
Chapter 2: Quickly Set Up the Analysis System
Tracing Hundreds of Your Target’s Signals
6 Add color to waveforms.
We now have a total of 160 waveforms displayed. To help identify them more easily, you can add some color.
Pick the second “Lab1 all” from the top, right-click on it, and select “Change attributes...”. Select the red radio button to the right of “Color” and click “OK”.
Try changing some of the other “Lab1 all”. Now, expand one of the colored “Lab1 all” and see how the
coloring helps you to follow the timing waveforms.
7 Zoom in on the information of interest.
Pick an area in the waveform trace that you want to look at more closely. Left-click inside the black waveform display area to the left of the area of interest to you. Drag the mouse to the right side of the area you are interested in. This will display a rectangle encompassing the area that the display will be expanded to.
21
Chapter 2: Quickly Set Up the Analysis System
Tracing Hundreds of Your Target’s Signals
Rectangle
When you let go the mouse button, the display will expand horizontally so you can better see the area you are interest in.
8 Use timing markers to establish the timing relationship
between edges in the waveforms displayed.
Right-click on an edge that you are interested in, select “Place Marker >”, and select “G1”.
Right-click on another edge that you would like timing information about relative to the G1 marker, and select “G2”.
Select the “Markers” tab and select the list arrow next to the text window for the G1 marker that says “Trigger”.
Chapter 2: Quickly Set Up the Analysis System
Tracing Hundreds of Your Target’s Signals
Select G2 from the list. What you see displayed to the right of the G1 marker line is the time between the G1 and G2 markers.
If you would like to learn more about the analysis system’s search capabilities, go to “Capturing Very Deep Traces” on page 104.
Summary By using the logic analysis system’s large display capabilities,
you can easily view and manage a large number of waveforms.
23
Chapter 2: Quickly Set Up the Analysis System

Tracing Processor Code Execution with Sourc e Code Correlation

Tracing Processor Code Execution with Source Code Correlation

HP’s Processor Solutions

Probing target system circuits can be difficult. The narrow spacing of surface mount package pins and the dozens of connections that a microprocessor requires might make the task seem almost impossible.
However, HP and its channel partners provide products that make probing surface mount packages and microprocessors easier. HP also provides products like emulation modules and the source correlation tool set that make debugging microprocessor execution easier.
Analysis Probes
HP and its channel partners provide analysis probes for probing microprocessors and standard buses. Analysis probes are available for over 200 microprocessors and standard buses.
Analysis probes provide the mechanical connection, electrical connection, active circuitry (when necessary), and the software required to trace and inverse assemble microprocessor execution. The following demo, “Using an HP
logic analysis module” on page18, will give you a good feel for the benefits provided by analysis probe software.
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
Analysis probes plug into Pin Grid Array (PGA) sockets, bus connectors, and even clamp over Thin Quad Flat Pack (TQFP) packages and connect to Ball Grid Array (BGA) footprints. They bring dozens of connections out to logic analyzer pods. Analysis probes are typically low profile compact boards with minimum capacitive loading.
Designing Connections into Your Target System. When probing microprocessor cores embedded in ASICs or when analysis probes cannot be used for some other reason, you can design logic analyzer connections into your target system and purchase an inverse assembler for your processor separately.
HP provides information on designing several types of logic analyzer connections into target systems (which vary in cost and connection density).
Connectors can range from the 0.1 inch 2x20 connectors (like the five around the edge of the MPC860 demo board) to the high-density Mictor38 connectors (like the three on top of the demo board). The Mictor38 connectors provide connections for two logic analyzer pods each, while the 2x20 connectors provide connections for one logic analyzer pod. The Mictor38 connectors require that you use the HP E5346A high-density termination adapters.
25
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
Emulation Modules
The HP 16700A-series logic analysis system can contain
emulation modules that use a processor’s Background Debug Mode (BDM) or JTAG port to control the processor. You can run a microprocessor, stop it, set breakpoints, modify the contents of microprocessor registers and memory locations, and download code to RAM and Flash ROM.
The analysis system can contain up to two emulation modules. This provides support for systems that have both a microprocessor and a DSP, or two microprocessors.
Emulation Module
HP’s emulation module require a Target Interface Module (TIM) to connect to the processor’s BDM or JTAG port (see picture). A different TIM is used for each processor or processor family to adapt the emulation module’s connections to the processor’s. The 860 demo board that you will be using in the following demo exercises does not need a TIM because we have built it into the board.
Emulation Probes
Emulation probes are just stand-alone emulation modules. They, combined with a commercial debugger, provide an economical run control solution.
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
Emulation probes can also be accessed from the HP 16700A­series logic analysis system to provide run control for more than two processors.
Below is a drawing of an emulation probe with a TIM attached.
Source Correlation Tool Set
The source correlation tool set add-on for the HP 16700A­series logic analysis system lets you view the source code that corresponds to data captured on the microprocessor bus.
The source correlation tool set requires that symbol information be loaded into the logic analyzer from the target
system program’s object file.
27
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
Processor Solution Packages
You can order HP processor solution packages that combine an analysis probe, an emulation probe, and the source correlation tool set for a particular microprocessor.
Processor Solution Information on the Web
You can find up-to-date processor solution information on the world-wide web at:
http://www.hp.com/go/uPsolutions
Or, contact your HP sales representative.
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation

Using the Setup Assistant

The HP 16700A-series logic analysis system includes a setup assistant to help you configure the logic analyzer for a
particular analysis probe. It also configures the emulation module for the selected processor and helps you read in your symbol file for the inverse assembly and Source Viewer.
The setup assistant analyzes the configuration of your logic analyzer and the type of microprocessor you want to trace. Then, it asks what options you want implemented. The setup assistant tells you how to connect the analyzer probes, and it creates the necessary configurations.
You only need to run the setup assistant when you start working with a new processor or when you change the configuration of the logic analyzer. Once the setup assistant has created a configuration, it can be saved and reloaded.
The following steps show you how to use the setup assistant to trace microprocessor execution on the MPC860 demo board and view the source code associated with captured data.
1 Start with the default configuration.
T o get a defaul t configurat ion, go to the “ 16700A Logic Anal ysis System” window, select the “Exit” button in the lower right­hand corner, and click “OK” in the dialog that comes up.
When the session has ended, go to the “Session Manager” window, and select “Start Session on This Display”.
2 Start the setup assistant.
Go to the “16700 Logic Analysis System” dialog and select “Setup Assistant” from the bottom buttons.
29
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
The “Setup Assistant – Introduction” dialog will be launched. Select “Full measurement - …..” and then select “Next -->” to go to the next dialog.
3 Identify your microprocessor
The “Setup Assistant – Target and Analysis Probe or Interface Software” dialog now comes up. This is where you tell the setup assistant what processor you are using and whether you are using an analysis probe or connecting directly to your target.
0LFURSURFHVVRU6XSSRUW
Processors are added on a regular basis, so if you do not see the one you need, check with yo u r HP sales representative to see if it has become available.
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
Tell the setup assistant you are using the MPC860 demo board (which has built-in connections for the logic analyzer).
Select “Demo” from the list which expands to “MPC860 Demo Board” and “HP Digital Systems Debug”, then go to the next dialog.
4 Select the logic analyzer.
The “Setup Assistant – Select Logic Analyzer” dialog is now up. This dialog presents you with a list of analyzer modules installed in your system that are suitable for the analysis probe you are using.
If you have the standard demo set of modules in your system, only one analyzer is listed. Select the logic analyzer, and go to the next dialog.
31
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
5 Connect the demo board to the logic analyzer.
This brings up the “Setup Assistant – Connecting to the Logic Analyzer” dialog. This dialog tells you how to connect the analyzer module to the demo board.
A B C D E
Five Slots for Measurement Modules
Pod 3
Pod 4
Pod 3
Pod 4
Pod 1
Pod 2
Pod 1
Pod 2
1
2
Two Slots for Emulation Modules
When you are done connecting the logic analyzer to the demo board, select “Next -->”.
The setup assistant now loads the proper configuration for the demo board, and the proper inverse assembler, into the HP 16555D analysis modu le . Clic k “OK” to clear the
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
informational dialogs that pop up during this part of the exercise.
NOTE: Don’t connect the pattern generator just yet . Th e default pattern
generator signal level outputs will turn off the MPC860 demo board’s LCD display.
6 Set the inverse assembler preferences and filter for the
demo board.
NOTE: It is imp ortan t that yo u fo llo w t he inst ruct ion s in the “Set up As sis tant
- Additional Analyzer Infor m ation” dialog. This is not optional .
Follow the instructions in the “Setup Assistant – Additional Analyzer Information” dialog for entering the demo board memory map and for setting up the filter.
Note that the MPC860 processor does not provide status information that distinguishes between data and instruction fetches. Therefore, you must provide that information.
After you have set the inverse assembler preferences and filter for the demo board, go to the next dialog.
33
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
7 Connect the demo board to the emulation module.
The “Setup Assistant – Emulation” dialog comes up at this point.
If you have the standard demo set of modules, the setup assistant will detect an emulation module in your system.
35
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
Select “Yes” to have the MPC860 personality loaded into the module, then go the next dialog.
The “Setup Assistant – Emulation Module/Probe Connections” dialog gives you instructions on how to connect the emulation module to the demo board.
When you finish connecting the emulation module cable, proceed to the next dialog.
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
Emulation Module
The setup assistant will now install the MPC860 personality and
launch the “Run Control – Emulator 1” dialog.
It is possible to have two emulation modules installed in the system. The second emulation module can be used when debugging dual processor target systems or target systems with digital signal processors (DSPs).
8 Turn on the Source Viewer.
The “Setup Assistant – Source Correlation” dialog should now be up. If it isn’t, it could be that the source correlation tool set license has not been turned on for the system you are using. Contact your HP representative to get this corrected.
Select “Yes” to have the setup assistant install the source correlation tool set. The source correlation tool set lets you
37
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
view the high-level source code associated with data captured by the logic analyzer.
Go to the next dialog.
9 Identify the location of the demo board’s source code.
The “Setup Assistant – Source Code Location” dialog helps you load your source code. Source code can be located on a remote computer in your network (if the logic analyzer has been connected to the network), or you could have transferred the source code to the logic analyzer’s hard disk. In this example, the source code for the demo board is located on the logic analyzer’s hard disk.
Select “on the 16700A hard disk” and go to the next dialog, “Setup Assistant – Symbol Loading”.
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
10 Load the symbol file.
Select “Load Symbol File…”.
The dialog launched is the analysis module’s Setup dialog. The “Symbol” tab has been pre-selected for you. Select the “Browse…” button next to the “Load This Object/Symbol File for Label: ADDR” text box.
Open the demo folder by clicking on the plus symbol in front of it. Open the 860_demo_board folder, select the Source folder, and then scroll down to the file called q.elf.
39
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
Select the “q.elf” file in the “demo/860_demo_board/Source” directory, and click the “Load” button. The symbol file for the demo board has now been loaded.
Minimize the “2M Sample 110 MHz State/500 MHz Timing E – MPC860 BUS” dialog.
Go to the next Setup Assistant dialog. You will find that this opens the Source Viewer display and the Listing display. These are the dialogs that you will use to trace the MPC860 microprocessor.
11 Save the configuration.
The “Setup Assistant – Saving to Disk” dialog is now up. This dialog prompts you to save your configuration to disk. If you save the configuration, you can load it the next time you turn
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Source Cod e Correlation
on the analyzer; this lets you configure the logic analysis system without having re-run the setup assistant.
12 Exit the Setup Assistant.
The “Setup Assistant – Taking Measurements” dialog is your last dialog in the Setup Assistant.
:KDWWR'R1H[W
You can get some suggestions about what to do next by selecting
“Next Steps”. This will take you into the on-line help system.
Since you will be getting help from this demo guide as to what to do next, just select “Done” for now.
41
Chapter 2: Quickly Set Up the Analysis System
Tracing Processor Code Execution with Sourc e Code Correlation
13 Start MPC860 demo board execution.
Now you are ready to take a trace. First, you must get the MPC860 microprocessor running. Run Control starts up in reset
by default. Click the “Run” button in the “Run Control – Emulator 1” dialog, you should see “MPC860—Running user program” at the bottom of the dialog.
14 Capture MPC860 demo board execution.
Now, click the green Run button in any window and the analyzer will take a trace for you.
15 Display the captured data.
Open the “Listing” display. Scroll through the listing and watch how the source viewer follows along.
Go to the Source Viewer display, select the “Step Source” tab, and click “Previous” and “Next” to step through the source code. Watch how the “Listing” trace follows the source code.
Summary You can quickly set up the logic analysis system to capture a
specific microprocessor’s execution using HP’s probing, run control, source code viewing, and setup assistant tools.
3

Quickly Find the Cause of Difficult HW/SW Interaction Problems

43
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems

Looking at Correlated Hardware/Software Traces

Looking at Correlated Hardware/Software Traces
Being able to look at a problem from different perspectives helps you gain insight into problems faster.
By looking at different areas in a target system and by time correlating the captured data, you can view the flow of data from one part of the target system to the next.
By looking at the analog values of a signal as well as the digital values and by time-correlating the captured data to a trace of the processor, you can see how hardware symptoms might be caused by a software problem or how software symptoms might be caused by a hardware problem.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces

Correlating processor execution with external buses

You can follow the flow of data in a target system by capturing and correlating data from different parts of the target system. For example, you can see how data flows from a microprocessor bus to an external bus or port.
$QDO\VLV3UREHVIRU6WDQGDUG%XVHV
$QDO\VLV3UREHVDUHDYDLODEOHIRURYHUDGR]HQEXVHV7KLVLQFOXGHV3&,,6$ 3&0&,$6&6,DQG86%90(DQGPRUH$QDO\VLVSUREHVPDNHLWHDV\WR FRQQHFWWKHORJLFDQDO\]HUWRDEXV7KH\SURYLGHFLUFXLWU\WRGHFRGHWKHEXV·V YDULRXVVWDWHVDQGWKH\FRQILJXUHWKHDQDO\]HUWR FRUUHFWO\SUHVHQWWKHEXV·VVWDWHV LQV\PEROLFIRUP
9LVLWWKH+3ZHEVLWHDWZZZKSFRPJRX37RROVRUFRQWDFW\RXU+3VDOHV UHSUHVHQWDWLYHIRUDFXUUHQWOLVWRIEXVHVVXSSRUWHGE\DQDO\VLVSUREHV
On the MPC860 demo board, you can capture code executed on the microprocessor bus and correlate it to the waveform trace captured on the asynchronous, serial Controller Area Network (CAN) bus.
Also, you can use the logic analysis system’s serial analysis tool set to interpret the waveform trace of the CAN bus.
As is the case in this demo, you can configure a logic analysis module into two “virtual” logic analyzers:
one logic analyzer that captures microprocessor execution synchronously with the microprocess or’s clock (a state analyzer).
one logic analyzer that captures data on the CAN bus asynchronously at sample rate determined by an internal clock (a timing analyzer).
45
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
(For more explanation of the difference between timing and state analyzers, see “T iming Analysis vs. State Analysis i n Logic
Analyzers” on page 154.) The two virtual analyzers can run independently, or, as in this
demo, the trigger of the MPC860 BUS analyzer can arm the DemoTiming analyzer.
For this exercise, Analyzer1, called “MPC860 BUS”, is configured as a state analyzer to trace the demo board’s processor. Pods 1 and 2 of the slot E analysis module and Pods 1 and 2 of the slot D module have been assigned to this analyzer. These pods are connected to the processor.
Analyzer2, called “DemoTiming”, is configured as a timing analyzer. Pods 3 and 4 of the slot E analysis module have been assigned to this analyzer . Pod 3 is connected to the CAN bus TX line, IRQ2, and CAN clock.
860
Microprocessor
Bus Signals
MPC860 BUS
Analyzer
Listing <1>
Captured State Data
MPC860 Listing
Waveform <1>
CAN Waveform
Listing <2>
Serial Tool
Listing
IRQ2
Controller
CAN Clock
CAN
CAN TX
Arm Signal
Trigger
Immediate
DemoTiming
CAN Analyzer
Captured Timing Data
Serial
Analysis
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
1 Probe the MPC860 demo board.
Follow the instructions in the “Getting Started” chapter on
page 9 for connecting the logic analysis module to the demo board.
NOTE: Make sure the pattern generator data pods are not conne cte d to the
demo board; otherwis e, the changes in demo program execu tion will affect the results of the me asurements that follow.
2 Load the configuration files for this demo.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog, select the CAN_bus.___ configuration file from the /hplogic/demo/860_dem o_bo ard/ configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
47
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the
emulation module to read the microprocessor’s configuration registers (whose contents enable breakpoints among other things).
4 Set up to trigger on a source line.
To follow the flow of data from when it is fetched from mem ory to when it flows on the CAN bus, first trigger the analyzer that captures microprocessor execution when data is fetched from memory.
To set this trigger up, go to the “Browse Source” tab of the “Source Viewer<1>” window, click “File Selection...”, select the /hplogic/demo/ 860_demo_board/so u rce /p r oc_spec.c file, and click OK. This is the source code for one of the main functions executed by the MPC860 demo board.
Scroll down to line 130, which is the beginning of the CAN bus stimulus routine. You can see that this is where the data string that is going to be put onto the CAN bus gets built up. This data string includes marker bytes 11, 22, 33, 44, and temperature bytes.
If you would like to better understand the purpose of the temperature values, see the overview of the code that is executing in the demo board located in the Appendix , “About the MPC860 Demo Board,” on page 129.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
To set up the logic analyzer trigger, click on line 138 and select
the “T r ace about this l ine” opti on. Make sure the he ading of th e option list says “line # 13 8.
5 Click the green Run button to perform the measurement. 6 Display the captured microprocessor data.
Go to the microprocessor trace listing, right click in the listing area, select “Goto Marker >”, and select “Trigger”. This places the center of the listing on the trigger point. You see that the highlighted line of the source viewer is line 138.
49
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
Scroll down through the listing and you see the value of the four temperatures being fetched from memory. The data reads are in yellow. Notice the correct symbols for the temperatures are used in the PC column.
Continue to scroll down until you see the turquoise data writes to the CAN bus controller. You see that the temperature markers and then the temperatures were written to the controller. You then see that a 0x43 and 0xE6 was written to the controller. This told the controller to transmit the data.
7 Display the captured CAN bus data using the serial
analysis tool set.
Now, verify that the correct data was transmitted on the CAN bus.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
Click one of the “Navigate” buttons. Select “DemoTiming >”, and select Waveform<2>.
This brings up the waveform trace of the CAN bus that was taken when you last ran the analyzer. It is a trace of the CAN clock, CAN transmit line, and CAN interrupt line. The trigger point on the trace is the same trigger point that is on the processor listing.
Now, look at the output of the serial tool to verify that the correct data was placed on the CAN bus. Click one of the “Navigate” buttons”, select “DemoTiming >”, and select “Listing<2>...”.
This listing is the output of the serial analysis tool. The listing shows the start block of the transmission (0CCC), the data transmitted, and the end block (7F). You see that the data fetched from memory was correctly transmitted on the CAN bus
8 Use global markers to correlate the captured data.
You can use the global markers to help you look at what the serial analysis tool is doing.
51
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
Right click in the listing area of the “Listing<2>” dialog. Select “Place Marker >” and “G1” .
Drag the G1 marker to just under the first 0CCC. Place the G2 marker in the listing and drag it to just under the
11 in the data stream Go to the “Waveform<2>” dialog. Place the pointer just to the
left of the beginning of the CAN bus transmission. Click and hold the left mouse button and drag the left edge of the rectangle that was formed to a point just to the right of the G2 marker.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
You now have an expanded view of the trace. You can see the form of the data transmitted on the CAN bus. (Keep in mind the CAN bus protocol specifies that a 0 gets added, or stuffed, after five 1s and a 1 gets stuffed after five 0s.)
Summary By looking at different areas in a target system and by
correlating the captured data, you can view the flow of data from one part of the target system to the next.
53
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces

Tracking hardware problems to their software causes

You can identify a problem with an analog signal using an oscilloscope module, trigger a logic analyzer module tracing software execution, and correlate the captured data to identify the cause of the problem all the way to the source code.
For example, the demo board’s MPC860 processor has been programmed to generate a triangular waveform from a D/A converter, but the oscilloscope module shows problems with the waveform.
Stair-step
Flat
distortion
distortion
There are two problems with the triangular waveform: when the voltage is flat for approximately 350 microseconds, and when the voltage is flat for shorter times in varying numbers and duration, leading to a stair step effect.
1 Connect the logic analyzer, emulation module, and
oscilloscope to the demo board.
Follow the instructions in the “Getting Started” chapter on page 9 for connecting the logic analysis module to the demo board.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
Also, connect the channel 1 oscilloscope probe to the D/A test point on the demo board. And, connect the ground clip to the GND test point.
NOTE: Make sure the pattern generator data pods are not conne cte d to the
demo board; otherwis e, the changes in demo program execu tion will affect the results of the me asurements that follow.
55
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
2 Load the configuration files for this demo.
Setup Display
Oscilloscope
Display
Listing <1>
MPC860 Listing
D/A
Converter
860
Microprocessor
D/A Output
Bus Signals
Oscilloscope
Arm Signal
Trigger
Immediate
MPC860 BUS
Analyzer
Analog Trace Data
Captured State Data
You will be loading the above configuration that will allow you to make a time-correlated measurement involving the oscilloscope and logic analysis modules. The oscilloscope module is configured to arm the logic analysis module when it triggers. The logic analysis module, in turn, is configured to trigger immediately when it is armed. This results in the two traces occurring at the same time and allows them to be time­correlated.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog, select the D_to_A.___ co nfigura tion file from the /hplogic/demo/860_demo_board/configs/hp1670x directory, and click the Load... button.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the emulation module to read the microprocessor’s configuration registers (whose contents enable breakpoints among other things).
57
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
4 Start the oscilloscope measurement.
Select “Trigger…” on the bottom of the oscilloscope display. Notice that the oscilloscope has been set up to trigger on an edge.
Click the “Group Run” button to take a trace and view the triangular waveforms. You should see the “flat distortion” defect, but you may not see the “stair step” distortion because it is very intermittent.
Click “Group Run” to view the captured waveforms a few more times. You see that the triangular waveform goes through various forms, from mildly distorted to heavily distorted. Notice that the heavily distorted triangular waveforms are infrequent.
5 Modify the oscilloscope trigger.
Now, set up the oscilloscope to trigger on a heavily distorted waveform. Go to the “Trigger Setup – 2 Gsa/s Scope” dialog by selecting “Trigger…”; then, select the “Pa tte rn” radio button.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
The pattern trigger has already been setup for a waveform that stays above 800 mV for more than 1.2 msec.
Click “Group Run” to capture one of the heavily distorted waveforms. (It may take several seconds because the waveforms are so infrequent.)
If the oscilloscope does not trigger, it may be because of variations in the demo boards. Shorten the period of the pattern trigger to capture a less distorted version of the waveform.
Close the trigger dialog to get it out of the way
59
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
6 Open the Listing and Source Viewer displays.
Click the “Navigate” button, select the “MPC860 BUS >” option, and select “Listing<1>...”.
Click the “Navigate” button again, select the “MPC860 BUS >” option, and select “Source Viewer<1>...”.
Move the Listing<1> window to the lower right hand corner of the screen and the Source Viewer window to the upper left hand corner of the screen to get them out of the way.
7 Use global markers to correlate the captured data.
*OREDO0DUNHUV
7KHORJLFDQDO\VLVV\VWHPSUR YLGHVWLPLQJPDUNHUV WKDWVSDQDQ \PRGXOHVWKDWKD YH EHHQFRUUHODWHG3ODFLQJDPDUNHULQW KHGLVSOD\ RIRQH PRGXOHSRVLWLRQVDQ LGHQWLFDO PDUNHUDWWKHFRUUHFWWLPHSRVLWLRQLQDOOFRUUHODWHGPRGXOHGLVSOD\V
Now, mark off the 350 microsecond (approximat el y) flat distortion with the global markers. Right click on the oscilloscope trace and select “Place marker >” and select “G1”. Don’t worry about getting the marker in exactly the right place at first, because they can be dragged into place after they appear. Place the G1 marker just past the end of the 350 microsecond (approximately) stretch in the triangular waveform. Place the G2 marker just before the beginning of the stretch.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
Note that the inverse assembled listing has now moved to the location of the code that was executed at the G2 marker.
Bring the Source Viewer to the front and then bring the processor trace listing to the front. As you scroll through the processor trace listing, watch the Source Viewer. Yo u see the source code move from running D/A code at the G2 marker to
61
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
servicing CAN interrupts. It will pass through the CAN service routine twice. You may have to back up a bit to get into the section of code that writes to the D/A controller. This is because it is difficult to place the marker precisely at the beginning of the flat distortion.
When you go past the G1 marker, you see the code go from the CAN service routine back to the main loop, which updates the D/A. You may also see the IRQ3 service routine execute while you are scrolling.
Summary You can see that the CAN interrupt postpones the updating of
the D/A voltage for over 350 microseconds. If the D/A update was considered more important than the CAN controller, you could modify the code to give priority to the D/A controller.
Y o u can go through the same p rocedure to identify the cause of the smaller stair step distortions in the D/A output signal. By placing the G1 marker at the end of one of the stair steps, placing the G2 marker at the beginning, and scrolling through the listing, you can see that IRQ3 servicing is responsible for stair step effect.
See Also “Controlling and modifying processor execution” on page 72.
There you will turn off interrupts and o bserve t he effect on the D/A waveform.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces

Tracking software problems to their hardware causes

When software execution behaves in a way that doesn’t seem logically possible, you may have to look beyond the logical (digital) behavior of the system to the physical behavior, for example, by looking at the analog parameters of signals. If you can capture a software execution problem with the logic analyzer , you can also capture oscilloscope data from the target system at the same time, and you can correlate the captured data using global markers.
For example, in the MPC860 demo board’s program code there are instructions that should never execute. However, if you set up the logic analyzer to trigger on th em, you’ ll find t hat they do execute. You can set up a correlated measurement to capture data with the oscilloscope at the same time, and you can use global markers to correlate the captured data and discover the hardware cause of the problem.
1 Connect the logic analyzer, emulation module, and
oscilloscope to the demo board.
Follow the instructions in the “Getting Started” chapter on page 9 for connecting the logic analysis module to the demo board.
Connect the channel 1 oscilloscope pr obe to the “ D0 BOUNCE” test point on the demo board, and connect its ground clip to the GND test point.
Connect the channel 2 oscilloscope probe to the “LATCH” test point on the demo board, and connect its ground clip to the GND test point.
63
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
NOTE: Make sure the pattern generat or data pods are not connected to the
demo board; otherwis e, the changes in demo program execu t io n will affect the results of the me asurements that follow.
2 Load the configuration files for this demo.
Latch
Q0
D0
Q1
860
Data Bus
D1
Q2
D2
Q3
D3
Q4
D4
Q5
D5
Q6
D6
Q7
D7
CLK
LATCH
860
Microprocessor
D0 BOUNCE
Bus Signals
Oscilloscope
Trigger
Immediate
Arm Signal
MPC860 BUS
Analyzer
Analog Trace Data
Captured State Data
You are loading the above configuration. The logic analyzer arms the oscilloscope which then triggers immediately. This
Setup/Display
Oscilloscope
Listing <1>
MPC860 Listing
Display
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
allows the oscilloscope to capture what is happening on the D0 and LATCH lines at the time of the event the logic analyzer triggers on.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog , select the R egister .__ _ configuration file from the /hplogic/demo/860_demo_board/configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the emulation module to read the microprocessor’s configuration registers (whose contents enable breakpoints among other things).
65
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
4 Set up to trigger on the software execution problem.
First take a look at the code where the problem is happening.
Go the Source Viewer, select the “Browse Source” tab, select “File Selection...”, and select the file /hplogic/demo/ 860_demo_board/source/proc_spec.c.
Scroll down to line 195. What you see is three lines that write 0x00, 0x7f, and 0x00 into a register. When the register i s re ad after these writes, it should contain 0x00. The next line of code checks to see if 0x00 is in the regi ster and go es to a NOP on line 209 if it is not. The code should never get to the NOP if the value in the register is 0x00 like it should be.
We can check to see if the microproce ssor executes the NOP by setting the logic analyzer to trigger on it. Select line 209 and click on it . Select “Trace about t his line” from the options.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
5 Click one of the “Group Run” buttons to start the
measurement.
6 Display the captured data.
After the trace has been taken, go to the microprocessor bus listing. Try scrolling the listing up and down. The source code highlight tracks the listing.
If the trigger is not in th e center o f th e listin g, right click on t he
listing, select “Goto Marker >”, and select “Trigger”. This places the trigger point in the center of the listing.
Notice the logic analyzer triggered on the NOP; this means the register did not contain 0x00. The question now is why.
7 Open the oscilloscope display.
Click one of the “Navigate” buttons. Select the “2 Gsa/s Scope” option and select “Setup/Display...”. The yellow channel 1 trace
67
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
is the register’s D0 line and the green channel 2 trace is the register’s clock line.
The oscilloscope has been set to trigger immediately when the logic analyzer triggers, so the trace you see is correlated to the microprocessor bus listing. The oscilloscope is set up to check the waveform of the D0 line when it is latched.
You can see, with the help of the timing marker and voltage marker, that the D0 line is at a logic 1 voltage l evel when data i s latched into the register by the rising edge of the clock.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Correlated Hardware/Software Traces
8 Use global markers to correlate data.
Y ou can establish what code was executin g when this h appened by using the global timing markers.
Right click on the oscilloscope display, select “Place Marker >”, and select “G1”. Drag the G1 marker to the rising edge of the clock signal.
Now, go to the Listing<1> window and right-click in the black listing box. Select Goto Marker and G1. This will center the listing on the G1 marker.
Notice that this corresponds to the last of the three writes to the register . T his means that a 0x00 di d not g et written in to the register as it should have.
It is also worth noting that the three writes consisted of 0x00, 0x7F, and 0x00. This means that the MSB, which is D0 in this system, never should have transitioned from a logic 0 during any of the writes. Yet the oscilloscope trace shows a logic 1 right at the rising edge of the latch.
You can also explore this phenomenon further by going up to line 182 in the source code. Here y ou will find three writes that
69
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Correlated Hardware/Software Traces
consist of 0x00, 0x01, and 0x00. If you set the trigger to the NOP after these writes and run the analyzer , you will find that it will not trigger.
So, what does this mean? When we only transition a single bit, as in the one set of writes, the correct value is latched by the register . When we transition most of the bits, as in the other set of writes, the wrong value gets latched by the register. A likely cause is ground bounce that gets severe enough to cause
problems when most of the bits transition. Let’s investigate further.
9 Probe the register’s ground, and re-run the measurement.
Y ou can verify that gr ound bounce is the problem by connectin g the channel 1 oscilloscope probe to the GND BOUNCE test point. This test point connects directly to the ground connection of the register.
Click “Group Run” to take a trace of the ground line and observe the ground bounce.
Use the oscilloscope’s voltage markers to assess the severity of the ground bounce.
Summary By looking at the analog values of a signal as well as the digital
values and by correlating the captured data, you can see how software symptoms might be caused by a hardware problem.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems

Looking at Firmware Driver Issues

Looking at Firmware Driver Issues
Being able to start and stop program execution, set up logic analyzer triggers at locations in source code, and modify processor register and memory contents helps you devel op and debug firmware drivers faster .
By controlling the target system microprocessor’s execution (run, stop, step, breakpoints), you can stop program execution at certain points and examine the state of your system.
By using an HP emulation module, you can download code to target system RAM and execute it.
By synchronizing stimulus to processor execution, you can begin the stimulus at an appropriate time.
71
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues

Controlling and modifying processor execution

If your HP 16700A-series logic analysis system has an emulation module connected to a target system
microprocessor’s debug port, you can use the emulation module to start and stop the processor, and set breakpoints.
Normally you would use a Target Interface Module (TIM) to connect to the processor’s debug port. In the case of the MPC860 demo board, however, the TIM is built in. Therefore, it has an emulation module connector right on the board, and you’re able to control the MPC860 microprocessor execution using the emulation module.
The MPC860 demo board’s D/A converter has a triangular waveform output signal with distortion caused by interrupts. In this demo, you will stop microprocessor execution, modify a microprocessor register to disable interrupts, continue microprocessor execution, and observe the effects on the triangular waveform.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
Setup/Display
Oscilloscope
Display
Listing <1>
MPC860 Listing
D/A
Converter
860
Microprocessor
D/A Output
Bus Signals
Oscilloscope
MPC860 BUS
Analyzer
Arm Signal
Break Immediately
Run Control
Analog Trace Data
Captured State Data
The configuration you will load for this exercise arms the emulation (run control) module from the logic analyzer. This means that whatever the logic analyzer triggers on will cause a
break in the processor’s executi on very close to that point. It is also important to note that the oscilloscope runs completely independently of any of the other instruments.
1 Connect the logic analyzer, emulation module, and
oscilloscope to the demo board.
Follow the instructions in the “Getting Started” chapter on page 9 for connecting the logic analysis module to the demo board.
Connect the channel 1 oscilloscope probe to the “D/A” test point on the demo board, and connect its ground clip to the GND test point.
73
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
NOTE: Make sure the pattern generat or data pods are not connected to the
demo board; otherwis e, the changes in demo program execu t io n will affect the results of the me asurements that follow.
2 Load the configuration files for this demo.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog, select the Turn_off_IRQ.___ configuration file from the /hplogic/demo/860_dem o_bo ard/ configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.) The configuration file sets up the emulation module to stop
microprocessor execution when the logic analyzer triggers.
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
emulation module to read the microprocessor’s configuration registers (whose contents enable breakpoints among other things).
4 Display the triangular waveform’s distortion.
In the first step of this measurement, you look at the analog triangular waveform generated by the D/A and processor.
To see that the form of the distortion varies over time, the
oscilloscope is set up to run and trigger repetitively. In the “2G Sa/s Oscilloscope – Display” dialog, click the “Run(r)” button.
Let the oscilloscope trace the D/A repetitively for a while. You will see that you cannot get a true triangular waveform trace. Stop the oscilloscope trace, right-click the “Run(r)” button, and select “Single”.
5 Look at the source code generating the triangular
waveform.
Open the Source Viewer window by selecting Navigate, MPC860 BUS, and SourceViewer<1>.
In the Source Viewer di alog sele ct the “Browse Source” tab and select “File Selection...”. Select the file /hplogic/demo/ 860_demo_board/source/proc_spec.c file. Go to line 88, this is the line where IRQ3 gets enabled on each pass through the
75
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
proc_specific loop. IRQ3 is disabled towards the end of the proc_specific loop.
It is worth noting that IRQ2, the CAN interrupt and cause of the flat distortion, is only turned on during the demo board initialization. If it gets turned off, it stays off.
Now, go to lines 154 through 166 where you see the triangular waveform generation code.
If you would like more detailed information about what the Proc_specific loop does, go to “Demo Board Firmware” on
page 143.
6 Stop processor execution just after IRQ3 is enabled (and
before the triangular waveform generation code is executed).
In the “Source Viewer” window, click on line 89 and select “Trace about this lin e”. Click one of the “Group Run” buttons to start the analyzer trace.
You get a status message that says there has been an “Intermodule trigger break”. This message, and the status line at the bottom of the “Run Control” dialog, inform you that the processor has stopped executing demo board firmware and is in the background monitor.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
Click “Stop” to stop the trace measurement. (When processor execution stops, there are no states for the analyzer t o capture and fill trace memory with, so the measurement does not complete).
You can verify where you are by looking at the processor trace in the “Listing<1>” dialog and at the correlated source in the Source Viewer window. Remember that the trigger must be centered in the listing display.
7 Modify the SIMASK register to turn off interrupts.
Click a “Navigate” button, select “Emulator<1>”, and select “Registers...”. This dialog shows you selected registers of the processor and their values. The Registers dialog has been preconfigured to show only the SIU group.
T urn off interrupts by g oing to the SIMASK r egister , ent ering all 0’s, and then moving the cursor out o f the SIMASK text window.
77
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
(Moving the cursor out of the text window causes the register change to take effect.)
8 Start the oscilloscope measurement.
Make sure the oscilloscope is not set to run repetitively.
Click the green “Run” button on the oscilloscope. The oscilloscope will not trigger until the processor is running
because the D/A waveform will not be generated until then. Also, note that the oscilloscope is not part of the group run
associated with the analyzer. It is an independent instrument.
9 Continue processor execution.
In the Run Control dialog, click the Run button.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
The oscilloscope should trigger almost immediately. What you
get on the display is a “perfect” triangular waveform.
From this exercise, you can see that the defects in the triangular waveform were caused by interrupt service routines executing during the generation of the waveform.
10 Modify the SIMASK register to turn interrupts back on.
As the processor continues to run, IRQ3 will be turned back on again by code in the Proc_specific loop; however, the CAN bus interrupt will not. You can verify this by running the oscilloscope trace repetitively. You will not see the CAN bus flat spot, but you will see the IRQ3 stair step effect.
You can turn IRQ2 on again, along with other interrupts. Stop the processor in the proc_specific function by selecting one of the group runs. Now, go to the “Registers – Emulator 1” dialog, select the SIMASK text window, enter a 2a000000, and then move the cursor out of the SIMASK text window. Run the processor by clicking “Run” in the Run Control dialog.
Click the green Run button in the oscilloscope again to trace the triangular waveform repetitively; this will sh ow the effect of the register change on the waveform.
79
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
Summary Controlling the target system microprocessor’s execution (run, stop,
step, breakpoints) lets you stop program ex ecution at certain points and examine or modify the state of your system.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues

Downloading code to RAM or Flash ROM

If your HP 16700A-series logic analysis system has an emulation module connected to a target system
microprocessor’s debug port, you can use the emulation module to download code to RAM or Flash ROM. Once code has been downloaded, you can use the emulation module to start the processor executing that code.
It is easy to quickly try out new or modified pieces of code on the target using the following procedure. Boot the processor and let the code in ROM initialize the system. Using the emulation module, break the processor, download the code, and change the PC to the start address of the code in RAM. Run the processor to execute the new code
For example, there is code located on the analysis system that you can download into RAM and start executing. The code will modify the message displayed on the LCD so that you will know it is running.
1 Connect the logic analyzer and emulation module to the
demo board.
Follow the instructions in the “Getting Started” chapter on page 9 for connecting the logic analysis module to the demo board.
2 Load the configuration files for this demo.
In the main logic analysis system window, click the File Manager button.
81
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
In the File Manager dialog, select the Download.___ configuration file from the /hplogic/demo/860_dem o_bo ard/ configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
3 Set up the microprocessor for downloading code.
Reset, break, and run the processor, and wait until the LED stops flashing green. This ensures that the microprocessor has properly initialized.
Then, break the processor so it is not running when the download happens.
4 Load the executable file into RAM.
Select Navigate, then Emulator<1>, then “Load Executable...”. Note that, in addition to downloading code into RAM, you can
download code into Flash ROM or erase Flash ROM. Go ahead and explore these options if you would like. Note that the four main Flash algorithms are supported. Very few Flash ROMs do not support one of these algorithms. Before you continue be sure you return the “Operation” selec tion at the top of the dialog to “Load Executable”.
The file you are about to load is in Motorola S-record form, so it will automatically be loaded into the correct memory location. Note also that “Set PC after load” is selected. This means that when you hit run after the code is downloaded, execution will start at the beginning of the downloaded program. Select the “Browse...” button at the bottom of the dialog and select the file /hplogic/demo/860_demo_board/download/demo.srec. Select OK in the file browser dialog; then, select Apply and the file will be loaded. Click OK in the Load Completed dialog, and close the Load Executable window.
Now, look at the LCD display and you will see something like:
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
ECS Status: COOL Current Temp ##
5 Run the downloaded code.
Select Run on the Emulation dialog and note that the LCD display now says:
Running \
This comes from the code you just downloaded and verifies that it is executing.
6 Trace the code executing out of RAM.
You can now trace the code executing out of RAM. Click the green Run button in the Listing dialog. You will get a trace of
the code executing in the demo board’s RAM as well as a correlation to its source code.
Summary By using an HP emulation module, you can download code to
target system RAM and execute it.
83
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues

Synchronizing stimulus to processor execution

Sometimes sections of a target system under development are not complete or are not working properly. The pattern generator can be used to substitute for them. Often, it is useful to have the pattern generator generate vectors when a particular event has happened on the target system.
For example, the pattern generator can be used to write a message to the LCD display when an IRQ 1 is generated by pushing the Interrupt button.
Digital Systems Debug Demo
Interrupt Button
NOTE: Y ou should do the exercise “Using the pattern generator” on page 111
first because it goes through the basics of the patter n ge nerator.
1 Probe the MPC860 demo board.
Follow the instructions in the “Getting Started” chapter on
page 9 for connecting the logic analysis module to the demo board.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
If you have chosen not to do the exercise “Using the pattern generator” on page 111, follow its instructions for connecting the pattern generator very carefully.
Be sure to disconnect the pattern generator when you are done.
2 Load the configuration files for this demo.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog, select the Trigger_Pat_Gen.___ configuration file from the /hplogic/demo/860_dem o_bo ard/ configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the emulation module to read the microprocessor’s configuration
85
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
registers (whose contents enable breakpoints among other things).
4 Look at the pattern generator output sequence.
Go to the pattern generator dialog and bring it to the front. The vector sequence you have loaded is a little different from
the one you used in the first pattern generator exercise. First, the pattern generator will not execute most of the sequence until it receives an arm from the logic analyzer. This happens when the logic analyzer triggers.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Firmware Driver Issues
Second, the characters that will be sent to the display have been changed so a different message will be spelled out.
5 Set up the logic analyzer trigger.
T o get the pattern g enerator to se nd the message to the display when an IRQ 1 is generated, the logic analyzer can be set to trigger when the IRQ 1 service routine is entered. The logic analyzer then arms the pattern generator, which causes it to send the vectors to the LCD display.
Go to the Source Viewer, select the Browse Source tab, select the File Selection... button, and view the /hplogic/demo/ 860_demo_boar d /source/isr.c source file. Go to line 78 of the file which is where IRQ 1 get cleared, click on the line and select Trace about this line.
The logic analyzer will now trigger when IRQ 1 is serviced.
NOTE: Close the Source Viewer window before going to the next step;
otherwise, its se arch f or so u rce l ines may interfere with th e f ol lo w in g measurement.
6 Run the measurement.
Go to the pattern generator dialog, and click Group Run. The first two vectors of the sequence are generated, and now
the pattern generator is waiting for the arm. The Run button has turned red and says Stop.
The *PG enable line has been set to high, so the LCD display should be updating.
87
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Firmware Driver Issues
Press the Interrupt button and the display should say the following:
IRQ 1 Has Occurred
If you click Group Run again, the display will begin updating again.
NOTE: When you are finished with the exercise, be sure to disconnect the
pattern generator.
Summary
By synchronizing stimulus to processor execution, you can begin the stimulus at an appropriate time.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems

Looking at Software Issues

Looking at Software Issues
Being able to make system performance measurements helps you analyze and validate application software.
By using the HP B4600B system performance analysis (SPA) tool set, you can identify and characterize your target system’s performance.
By using the cache-on execution tracking inverse assembler, you can trace MPC860 processor execution when caches are turned on.
89
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Software Issues

Analyzing system performance

You can quickly find the cause of performance problems in a section of code by using the HP B4600B system performance analysis tool set (also known as the SPA tool set).
This demo uses the SPA tool set to identify an occasional performance problem with a section of code executing on the MPC860 demo board. The SPA tool set is also used to identify the cause of the problem.
1 Probe the MPC860 demo board.
Follow the instructions in the “Getting Started” chapter on
page 9 for connecting the logic analysis module to the demo board.
NOTE: Make sure the pattern generat or data pods are not connected to the
demo board; otherwis e, the changes in demo program execu t io n will affect the results of the me asurements that follow.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Software Issues
2 Load the configuration files for this demo.
860
Microprocessor
IRQ2 IRQ3
Bus Signals
MPC860 BUS
Analyzer
Arm Signal
Trigger
Immediate
DemoTiming
CAN Analyzer
Captured State Data
Captured Timing Data
Performance Analysis <2>
Proc-specific
loop timing
Performance Analysis <1>
IRQ3
Performance
Analysis <3>
IRQ2
You are loading the above configuratio n . The logic analyzer has been split into two virtual analyzers: one state to trace the MPC860 bus, and one timing to trace the IRQs. The outputs of both analyzers go to performance analysis tools.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog, select the SPA.___ configuration file from the /hplogic/demo/860_demo_board/configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load.
91
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Software Issues
If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the emulation module to read the microprocessor’s configuration registers (whose contents enable breakpoints among other things).
4 Review the source code.
Normally, for a measurement like this, you would be looking at code that you wrote. Since this is not the case, first load the code into the Source Viewer to review it.
Select the “Browse Source” tab, then select “File Selection...”, highlight the file /hplogic/demo/860_demo_board/source/ proc_spec.c, and select “OK”.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Software Issues
Go to line number 68 where proc_specific begins. On line 76 you see a write to the variable ME_proc_specific. This write is used to mark the beginning of proc_specific.
Go to line 275 and you see our end of loop marker, MX_proc_specific. You could have also found this line by using
the “Text Search” tab.
NOTE: Close the Source Viewer now as its search for source lines may
interfere with the following measurements.
By using the logic analyzer to capture and store only writes to these two variables, you can observe the duration of the proc_specific loop over a large number of executions.
5 Set up the proc_specific performance measurement.
The processor trace has been set up to acquire 4K writes to these two variables. We could store many more of the writes, but 4K covers a span of 27 seconds, which is plenty for this exercise.
We have set up the system performance analysis tool to calculate the time duration between the pair of writes and to put them in buckets that are 1 millisecond in duration. This will tell us how much variation in the execution time of the proc_specific loop there is.
Open the first performance analyzer by selecting Navigate, MPC860 BUS, and Performance Analysis<2>. Move the dialog
93
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Software Issues
to the lower right-hand corner of the screen. Close the Listing window (if visible) to get it out of the way.
You can see the time buckets down the far left side of the chart in the black area of the dialog. The tool shows what perce ntag e of the marker pairs that were acquired has a duration that falls into each bucket.
6 Run the measurement.
Take a trace to see where the execution times fall. Click the
green “Run” button. It will take about 30 seconds to get data in the chart. Most of this time is spent collecting the writes to the marker variables.
You will notice that the red “Stop” does not go away after data appears in the chart. This is because other data is still being processed in the background. We will get to that data momentarily.
NOTE: DO NOT CLICK THE “S TOP” BUTTON . If you al ready have , then take
the trace again by clicking the green “Run” button.
7 Display the captured microprocessor bus data.
Look at the chart in the “Performance Analysis” dialog. You will see that most of the time intervals, about 90%, fall in the range of 4.5 ms to 5.5 ms. About 4% fall in the 5.5 ms t o 6.5 ms range and about 4% fall into the 7 .5 ms to 8.5 ms range.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Software Issues
It is this last group of time duration that we will focus on. They represent a performance degradation of the proc_specific loop of 50%. We would like to know what is causing the degradation.
The proc_specific loop does not have a lot of differ ent branches that it can execute. It basically executes the same code the same way for every loop. So we suspect that interrupts may be causing the degradation. For a complex system with a lot of interrupts, it might not be easy to determine which interrupt or interrupts were causing the problem. The demo board only has two interrupts active, not counting the interrupt initiated by the button next to the reset button. We will simulate locating this problem with these two interrupts.
8 Display the captured interrupt data.
Click the “Navigate” button, select DemoTiming >, and select “Performance Analysis<1>...”. This dialog contains a performance analysis of the number of occurrences of IRQ3 over a period of about 1.6 seconds. The X axis of the chart is time, which spans from about 0 sec to about 1.6 sec. This time span has been divided up into 106 buckets and the number of IRQ3s that occurred during that time period (bucket) have been counted. As you can see IRQ3s sometimes occur very frequently and sometimes very infrequently.
95
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Software Issues
Go to navigate and get Performance Analysis<3>, which contains IRQ2 hits. You can see that IRQ2 is fairly consistent in the number of hits per time bucket.
9 Use global markers to correlate the captured data.
To determine which IRQ is causing the problem, go to the Performance Analysis<2> dialog, proc_specific data, and right-
click on the 7.5 ms to 8.5 ms bar and sele ct “View eve n t times...”. The dialog that pops up contains all the event times that were collected in that bucket.
Right-click on the first event times, select “Send start time to marker>”, and select “G1”. Look in the dialog that contains the IRQ3 data, Performance Analysis<1>.
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Software Issues
You will see that the G1 global marker is right at one, probably the first, of the hit spikes in the IRQ3 data.
If you do the same with the rest of the event times that happen before 1.6 sec, you will see that the G1 marker lands right at one of the spikes in the number of hits. This tells us that it is likely that the performance degradation of proc_specific is due to the occasional large frequency of IRQ3s.
Summary You have just seen how the performance analysis tool can be
used to both identify a problem and find the cause.
97
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Software Issues

Tracking processor execution with caches turned on

The MPC860 analysis probe provides a special execution trace inverse assembler that identifies branch trace messages generated by the MPC860 processor. This allows the Source Viewer to track source code even when the processor is executing out of cache memory.
For example, some of the MPC860 demo board’s code is set up to execute out of cache memory. You can capture this execution, display it using the two kinds of inverse assemblers, and compare the Listing and Source Viewer displays.
1 Probe the MPC860 demo board.
Follow the instructions in the “Getting Started” chapter on page 9 for connecting the logic analysis module to the demo board.
2 Load the configuration files for this demo.
In the main logic analysis system window, click the File Manager button.
In the File Manager dialog, select the Cache_off.___ configuration file from the /hplogic/demo/860_dem o_bo ard/ configs/hp1670x directory, and click the Load... button.
In the Load Configuration dialog, click Load. If a confirmation dialog appears, click Yes. (You can also choose the File, Load Configuration... command
from the menu bar of most windows.)
Chapter 3: Quickly Find the Cause of Difficult HW/SW Interaction Problems
Looking at Software Issues
3 Make sure the MPC860 demo board processor is running
in a known state.
Click the “Reset”, “Break”, and “Run” buttons in order.
Resetting the processor starts it from a known state. Breaking puts the processor into the background monitor and allows the emulation module to read the microprocessor’s configuration registers (whose contents enable breakpoints among other things).
4 With the standard inverse assembler, look at executed
code with caches turned on.
To set the analyzer trigger, go to the source viewer, select the “Browse Source” tab, select “File Selection...”, and select the file /hplogic/demo/860_demo_board/source/proc_spec.c. Scroll down to line 212. This is the beginning of the code that executes with cache on.
99
Chapter 3: Quickly Find the Cause of Dif fi cult HW/SW Interaction Pr oblems
Looking at Software Issues
Set the analyzer to trigger about line 224, the NO P, and run the analyzer.
5 Display the captured data
When the trace has been taken, go to the “Listing<1>” dialog, and then go to the trigger point in the listing. You will see the assembly code being executed that turns off the cache. After that, things get strange. You will see the assembly code again because it was fetched into cache, and very shortly after that you will only see reads and writes to the D/A converter. Once the cache is turned on, following the code on the bus does not work very well.
Loading...