Debugging Serial Bus Systems with a Mixed-Signal...

19
Debugging Serial Bus Systems with a Mixed-Signal Oscilloscope Application Note 1395 Who Should Read This Application Note? This application note is for digital designers in R&D working with both analog and digital compo- nents, including microcontroller and DSP systems using serial buses. This application note dis- cusses the challenges associated with and new solutions for debugging serial bus designs including a Controller Area Network (CAN), Inter Integrated Circuit (I 2 C), Serial Peripheral Interface (SPI), or Universal Serial Bus (USB). Introduction to Serial Bus Protocols For many years, parallel buses have been the primary method for communicating with peripheral devices in microcontroller and DSP-based designs. Microcon- trollers and DSPs are used in many types of applications from consumer products, such as a cell phone, to control of the electrical system in a car, to many different types of embedded systems including industral applications. In these types of applications, bus speeds typically operate in the tens of megahertz and below range. Because these applications continue to grow in complexity Table of Contents Introduction to Serial Bus Protocols . . 1 Debugging Serial Bus Systems with a Mixed-Signal Oscilloscope (MSO) . . 2 Inter-Integrated Circuit (I 2 C) Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 Debugging an I 2 C Bus System with the MSO Trigger Features . . . . . . . . . . . . 5 Serial Peripheral Interface (SPI) Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 Debugging an SPI Bus System with the MSO Triggering Features . . . . . . . . . 9 Controller Area Network (CAN) Introduction . . . . . . . . . . . . . . . . . . . . . . . 10 Debugging a CAN Bus System with the MSO Triggering Features . . . . . . . . 12 Universal Serial Bus (USB) Introduction . . . . . . . . . . . . . . . . . . . . . . . 14 Debugging a USB System with Agilent MSO Triggering Features . . . . 15 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 17 Information on Agilent MegaZoom and Mixed-Signal Oscilloscopes . . . . 18 Support, Services, and Assistance . . . 19 while trying to maintain minimal costs, serial buses are commonly used as the method for communi- cating between devices and peripherals. In addition to a lower cost contribution, serial bus designs use less power, and fewer pins and therefore require less board space. Serial buses allow for the trans- mission of data over a serial line with a minimal amount of control lines and connections. Today, there are a large number of devices designed with serial pro- tocol interfaces by many manu- facturers. These buses are widely used for interfacing microcon- trollers and DSPs to EEPROMs, analog to digital converters, sen- sors, actuators, and many other peripherals. These systems are often used as control buses and networks inside TV equipment, cellular phones, automobiles, and in many other industrial applications. The major advantage of using a serial bus is the small number of signals required. A disadvantage of serial interfacing is the trade- off of speed for space in the design. The microcontroller’s I/O port can spend a significant amount of time communicating with a serial device. Another dis- advantage of using a serial bus in a mixed analog and digital design is in debugging problems in the system. The difficulty lies in extracting information about the protocol itself and in determining the interactions between devices from a long serial stream of data.

Transcript of Debugging Serial Bus Systems with a Mixed-Signal...

Debugging Serial Bus Systems witha Mixed-Signal OscilloscopeApplication Note 1395

Who Should Read This Application Note?

This application note is for digitaldesigners in R&D working withboth analog and digital compo-nents, including microcontrollerand DSP systems using serialbuses. This application note dis-cusses the challenges associatedwith and new solutions for debugging serial bus designsincluding a Controller AreaNetwork (CAN), Inter IntegratedCircuit (I2C), Serial PeripheralInterface (SPI), or UniversalSerial Bus (USB).

Introduction to Serial BusProtocols

For many years, parallel buseshave been the primary method forcommunicating with peripheraldevices in microcontroller andDSP-based designs. Microcon-trollers and DSPs are used inmany types of applications fromconsumer products, such as a cellphone, to control of the electricalsystem in a car, to many differenttypes of embedded systemsincluding industral applications.In these types of applications, bus speeds typically operate inthe tens of megahertz and belowrange. Because these applicationscontinue to grow in complexity

Table of Contents

Introduction to Serial Bus Protocols . . 1

Debugging Serial Bus Systems with a Mixed-Signal Oscilloscope (MSO) . . 2

Inter-Integrated Circuit (I2C)Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4

Debugging an I2C Bus System with the MSO Trigger Features. . . . . . . . . . . . 5

Serial Peripheral Interface (SPI)Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8

Debugging an SPI Bus System with the MSO Triggering Features . . . . . . . . . 9

Controller Area Network (CAN)Introduction . . . . . . . . . . . . . . . . . . . . . . . 10

Debugging a CAN Bus System with the MSO Triggering Features . . . . . . . . 12

Universal Serial Bus (USB) Introduction . . . . . . . . . . . . . . . . . . . . . . . 14

Debugging a USB System with Agilent MSO Triggering Features . . . . 15

Summary . . . . . . . . . . . . . . . . . . . . . . . . . 17

Information on Agilent MegaZoom and Mixed-Signal Oscilloscopes . . . . 18

Support, Services, and Assistance . . . 19

while trying to maintain minimalcosts, serial buses are commonlyused as the method for communi-cating between devices andperipherals. In addition to alower cost contribution, serial busdesigns use less power, and fewerpins and therefore require lessboard space.

Serial buses allow for the trans-mission of data over a serial linewith a minimal amount of controllines and connections. Today,there are a large number ofdevices designed with serial pro-tocol interfaces by many manu-facturers. These buses are widelyused for interfacing microcon-trollers and DSPs to EEPROMs,analog to digital converters, sen-sors, actuators, and many otherperipherals. These systems areoften used as control buses andnetworks inside TV equipment,cellular phones, automobiles, and in many other industrialapplications.

The major advantage of using aserial bus is the small number ofsignals required. A disadvantageof serial interfacing is the trade-off of speed for space in thedesign. The microcontroller’s I/Oport can spend a significantamount of time communicatingwith a serial device. Another dis-advantage of using a serial bus in

a mixed analog and digital designis in debugging problems in thesystem. The difficulty lies inextracting information about theprotocol itself and in determiningthe interactions between devicesfrom a long serial stream of data.

2

There are different types of meas-urement problems encounteredwhen debugging mixed analogand digital serial bus designs.Designers may need to debug thebehavior of the serial bus proto-col itself or they may be using anestablished serial protocol con-nection to get an entire design tocommunicate and work togetherproperly. In the former case, theuser would most likely use anoscilloscope to debug the physicallayer of the protocol. Parametricmeasurements such as rise andfall time, setup and hold times,and analyzing voltage levels couldbe made on signals in the system,such as the clock and data lines.For the latter problem, thedesigner may want to look atfunctional and integration issueswithin the system, which mayrequire analyzing relative timingand data content on the bus.

Debugging problems like these intoday’s serial bus designs can bequite a challenge using traditionalmethods. A common method fordebugging these systems has beento use a logic analyzer combinedwith an oscilloscope. However,triggering on a serial bus transi-tion of interest can be difficultbecause there is no time referenceto all of the data since it is readsequentially bit-by-bit. In thepast, debugging a parallel buswith a logic analyzer was fairlystraightforward by setting up apattern or state trigger to find theinteraction of interest.

Debugging Serial Bus Systems with a Mixed-Signal Oscilloscope

However, setting up a logic ana-lyzer to trigger on content withina long serial data stream is another matter. To trigger thelogic analyzer on a serial patternwithin a protocol requires theuser to create a state machinethat looks for the desired bit pattern or frame in the protocol.Unfortunately, most logic analyz-er’s state machines are usuallyonly 16 levels deep, which doesnot meet the necessary depth tolook for a problem in a long serialstream of data.

This solution also would require alengthy process of measurementsetups, which would probablyresult in a significant amount ofuser frustration. If the useredneeds to make parametric typesof measurements on the system,correlating the logic analyzerwith an oscilloscope would beeven more time consuming. Itwould also require deep memoryrecords on both instruments toview the long serial streams ofdata. With demanding schedulesand project deadlines, mostdesigners would agree that bettertechniques and tools are neces-sary for debugging designs thatinclude serial bus technologies.

To meet and beat these chal-lenges, Agilent has introduced anew method for debugging serialbus interfaces using a Mixed-Signal Oscilloscope (MSO) withspecially designed triggeringcapabilities for serial protocols.These features solve the difficult

problem of triggering on the spe-cific protocol conditions with alogic analyzer and oscilloscope.The Agilent MSO automaticallyfinds the desired pattern in thelong serial stream without thechore of creating a complicatedstate machine in a logic analyzer.The MSO is a single instrumentwith 16 digital timing channelsand 2 analog scope channels withbandwidths up to 500 MHz. Inaddition, the MSO has very deepmemory acquisition records usingAgilent MegaZoom technology.These triggering features are easy to set up andcan reduce the time you currentlyspend in debugging problems inembedded systems that utilizeserial bus communications.

The serial bus triggering featuresin the MSO can trigger on serialbuses with a synchronous clock,such as the I2C and SPI busesthat have separate clock and datalines. In addition, the AgilentMSO is also able to establish atrigger on serial buses that havean embedded clock within thedata stream, such as CAN andUSB. These powerful new trigger-ing features make it easy to corre-late the sequential data and timing on long streams of data.

With up to 8 Mbytes of MegaZoomdeep memory, the Agilent MSOcan easily and quickly captureand analyze long serial streams.With one instrument, MegaZoomdeep memory gives you the abilityto look at the fast digital signals

3

Debugging Serial Bus Systems with a Mixed-Signal Oscilloscope (continued)

RF M-BusRS232RS485

Microcontroller

1 2 3

4 5 6

7 8 9

0 #0p Amp

VoltageSupervisor

VoltageRegulator

EEPROM

LCD Displaycontrol and surveillance of all controllable systems used in the household,e.g.

Possible applications:

- heating system- alarm system- smoke detectors- metering systems (electricity and water flow meters etc.)

Keypad

Figure 1. Example of a microcontroller-based design used to monitor and control devices in the home. The microcontrolleruses the SPI bus to communicate with an RF tranceiver, an RS232 bridge, an EEPRPOM, a keypad, and display

and correlate those with slowanalog signals on long serial datastreams. Also, the MSO’s sixteendigital and two analog channelsof acquisition are automaticallytime correlated. The dilemma ofhaving to trigger twice to get along time capture or to seedetailed resolution is solved withMegaZoom deep memory.

Figure 1 shows an example of amicrocontroller-based design thatis used to control and monitordevices around the home. Themicrocontroller communicateswith an RF transceiver, an RS232bridge, an EEPROM, a keypad,and a display over the SPI bus.The MSO is the perfect debug toolfor this design. With the combina-tion of analog and digital chan-nels, the user can correlate activi-ty on the serial bus with what is

taking place in other parts of thesystem. This makes it easier todebug the source of a serial busproblem, such as a missingacknowledge, handshake, or anunintended packet loss.Additionally, the triggering fea-tures give the ability to look atthe problems in real time insteadof capturing the data and thenusing post processing to view thedata record. This way the usercan be sure that the signals beingviewed are accurate representa-tions of the current timing rela-tionships in the system.

Many designs incorporate morethan one type of serial interfacefor communication. For example,a design may use an I2C bus tocommunicate locally to an EEP-ROM and then another devicemay use a SPI bus to communi-

cate with other peripherals in thedesign. The entire design maythen connect to an external net-work via USB or CAN. Having oneinstrument to debug many partsof a system can reduce debugtime, cost, and frustration.

Using an Agilent MSO withMegaZoom deep memory and protocol-specific triggering solvesthe new challenge of finding andviewing problems within a longstream of serial data in today’sembedded designs with serialbuses. This application notedescribes the Agilent MSO serialprotocol triggering featuresincluding I2C, SPI, CAN and USB,and how these features makedebugging microcontroller andDSP-based designs easier andmore efficient than ever before.

4

Inter-Integrated Circuit (I2C) Introduction

Philips originally developed theI2C (Inter-Integrated Circuit) busfor communication betweendevices inside of a TV set. Today,I2C is used in a broad range ofapplications for efficient inter-ICcontrol and is supported by mostsemiconductor vendors. The I2C bus consists of a simple bi-directional two-wire bus withtwo signal lines, SCL (serialclock) and SDA (serial data). AllI2C bus compatible devices havean on-chip interface that allowsthem to communicate directlywith each other. Most I2C devicesoperate at speeds up to 400 Kbps,with some going into the lowmegahertz range.

The protocol is well defined andhas a built in addressing schemeso there is no need for chip select

Figure 2. Example of an I2C bus system. The I2C bus consists of two active signals, SDA and SCL.Every component on the bus has its own unique address.

MICROControllerA

LCDDriver

StaticRAM orEEPROM

GATEARRAY ADC

MICROControllerB

SDA

SCL

or logic controls. This makes it aninexpensive and simple solutionto link many devices of an embed-ded design together. When it wasfirst introduced, the I2C bus pro-tocol used 7 bits for addressing.To accommodate the higherdemand for more address spacethe bus now allows for 10-bitaddressing and speeds up to 3.4 MHz yet remains backwardcompatible. Because of its lowcost, it is widely used in manyproducts, including cell phones,audio/video instruments, medicalequipment, and industrial appli-cations. In fact, there are hun-dreds of I2C compatible devicesavailable today. Examples of simple I2C compatible devicesfound in embedded systemsinclude EEPROMs, thermal sen-sors, and real-time clocks.

The I2C bus physically consists oftwo active signals and a groundconnection. The signals SDA andSCL are both bi-directional. Everycomponent connected to the bushas its own unique address,whether it is a CPU, an LCD driver, or an EEPROM. Each ofthese chips can act as a receiverand/or transmitter depending ontheir function. In addition, theremay be one or more bus masters.The device that initiates datatransfer on the bus is consideredthe bus master and all the othersare bus slaves. Masters are gener-ally microcontrollers, micro-processors, or DSPs. Figure 2shows an example of an embed-ded system with an I2C bus.

5

Debugging an I2C Bus System with the MSO Trigger Features

Using a conventional oscilloscopeto debug and correlate data andtiming in a long serial stream canbe difficult and time consuming.A typical problem could be amicrocontroller requesting infor-mation from a device, such as anLCD controller, and then notreceiving any information backfrom the slave device. Debuggingthis problem with a conventionalscope would require the user todigitize a long data record usingeither an edge or pattern trigger.The user would then need toscroll through the individual dataframes one-by-one to search forthe particular problem. Using this technique would be very time consuming.

Using an MSO with I2C triggeringfeatures and deep memory is aperfect solution for debuggingproblems with devices on an I2Cbus. The 2 analog channels alongwith 16 digital timing channelsmake it possible to probe the twosignals of the bus along withother signals, such as the dataand address lines of an EEPROM,to see where the problems arereally occurring in the system.With these features it is easy totrigger and set up the addressand data conditions to debug thecommon I2C bus conditions,which could include a problem inthe system behavior or on a spe-cific I2C frame.

I2C Trigger Features

Setting up the I2C triggering features is simple. All of thesefeatures are accessed through theeasy-to-use interface of the MSO.After assigning the data (SDA)and clock (SCL) to specific scopechannels, the user can then selectthe I2C serial triggering options,as shown in Figure 3. The twolines of the bus can be probed byeither the digital timing channelsor the analog scope channels andare automatically labeled on the screen.

Figure 3. Setting up I2C triggering on the Mixed-Signal Oscilloscope.The MSO quick help screen gives detailed instructions on how to use the I2Ctriggering features.

6

Debugging an I2C Bus System with the MSO Trigger Features (continued)

Content Triggering: Read or WriteFrame of a Specific Address and Data Value

In a typical I2C frame, there is astart condition, a control bytethat configures the particularslave to be read from or writtento, a valid acknowledge clockpulse, and then other bytes of thetransferred data. The MSO can beeasily configured to trigger on theaddress and/or data of the con-trol byte or the secondary byte.

This is a powerful triggering feature that allows the user tolook within the I2C frame to trigger when a device at a partic-ular address is written to or readfrom with a data value. For example, in Figure 4 the MSO triggers when a microcontrollerwrites the data value 41 hex to akeypad at address 50 hex on theI2C bus. This feature can be veryuseful to find errors in softwareroutines that write incorrect datato a device.

EEPROM Data Read Trigger

In the I2C protocol, EEPROMshave a predetermined address onthe bus in the form of 1010xxxbinary. The EEPROM Data ReadTrigger looks for an addressmatching this pattern on the SDAline, followed by a read bit andthen an acknowledge bit. Whenthe data matches the qualifiedcondition set by the user, theMSO triggers on the acknowledgeclock edge after the data is sent.

The MSO can trigger on a “cur-rent address read” cycle, a “ran-dom read” cycle, or on any databyte within a “sequential read”cycle. The MSO trigger hardwarelooks for the appropriate controlbyte first, followed by any databyte that meets the user-specifiedqualifications. These qualifica-tions include less than, greaterthan equal, not equal, and don’t care.

For example, suppose a microcon-troller stores calibration datafrom a temperature sensor inmemory to use at a later time in aprogram. But when the data isread back, it is corrupt and caus-es the sensor to perform incor-rectly. This trigger feature of theMSO would give the user a quickand easy way to track and debugdata being read from an EEPROMin the system.

Figure 4. I2C trigger on a Write Frame with Address and Data. This powerful trigger-ing feature allows the user to look within the 12C frame to trigger when a device at aparticular address is written to or read from with a data value.

7

Debugging an I2C Bus System with the MSO Trigger Features (continued)

I2C Bus Start and Stop Trigger

Using the I2C protocol, a startcondition must be issued beforeany transaction on the busoccurs. The start condition actsas a signal to all connecteddevices that a message is about tobe transmitted on the bus. As aresult, all connected chips will lis-ten to the bus. After a message issent, a stop condition occurs.This is the signal for all deviceson the bus that the bus is freeagain. The chip accessed duringthe message will then process thereceived information.

It could be very difficult to find astart or stop condition on the I2Cbus using edge triggering with atraditional scope; there could behundreds of pulses to scrollthrough. Using the I2C start con-

dition triggering, as shown inFigure 5, the MSO triggers whenit detects a start condition bylooking for a high to low transi-tion of the SDA (data) line whilethe SCL (clock) line is high.

I2C Bus Re-Start Trigger

Within a single message there canbe multiple Start conditions in aframe. The MSO with I2C trigger-ing is able to find a restart withina frame after the start conditionoccurs.

I2C Bus Missing AcknowledgeTrigger

After each byte transfer, anacknowledge is sent. This occurswhen the SDA line is pulled highand the SCL line is pulsed. If adevice never sends an acknowl-

edge command, it can cause thebus to hang up and it could bedifficult to find the actual prob-lem. Is it the microcontroller notsending the correct address infor-mation or is the slave device notresponding? Setting up the MSOto trigger on a missing acknowl-edge can help isolate a problemsuch as this very quickly. It willfind a missing acknowledge eventanywhere in an address/controlbyte or data byte of any size 12C frame.

10 Bit Write Trigger

Ten-bit addressing allows the use of up to 1024 addresses to prevent problems with the allocation of slave addresses asthe number of I2C devices contin-ues to expand. The MSO triggerson a 10-bit write to an address in a frame if all data in the pattern matches.

The MSO trigger features,designed specifically for the I2Cprotocol, make debugging I2Cbuses easier than ever before andallow the user to find problems inreal time whether they are prob-lems within the protocol designitself or problems with devices ina system.

Figure 5. Start of Frame trigger. The MSO triggers when it detects a start conditionby looking for a high to low transition of the SDA (data) line while the SCL (clock)line is high.

8

Serial Peripheral Interface (SPI) Introduction

The Serial Peripheral Interface,SPI, is a serial bus standard origi-nally introduced by Motorola withinterfaces available on many pop-ular communication processorsand microcontrollers. Like I2C,SPI provides good support forcommunication with slow periph-eral devices that are accessedintermittently, such as EEPROMsand real-time clocks. However,SPI is better suited than I2C forapplications that are thought ofas data streams because of itshigh bandwidth (in the tens ofmegahertz), whereas I2C devicesread and write to addressed loca-tions in a slave device. An exam-ple of a data stream application isthe data communication betweenmicroprocessors, microcon-trollers, A/D converters, D/A converters, or DSPs.

Devices on a SPI bus communi-cate using a master/slave rela-tionship, in which the master,usually the microcontroller, initi-ates the data transfer. When themaster generates a clock andselects a slave device, data can betransferred in either or bothdirections at the same time(called full-duplex mode). Theprotocol helps the device todetermine if the data is a validsignal or not, depending on bitsset in the frame.

The SPI bus consists of two datalines and two control lines. Thedata lines are MOSI (master dataoutput / slave data input) andMISO (master data input / slave

data output). The control linesinclude SCLK (serial clock), andSS (slave select). The master maytransmit data at a variety of datarates. The serial clock control lineis driven by the master and con-trols the flow of the data bits andcycles once for each bit transmit-ted. The slave select control lineallows slaves to be turned on andoff with hardware control. UnlikeI2C, the SPI protocol does nothave a start of frame; the chipselect or slave select (SS) goinghigh or low (depending on thedevice) frames the data. Figure 6shows a block diagram of a webphone, which is an example of amulti-slave system.

DAA1

DAA2

McBSP0

McBSP1

McBSP2

DualChannel

AIC

DSP

Data - SPI

Voice - SPI

Phone - SPI

FLASH DPRAM

EPLDEPLD

Loader

PowerSupply

SingleChannel

AIC

HSDET

2/4HYB

T1

T2

R1

R2

Figure 6. Web Phone Block Diagram; example of a multi-slave SPI bus, DSP-based system.

9

Debugging an SPI Bus System with the MSO Triggering Features

Because SPI does not have a for-mal standard, there are many dif-ferent types of implementations.Common debug problems in SPIsystems involve configuring theclock rate for the controller aswell as the phase and polarity forhow each peripheral clocks datain and out. For example, in theweb phone device shown inFigure 7, some devices may ormay not clock data in and outusing the same polarity andphase of the clock. Because ofthis, there could be difficultiesconfiguring the devices on the bus.

An MSO with SPI triggering fea-tures and deep memory is a greattool for debugging long serialstreams, where configurationerrors may cause problems in the

system. In the previous webphone design, MegaZoom deepmemory allows the user to corre-late audio events, in the 20 kHzrange, with DSP digital events, inthe 10 MHz range, all in the sameacquisition. The user can connectto the clock, data (either MISO orMOSI) and chip select framing(SS) signals in the target system.As shown in Figure 7, the 2 ana-log channels can monitor the dataand clock while the 16 digital tim-ing channels can monitor the chipselect lines attached to theperipheral devices.

The MSO triggers on a serial datapattern during a framing period.The clock slope can be set toeither a falling or rising edge. Theserial data string can be specified

to be from 4 to 32 bits long, andthe individual bit values in theframe can be assigned to either aL, H, or X (don’t care) condition.Making things even easier, the CS,Clock and Data labels for thesource channels are automaticallyset up on the screen.

The user must select a framingsignal for the MSO serial triggerhardware to detect. This framingsignal can be a high chip select(SCS) or a low chip select (˜CS).Also, the MSO can generate itsown framing signal after a user-specified time of clock inactivity.The MSO requires a setup time of50 ns from the framing signalgoing true to the first active clockedge. The data setup and holdtimes are 10 ns and 5 ns, respec-tively. The MSO will trigger on theNth clock edge (from 4 to 32) ifthe specified data pattern is true.

This is a very elegant and easy-to-use solution, especially comparedto previous methods using a logicanalyzer and an oscilloscope,which don’t work well for debug-ging serial bus systems. Using anMSO, the user does not have tocreate a state machine by hand tofind the desired pattern in a seri-al stream of data, nor does theuser have to correlate measure-ments with an oscilloscope. TheMSO does the work to find thepattern of interest, all in a feweasy steps. Debugging an SPI buswould traditionally have beenvery difficult to perform, but theAgilent MSO has just the rightfeatures to save design engineerstime debugging problems in orderto spend more time designing.

Figure 7. Setting up and triggering on SPI signals. The MSO will trigger on the Nthclock edge (from 4 to 32) if the specified data pattern is true.

10

The Controller Area Network(CAN) is an ISO-defined serialcommunications bus for real-timeapplications. It was originallyintroduced by Bosch in the 1980sto provide a cost-effective com-munications bus for automotiveelectronics. The CAN serial busoperates at data rates of up to1 Mb/s, has excellent error detec-tion capabilities, and is extremelyreliable. Because of these fea-tures, the CAN serial communica-tions bus continues to be widelyused throughout the automotiveindustry and is gaining accept-ance in manufacturing, aero-space, and in many other indus-trial applications involving datacommunication between systemsand sub-systems.

An example CAN bus system ofan automobile is shown inFigure 8. A typical automobile system can have several differentCAN networks operating at differ-ent speeds and performing differ-ent tasks. For example, there maybe a high-speed network for thepower-train system and separatenetworks for the climate control,lights, and anti-lock brake systems.

The CAN serial bus system hasmulti-master capabilities, mean-ing that all CAN nodes can trans-mit data, and multiple CAN nodescan request data from the bus atthe same time.

Unlike a traditional network, CANdoes not send messages from onepoint to another. In a CAN net-work, there is no addressing ofdevices in the usual sensebecause it is the data, not thedevice, that is given an identifier.A priority scheme called CarrierSense, Multiple Access withCollision Detect (CSMA/CD)defines which device is the con-troller of the bus at a particulartime. The identifier with the lowest numerical value has the

Controller Area Network (CAN) Introduction

highest priority and will thereforegain control of the bus. Any po-tential bus conflicts are resolvedin hardware. A message is broad-cast to the network and any nodethat has interest in the messagecan pick up the data. Additionally,the CAN bus is a two-wire buswith signals called CAN_HI andCAN_LOW. With its differentialvoltage design, the CAN bus hasgood noise immunity and faulttolerance characteristics.

Figure 8. Example CAN automobile system. (Diagram courtesy of Motorola Inc.)

11

Controller Area Network (CAN) Introduction (continued)

Low-cost CAN controllers, micro-controllers with embedded CANcontrollers, and interface devicesare available as off-the-shelf partsfrom many semiconductor manu-facturers. Figure 9 shows a typical CAN node that includes amicrocontroller with a dedicatedCAN controller using an externaladdress bus. Some controllers aredesigned to interface either asparallel devices on the address

bus or by using another serial businterface, such as SPI. The CANtransceiver has both a transmitand a receive side, so that it canwrite to and read from the bussimultaneously. An example of aCAN node is shown in Figure 9.This could be a system node for a power window, engine monitor-ing, or suspension control in an automobile.

System MCU

CANBus Line

_INT_CSALE_RD

_WR_WAITAD7-0RESET

PORT

SD0SDISCLKA7-0

_INT_CSPALE_PRD/SRW_PWR_PRDY/SWAITAD7-0_RESET

RX0

RX1

TX0

TX1

RXD

Vref

TXD

RS

CAN H

CAN L

Vcc GND

10 kΩ

10 kΩ+5V

Figure 9. Example CAN node.

CAN Controller Transceiver

12

Debugging a CAN Bus System with the MSO Triggering Features

There are four different types ofcommunication on the CAN bus.A message frame contains theapplication data, a remote framerequests data from the network,an error frame reports errors toeach node, and an overload framedelays transmission of a CANframe if the receiver circuitry of anode is not ready. The MSO CANtriggering modes provide the ability to synchronize to any message frame, remote transferrequest frame, or overload frame.

Since a frame of information isusually a known place in theoperation of a CAN node, thisallows for a synchronous look atother signals on that particularCAN node. Shown in Figure 10 isthe MSO Quick Help description

of the CAN standard frame for-mat. At the beginning of theframe is the Start Of Frame (SOF)bit. The MSO triggering capabili-ties allow the user to synchronizethe scope acquisition to the startof a CAN frame, permitting oscil-loscope user to look at otheroperations and signals in theirdesign that are time-correlated tothe CAN bus traffic. These trig-gering features operate on eitherthe CAN 2.0B format with a 29-bit identifier or 2.0A with an11-bit identifier.

One example of how these fea-tures can be useful is to debugautomotive applications in realtime. For instance, a message thatcauses the engine to start couldalso cause noise from the engine

to be induced into the electroniccontrol system. This noise wouldbe synchronous to the Start ofFrame and could be difficult toisolate. Using edge triggering tofind a problem like this wouldrequire the user to scroll throughmany pulses in a waveform andcould be very difficult to synchronize and correlate to thedata. But with the SOF triggeringcapability, this activity is synchronous to the trigger of theMSO. The user can probe usingthe analog channels to see thenoisy components of the signal.With MegaZoom deep memory,the user can then look back intime in the frame so that theproblem can easily be isolatedand analyzed to find the cause ofthe noise problem.

Figure 10. CAN trigger Quick Help description. The MSO triggering capabilitiesallow the user to synchronize the scope acquisition to the start of a CAN frame.

13

Debugging a CAN Bus System with the MSO Triggering Features (continued)

CAN Trigger Features

With an MSO, the user can probea CAN signal with any of the 2analog or 16 digital timing chan-nels or a combination of chan-nels. When using only one of thechannels to synchronize to theCAN frame, 17 other channelsremain to provide a broader view into the design. These 17channels, coupled with AgilentTechnologies MegaZoom deepmemory, give an unparalleledbreadth and depth of insight intocomplex embedded CAN nodedesigns and interactions.

Specify Baud Rate

To synchronize to the bus trafficcorrectly, the user can specify theBaud Rate of the system from10 kbps up to 1 Mbps. The baudrates allowed follow the CiA (CANin Automation) trade associationsrecommended baud rates.

Trigger Signals Include CAN_H,CAN_L, Rx, or Tx

The user can also specify theCAN-based signal to monitor. Itcan be either of the differentialCAN signals, CAN_H or CAN_L.These are useful for monitoringthe bus itself, especially whenthey are the only signals the userhas access to. Using an MSO, itcan also be useful to look at para-metric information about thesesignals, including noise spikes,ringing, and timing measure-ments. Because these are differ-ential signals designed for a noisyenvironment, noise spikes maycause false triggers to occur whilelooking at a CAN_H or CAN_L signal. To counter this, use a differential probe such as theAgilent N2772A 20 MHz differen-tial probe, to look at the actualnoise-immune differential signal.A signal type selection, titled‘Differential’ in the menu system,is available for this case.

The user can also probe the Rxand Tx on the digital side trans-ceiver signals. The Rx signal givesa view of all of the traffic on thebus and is included for ease ofaccess. The Rx signal should notbe susceptible to noise/level drifton the physical bus line CAN_Hand CAN_L. The Tx line providesmore information because it has activity on it only when thesource node is sending a messageon the bus. Probing this line canhelp isolate the traffic to a particular node.

Real-time triggering combinedwith MegaZoom deep memory, 2 analog and 16 timing channelsmakes the MSO a great tool fordebugging CAN systems. TheMSO’s CAN protocol trigger fea-tures help the user to easily syn-chronize to the data frames ofinterest, making it easier to findproblems in automotive andindustrial designs. For communi-cations within an automotiveelectronic module, an SPI inter-face is commonly used. Becausethe MSO has the ability to triggeron multiple types of serial buses,it is an invaluable measurementinstrument for debugging CANsystem in not only automotiveapplications but also in manyindustrial control systems.

Figure 11. The user can specify the CAB-based signal to monitor. Shown here is aCAN-L signal.

14

Universal Serial Bus (USB) Introduction

The Universal Serial Bus (USB)provides a high data rate and aneasy connection from a PC to awide variety of multimedia andnetworked USB peripheraldevices. The USB port of a PCenables a user to add peripheralsto the system without having toopen the system chassis.Additionally, USB allows users to run numerous devices, such as printers, scanners, digital cameras, and speakers, from a single PC.

Peripherals such as hubs andhosts operate at full speed(12 Mb/s) or low speed (1.5 Mb/s).These speeds are adequate fordevices such as mice or key-boards, but would be very limiting and not usable for next-generation imaging andvideo devices, such as

USB High-SpeedHub

USB Full-SpeedHub

USB 2.0 Peripheral

480 Mb/s

480

Mb/

s

12 Mb/s

12 M

b/s

12 Mb/s

12 M

b/s

Figure 12. Example USB system.

high-resolution printers and scanners, video-conferencingcameras, and read/write (R/W)DVD drives. For these types ofdevices, high-speed USB increases data throughput by afactor of 40 over full speed USBto 480 Mb/s. The USB 2.0 versionincorporates low, full, and highspeeds and is a backward com-patible extension of USB 1.1using the same cables, connec-tors, and software interfaces.

USB also supports plug-and-playcapability for automatic devicedetection and installation. USBhas become a standard in the PCindustry; virtually every new PCtoday has one or more USB ports.Figure 12 shows a typical USBsystem with a PC connected to many peripherals through a hub.

15

Debugging a USB System with the MSO Triggering Features

Debugging the physical layer of aUSB device is dependent on thevisibility into the system. Forinstance, a USB keyboard con-troller might consist of a micro-controller, an EEPROM, and otherdevices encapsulated into a singlepackage. In this case, the useronly has access to the USB inter-face line to the keyboard and cannot probe the internal devicesin the controller unit. If pressingthe CAPS LOCK key does not turnon the LED on the keyboard,there could be a number of poten-tial sources of the problem. Theseinclude but are not limited to aproblem in a software setup, adevice failure, or a protocol error.To view dependencies and setupconditions it is important for thetest equipment to isolate the USBpackets in order to find whereproblems in the system may be occurring.

The USB serial protocol has ahost-centric bus, meaning thehost initiates all transactions. Anexample packet is shown inFigure 13 in the USB QuickHelpdescriptionof the MSO. The firstpacket generated by the hostdescribes the information to fol-low and whether the data trans-action will be a read or write. The next packet is usually a datapacket carrying the payload andis followed by a handshakingpacket reporting if the data ortoken was received successfully,or if the endpoint device is notable to accept data.

The USB packet fields include aSync field, a Packet ID field, anAddress field, an Endpoint field,a Cyclic Redundancy Check field,and an End of Packet field. All

packets must start with a syncfield to synchronize the clock ofthe receiver with that of thetransmitter. The Packet ID field isused to identify the type of packetthat is being sent, and theaddress field specifies whichdevice the packet is directedtowards. Cyclic RedundancyChecks are performed on the datawithin the packet payload and fol-lowing all of these fields is theEnd of Packet field.

The USB serial bus is a four-wiresystem with signals includingVBUS, D-, D+ and Ground. D- andD+ are differential signals and are the primary carriers of theinformation. The VBUS signalsupplies power to devices thatderive their primary power fromthe host or hub.

Figure 13. MSO USB QuickHelp description. The Agilent MSO can trigger on bothlow- and full-speed USB.

16

Debugging a USB System with Agilent MSO Triggering Features (continued)

USB Trigger Features

In the USB trigger mode, theAgilent MSO can trigger on bothlow- and full-speed USB. The usercan probe the differential lines,D+ and D-, with any of the 2 ana-log lines or 16 digital timing linesusing the following trigger modes:

Start of Packet (SOP), End of Packet (EOP)

The SOF packet consists of an11-bit frame number. The AgilentMSO triggers at the Sync bit atthe beginning of the packet.

The End of Packet is a field with-in a USB packet and is signaledby a Single Ended Zero (SE0) fora specified number of bit times.The Agilent MSO triggers at theend of the SE0 portion of the Endof Packet.

Enter Suspend, Exit Suspend

A USB device will enter suspendwhen there is no activity on thebus for greater than 3.0 ms. TheMSO triggers when the bus is idlefor greater than 3 ms. In the ExitSuspend trigger mode, the MSOtriggers when exiting an idle statefor greater than 10 ms in order tosee the suspend/resume transition.

Figure 14. The Agilent MSO triggers at the sync bit at the beginning of the packet.

Reset Complete (RC)

In the Reset Complete triggermode the MSO will trigger when a Single Ended Zero (SE0) isgreater than 10 ms.

There are many instances wherethe USB trigger modes are usefulfor debugging the physical layerof the USB protocol. With thesetrigger modes, the user is able tosynchronize to USB packets beingcommunicated over a USB con-nection between a host and a USBperipheral device, making it easi-er to correlate relationships with-in the protocol to find problemsin the system.

17

Summary

New technology trends bring withthem new design and debug chal-lenges. Agilent’s Mixed-SignalOscilloscope (MSO) provides anadded dimension to solving prob-lems when debugging microcon-troller and DSP-based designsincorporating serial buses.Agilent has solved the problemsassociated with debugging serialbus interfaces by providing aunique solution that uses a MSOwith specially designed triggeringcapabilities to easily debug proto-cols and the interactions ofdevices on these buses. Havingone easy-to-use instrument todebug many parts of a system canreduce debug time, cost, and frustration helping to get designsout the door and into productionfaster. The advantages of using anMSO include:

• The powerful serial triggeringfeatures allow for real timetriggering to correlate timingrelationships in microntrollerand/or DSP-based designsusing I2C, SPI, CAN, or USBserial protocols.

• Serial protocol trigger featuresare easy to use and set up;there is no need to design acomplicated state machine in alogic analyzer to debug serialprotocols.

• Agilent’s MSO has 2 analogchannels and 16 digital chan-nels to make parametric, tim-ing, and functional measure-ments all in one instrument.

• With up to 8 Megabytes ofMegaZoom deep memory, theMSO can easily and quicklycapture and analyze long serialstreams and correlate fast digital signals with slow analogsignals, all in one acquisition.

• A revolutionary ultra-responsive,high-definition display revealssubtle waveform details thatmost digitaly scopes can’tshow.

• QuickHelp instructions (in 11 languages) give details onhow to use these powerfulcapabilities.

The unique 2+16-channel Mixed-Signal Oscilloscope (MSO) modelsand the traditional 2- and 4-channel oscilloscope models areoptimized with just the rightcapabilities to verify and debugmicrocontroller and DSP-baseddesigns incorporating serialbuses. This combination of capa-bilities is tailored to give themeasurement power needed todeliver higher quality products tomarket faster.

18

Information on Agilent MegaZoom and Mixed-Signal Oscilloscopes

Figure 14. The Agilent 2 + 16-channel mixed-signal oscilloscope (MSO) family shown with 2- and 4-channel models.

Selection Guide

Model Bandwidth Maximum Sample Rate Maximum Memory* Channels US Price

54621A 60 MHz 200 MSa/s 4 MB 2 $2,495.00

54621D 60 MHz 200 MSa/s 4 MB 2+16 $3,995.00

54622A 100 MHz 200 MSa/s 4 MB 2 $3,295.00

54622D 100 MHz 200 MSa/s 4 MB 2+16 $4,995.00

54624A 100 MHz 200 MSa/s 4 MB 4 $4,995.00

54641A 350 MHz 2 GSa/s* 8 MB 2 $5,495.00

54641D 350 MHz 2 GSa/s* 8 MB 2+16 $7,995.00

54642A 500 MHz 2 GSa/s* 8 MB 2 $7,495.00

54642D 500 MHz 2 GSa/s* 8 MB 2+16 $10,495.00

* Maximum sample rate and memory are interleaved; deep memory is standard, no options needed.

Agilent Technologies’ Test and Measurement Support, Services, and AssistanceAgilent Technologies aims to maximize the value you receive, while minimizing your risk andproblems. We strive to ensure that you get the test and measurement capabilities you paidfor and obtain the support you need. Our extensive support resources and services can helpyou choose the right Agilent products for your applications and apply them successfully.Every instrument and system we sell has a global warranty. Support is available for at leastfive years beyond the production life of the product. Two concepts underlie Agilent's overallsupport policy: "Our Promise" and "Your Advantage."

Our PromiseOur Promise means your Agilent test and measurement equipment will meet its advertisedperformance and functionality. When you are choosing new equipment, we will help youwith product information, including realistic performance specifications and practical recommendations from experienced test engineers. When you use Agilent equipment, we can verify that it works properly, help with product operation, and provide basic measurement assistance for the use of specified capabilities, at no extra cost upon request.Many self-help tools are available.

Your AdvantageYour Advantage means that Agilent offers a wide range of additional expert test and measurement services, which you can purchase according to your unique technical andbusiness needs. Solve problems efficiently and gain a competitive edge by contracting withus for calibration, extra-cost upgrades, out-of-warranty repairs, and on-site education andtraining, as well as design, system integration, project management, and other professionalengineering services. Experienced Agilent engineers and technicians worldwide can helpyou maximize your productivity, optimize the return on investment of your Agilent instruments and systems, and obtain dependable measurement accuracy for the life ofthose products.

By internet, phone, or fax, get assistance withall your test & measurement needs

Online assistance:www.agilent.com/find/assist

Phone or FaxUnited States:(tel) 1 800 452 4844

Canada:(tel) 1 877 894 4414(fax) (905) 282-6495

China:(tel) 800-810-0189(fax) 1-0800-650-0121

Europe:(tel) (31 20) 547 2323(fax) (31 20) 547 2390

Japan:(tel) (81) 426 56 7832(fax) (81) 426 56 7840

Korea:(tel) (82-2) 2004-5004 (fax) (82-2) 2004-5115

Latin America:(tel) (305) 269 7500(fax) (305) 269 7599

Taiwan:(tel) 080-004-7866 (fax) (886-2) 2545-6723

Other Asia Pacific Countries:(tel) (65) 375-8100 (fax) (65) 836-0252Email: [email protected]

Product specifications and descriptions in thisdocument subject to change without notice.

© 2002 Agilent Technologies, Inc.Printed in USA April 3, 2002

5988-5997EN

www.agilent.com