Zibb

Feature

FROM EDN EUROPE: CANbus networks break into mainstream use

It takes years for some technologies to reach commodity status. CAN is one that's now enjoying acceptance. Cost-effective development kits and test equipment ease your entry into this robust networking environment.

By David Marsh, Contributing Technical Editor -- EDN Europe, 8/8/2002

AT A GLANCE
  • CAN is today's technology of choice for robust real-time networks.
  • Silicon vendors offer more than 50 controller ICs and bus transceivers.
  • Low-cost development kits provide rapid prototyping support.
  • Hardware interfaces and software packages ease bus analysis.
  • Oscilloscope vendors are starting to include CANbus-trigger modes.
Sidebars:
CAN primer

It has now been more than 15 years since auto-electronics maker Robert Bosch developed the CAN (controller-area-network) protocol to communicate between electronic-control units within powertrain-control applications. Following its introduction at the SAE (Society of Automotive Engineers) Congress in 1986, Bosch licenced the protocol to a variety of equipment manufacturers and silicon fabricators. The first licencee was Intel, whose 82526 in 1987 became the first commercially available CANbus controller; other early adopters include Philips and Motorola. Bosch has since signed more than 40 licencees, and the protocol enjoys established ISO status (Reference 1). The technology's applications have broken free of the automotive arena to include industrial networking, medical equipment, numerical machine control, railway signalling, controlling building services, and even vending machines—any application that requires robust communications with predictable latencies at bit rates reaching 1 Mbps.

CAN has only recently become a true commodity networking technology. As with many electronics-design technologies and, despite possessing unique technical advantages, it has taken time for CAN to gain widespread commercial off-the-shelf acceptance. Compared with the previous year's statistics, figures for 2000 reveal that CAN-enabled microcontroller shipments doubled to more than 100 million units, and similar growth continues. Of course, CAN's maturity offers huge advantages. Apart from ISO and SAE standardisation, time-proven performance, and falling hardware costs, you can purchase CAN silicon from approximately 15 chip makers that offer more than 50 controller chips. Several of these vendors and many third-party vendors offer fast-track development boards to help you get started, and—whereas until recently you could choose only expensive units—a broad selection of test equipment is now available to suit wide-ranging application profiles. From the technical viewpoint, CAN's continuous development and standardisation work means that the technology can now address emerging applications. Significantly, papers presented at February 2002's Eighth International CAN Congress in Las Vegas focused on TTCAN (time-triggered communication via CAN) and CAN-gateway technology for wireless networks (Reference 2).

CAN's popularity results from the elegant ways that the developers found to guarantee predictable error-free communications within the safety-conscious automotive environment. You can freely download the protocol specifications from www.can-cia.de, but a quick review of the key features and limitations helps you to assess the technology's suitability to your projects. At first glance, a serial multimaster bus system with a maximum 1-Mbps rate sounds less than exciting when today's desktop PC users commonly enjoy 100-Mbps Ethernet connections. But, although an office Ethernet network might every hour shuffle gigabytes of data between file servers and users, the average CAN-transmission packet that exchanges relatively simple control and measurement parameters comprises less than 100 bits (see sidebar "CAN primer").

Hardware requirements

Early CAN controllers divided into BasicCAN and FullCAN types, with the BasicCAN version handling the protocol conversions and providing minimal message filtering. Citing lower silicon costs and maximum message-reception bandwidth, Philips originally championed the BasicCAN approach. In contrast, Intel argued in favour of FullCAN's ability to reduce host-processor load by assuming responsibility for communications overhead, such as error recovery. Today's silicon blurs these distinctions, typically making such considerations unnecessary, yet some legacy evidence remains, as Philips' ubiquitous SJA1000 stand-alone CAN controller illustrates (Figure 1). At power-up, the SJA1000 defaults to BasicCAN mode to maintain compatibility with the company's first-generation 82C200 controller. You can then program the SJA1000 into "PeliCAN mode," in which the chip supports CAN 2.0B active operation with message-filtering enhancements.

Features of the SJA1000 that ease development include error-handling mechanisms, such as interrupt-on-error, an error-code capture register, read/writable error counters, and a programmable-error-count warning limit. A listen-only mode inhibits writing dominant levels on the bus and, thus, transparently supports bus-traffic analysis. Local and global self-test modes read back the chip's transmission data, respectively ignoring or requiring reception acknowledgment via the ACK bit. The arbitration-lost feature reports bit positions in which the local node loses priority to another device. Also, a single-shot transmission request command defeats the normal CANbus automatic-transmission-retry logic. This feature can be useful in situations in which the data becomes stale while the bus rearbitrates multiple times. To support the SJA1000, Philips publishes a useful application note that includes samples of code to suit 80x51-family microcontrollers (Reference 3). The SJA1000 core also appears within an 80x51-family microcontroller in the guise of the 8xC591 series and costing around €7 (100); the SJA1000 costs around €2.75 (1000).

Kits speed development

CAN is now so mainstream that catalogue distributors, such as Farnell and RS Components, routinely carry development kits from semiconductor makers, including Atmel, Infineon, Microchip, and Motorola. Atmel is relative latecomer to the CAN market, and its kit is a new product that comprises two boards. The first board serves as an evaluation and flash-programming platform for the company's range of PLCC-packaged C51/C251 microcontrollers. An extension board plugs into the main board to add the CAN-enabled 89C51CC01 microcontroller and a Vishay Siliconix Si9200 transceiver; connection to a CAN bus is via the CiA (CAN in Automation) group's recommended DB9 connector. You also get documentation, including the circuit diagrams, a serial cable, and various demo programs, and the company thoughtfully adds a PLCC extraction tool. The kit is available now from Farnell and costs approximately €150.

Microchip, too, is a recent entrant to the CAN market, offering the MPC2510 stand-alone controller and a new range of CAN-enabled flash-memory microcontrollers, such as the PIC18F248. Kit-level support comes in the form of the company's MPC2510 CAN developer's kit, which serves as a software-development and CAN-communications tool. The board includes two CAN nodes that connect to an onboard bus, making it easy to develop and test a basic network. The conventional DB9 connector serves an external bus. Software tools include two templates that provide an interface to bit- and message-level communications. The kit costs approximately €250.

Courtesy of their connections with the automotive industry, Infineon and Motorola have enjoyed a long presence in CAN market. Infineon offers a range of kits that specialist kit assemblers, such as Phytec and TQ Components, make for the company. These kits encompass the company's microcontroller families. The CAN-enabled members are the 8-bit C515C; the 16-bit C167CR and its dual-CAN-port derivative, the C167CS; and the newly, 32-bit TC1775B TriCore microcontroller, which features dual, independently programmable CAN ports (Reference 4). As well as including comprehensive documentation, each of these kits comes with evaluation versions of tools, such as the Keil and Tasking compilers, which allow sufficient code space to generate rudimentary routines. Available from Farnell and Hitex, Infineon's kits range in price from approximately €250 to €450.

Motorola's kit for the MC68HC912D60 microcontrollerincludes a CAN port that's driven by the company's TouCAN controller implementation. The TouCAN controller includes a three-buffer-deep message queue that supports continuous transmission requests in message-priority order. Following acceptance filtering, the TouCAN hardware stores reception messages in a two-stage input FIFO that decouples the microcontroller from the CAN module, making it easier to implement application software. You can order the kit from RS Components for approximately €650.

Phytec offers its own range of kits for processors from Atmel, Infineon, and Philips. For the Philips 80x51-family, Phytec's 87C591 module plugs into a general-purpose baseboard and includes 128 kbytes each of external flash and SRAM. A serial EEPROM serves as storage for network-configuration data. Development-kit tools include an in-system flash-programming facility and a CD containing code examples that Phytec guarantees to work the first time. You can download the kit's hardware manual and programming examples for Keil and Tasking 80x51 compilers from Phytec's Web site; you can also place an order for approximately €375.

Hitex, too, has recently introduced CAN starter kits with an ISO-11898- compatible, optically isolated physical-layer implementation that suits industrial-automation development. The kits include a processor card that uses Motorola's 20-MHz 68332microcontroller to control two Philips SJA1000 controllers for dual-channel capability. Available in ISA, PCI, and PC/104 formats, the card can time-stamp message receptions with 10-µsec resolution. A separate card that carries analogue-I/O hardware functions as a sensor or as an actuator. Software support includes a 32-bit, Windows-compatible sample application, together with device drivers for Win 95/98/NT, Win CE, and DOS; source-code documentation allows you to develop custom drivers for alternative OSs, such as Linux. The kits are available now for approximately €850. Janz Computer offers a similar kit; other industrial-strength products include Port's CANopen kit, and Kvaser's NMEA2000 kit, which suits maritime-CAN developers.

Boards with dual CAN nodes make it easy to construct a functional network by making a loop-back connection; without this ability, you need external hardware support to get started. And with appropriate software support, a dual-channel board can perform functions such as examining network traffic on either side of a CAN gateway device. Of course, you can link two single-node development boards to build a bus, and Lawicel takes this approach with two-node kits that sell for approximately €275 each. The company offers boards that use Infineon's C505CA and C515C microcontrollers, as well as the combination of Atmel's 8515 AVR microcontroller with Philips' SJA1000 controller. All kits include sample software that gives you a reliable entry point to further software development.

Software drives test analysis

Virtually all development projects mandate independent test equipment, and your options for CAN range from simple CANbus interfaces to sophisticated bus-analysis systems. For approximately €100, Lawicel's CAN232 is the least expensive and simplest available PC-to-CANbus interface. The device plugs into a PC's serial port to convert between RS-232 and CAN protocols. Because it's a hardware-gateway device, the CAN232 operates independently of operating-system concerns in any environment that supports an RS-232 driver. But it's your responsibility to write application code. Also, notice that the device best suits networks that operate at 125 kbps or lower; frame capture is erratic at best in a 1-Mbps environment.

National Instruments, Peak System Technik, Softing, and Vector Informatik offer a range of hardware and software that varies in sophistication. Peak's representative range of hardware and software products varies from ISA-bus cards that start at prices of €100 to a €3500 software-development kit. The company's ships its interface hardware as standard with a DOS-compatible CANview software package that lets you send and receive messages at sample rates reaching 1 msec. You also get example source code for read, write, and status-reporting functions in ANSI-C. Recognising that many field buses run legacy applications, the DOS-compatible CANmon utility extends CANview's data-logging facilities for approximately €150. Suiting Windows PCs, the PCAN-Explorer software provides graphical insight into network operation, reporting details such as the message identifier, length, and data content (Figure 2). To simulate network response, you can load and save lists of transmission messages using a simple macro editor. You can assign symbolic definitions to messages to ease visualisation. PCAN-Explorer costs approximately €435.

For top-level development, the PCAN-Developer software-development kit augments programming environments, such as Delphi and Visual Basic. The core of this package is a 32-bit Windows -kernel-mode driver that connects your application program to the underlying physical hardware to provide 1-msec sampling within an NT/2000 environment. You connect devices to "nets" that provide a graphical interface into network configuration. Bundled software tools ease configuration, make performance measurements, and allow you to visualise network operation. The five-driver license-evaluation version costs approximately €550; the unlimited version costs approximately €3500.

Warwick Control Technologies' X-Analyser software runs with Softing's range of interface cards, including the dual-channel PCI and PCMCIA models. The software's principal role is to monitor real-time bus traffic, but you can also transmit messages, including error frames, to accurately simulate network behaviour. You can send messages cyclically at periods of 1 to 65,535 msec to simulate the data streams that devices such as electronic speedometers require, or you can trigger a transmission in response to a message. For transparent bus monitoring, the software includes a mode in which the interface card plays no part in bus arbitration and also refrains from sending error frames. A symbolic database converts bus traffic to meaningful units and works down to the CANbus-bit level. You can store data for later analysis and import data files from other systems in common CAN-database formats. Statistical-analysis abilities include bus-load, frame-rate, and lost-frame information for each interface-card channel. Options are available to support CANopen, DeviceNet, and J1939 automation protocols. Prices for X-Analyser with a single-channel USB-CAN interface start at approximately €2100. The product is now available.

The de facto standard in the automotive industry, Vector Informatik's CANalyser system is available in junior, fundamental, and professional levels. The single-channel junior-version analyser offers data-tracing, -filtering, -logging, and -generation capabilities. The measurement-setup window allows you to configure and display test-run data flow in terms of data sources, sinks, and function blocks. The message-and-signal explorer window makes it easy to map and manage symbol names to their identifiers. A simple statistics window reports bus-traffic information, such as the number of messages and errors per identifier over time, and a database stores bus-traffic information in Vector's CANdb format. The midrange fundamental version allows you to analyse as many as 32 channels by using multiple interface cards. You also get sophisticated functions, such as a replay block that you can use to drive the bus with previously recorded data. You can then test individual elements, such as sensors, by filtering out irrelevant bus traffic. Other facilities include a graphical trace window that displays variable data, such as engine speed and gear selection versus time with cursors that make measurements at one point or relative to two points (Figure 3). The professional version adds the ability to program the system to perform bespoke functions in the C-like CAPL (CAN application-programming language). All versions are Windows-compatible and support a range of hardware interfaces. Prices start at approximately €1900 for the junior version with a parallel-port adapter and approximately €3630 and €5180 for the fundamental and professional versions, respectively, with Vector's dual-channel PCMCIA card.

Scopes still prove invaluable

As waveform quality dominates datacommunications reliability, you'll want to evaluate physical-layer conditions and evaluate cable types, bus transceivers, and termination arrangements. On some occasions, you need to examine the physical layer to track faults in an errant CANbus system. Unless a gross fault, such as a shorted CAN_H bus line, exists, a normal scope offers limited assistance: All you see is frames whizzing past. Agilent's 54600 mixed-signal series of DSOs aims to improve this situation by including CAN, I2C, SPI, and USB serial-bus trigger capabilities within general-purpose scopes. Dedicated CANbus modes comprise start-of-frame, remote-transfer-request, and overload-frame triggers. The new model 54641A is a conventional, 350-MHz, dual-channel analogue-input DSO that has 8 Mbytes of acquisition memory. Although there's no substitute for deep memory to capture signal details in serial bus streams, it can be hard to find what you're looking for. Agilent's proprietary MegaZoom technology helps you to locate details buried in memory. The 54641A also boasts maximum screen-refresh rates of 25 million vectors/sec, outperforming many analogue scopes, plus 32 intensity-graded grey levels that simulate an analogue scope's response to repetitive signals. Prices for the model 54641A start at approximately €5500.

Andy Buxton, sales manager at CAN specialist Accutest, notes that, because receiving nodes signal transmission errors, it can be hard to see the root cause of an error. To help localise faults, you often need multiple CANbus-trigger capabilities. Connecting via a PC's serial port, Vector's CANscope is a logging module that digitises and buffers CANbus traffic for software analysis. You can use it as a stand-alone module to record as much as 32 kbytes of data for later download and analysis. The module samples 160 kHz to 32 MHz, measures voltages with 20-mV resolution, and triggers on programmable maximum/minimum bus-voltage values. A DSO-like pretrigger mode allows you to capture data on and around a CAN message or an error frame. The analysis software displays bus-line voltages and their differential voltage over time and highlights the protocol's stuff bits. The software simultaneously displays CAN messages, message fragments, or error frames in a trace window. You can scroll through this window to select items such as message identifiers, which the scope displays and then reflects. Similarly, a measurement cursor allows you to scroll through the scope window and update the trace information. The system includes Vector's CANdb database for data archiving and exchange with CANalyser systems. Available now, the CANscope costs approximately €4500.

If you need a DSO-based bus analyser, consider Yokogawa's DL7200 CANbus signal analyser. This benchtop instrument layers CAN- and SPI-bus analysis capabilities on the company's 500-MHz, four-channel DSO. In CAN mode, it can record 4M to 16M samples into memory at bit rates of 33.3 kbps to 1 Mbps—sufficient to analyse as many as 8000 frames. The instrument's bandwidth helps you to identify high-frequency noise components, and the 16M-sample memory option allows you to record a 500-kbps bit stream with 100-point-per-bit resolution for 320 msec. You can set a percentage to represent the sample point within a bit time to ensure compliance with CANbus specifications (Figure 4). CANbus-trigger facilities include message identifier, start of frame, remote-transfer request, and error frame. You can also trigger on data-field information and logically combine any or all of these trigger sources. And the multichannel scope allows you to measure physical quantities, such as a sensor's output, synchronously with CAN data acquisition to ease debugging control systems; a 16-channel digital-input option broadens this capability. Prices for the DL7200 start at approximately €19,500.


For more information...
When you contact any of the following manufacturers directly, please let them know you read about their products in EDN Europe.
Accutest
www.accutest.co.uk
Agilent
www.tm.agilent.com
Hitex
www.hitex.com
Kvaser
www.kvaser.com
Lawicel
www.lawicel.com
Motorola
www.motorola.com
National Instruments
www.ni.com
Peak System Technik
www.peak-system.com
Phytec
www.phytec.com
Port
www.port.de
Vector Informatik
www.vector-informatik.com
Warwick Control Technologies
www.warwickcontrol.com
Yokogawa
www.yokogawa.com
  


Other companies and organisations mentioned in this feature
Atmel
www.atmel.com
CiA (CAN in Automation)
www.can-cia.de
Farnell
www.farnell.com
Infineon Technologies
www.infineon.com
Intel
www.intel.com
Janz Computer
www.janz.de
Keil
www.keil.com
Microchip
www.microchip.com
Philips Semiconductors
www.semiconductors.philips.com
Robert Bosch
www.can.bosch.com
RS Components
http://rswww.com
Society of Automotive Engineers
www.sae.org
Softing
www.softing.de
Tasking
www.tasking.com
TQ Components
www.tqc.de
Vishay Siliconix
www.vishay.com
  


Author Information
You can reach Contributing Editor David Marsh at forncett@btinternet.com.


References
  1. ISO 11898: Part 1 (data link-layer protocol), Part 2 (high-speed transmission), and Part 3 (fault-tolerant transmission), International Organisation for Standardisation, www.iso.ch.
  2. CAN in Automation (CiA) press release, March 11, 2002; www.can-cia.org.
  3. Hank, P, and Egon Johnk, Application Note AN97076, "SJA1000 standalone CAN controller," www.semiconductors.philips.com.
  4. Marsh, David, "Motorsport accelerates prototype design," EDN Europe, July 2002, pg 20.
 

CAN primer

The CAN (controller-area-network) protocol's history bequeaths a dictionary of concepts and terminology that can take some time to master. One of the technology's key differentiating features is that it's a multimaster system that relies on broadcast transmissions. This approach contrasts with classic client/server networks, such as Ethernet, which typically rely on network addressing to deliver data to a single node.

In a CAN, every node receives the same data at once, which eases process synchronisation. By asserting the RTR (remote-transmission-request) bit and transmitting a "remote frame" that comprises zero data bytes, CAN also enables devices to request data from others in a traditional client/server relationship. Each node must qualify data for reception, which the host microcontroller's software accomplishes by setting the message-filter registers in an on-chip or stand-alone CAN-controller subsystem. Notice that the multimaster/broadcast technique allows you to extend the network with minimal software impact by adding nodes. This ability also supports redundancy in mission-critical applications.

A standard CAN Version 2.0A frame comprises an 11-bit identifier and the RTR bit; an identifier extension bit to signal normal or extended identifiers; as many as eight data bytes; a CRC (cyclic-redundancy-check) field; and various bit-periods, such as start-of-frame and acknowledge (Figure A). The similar CAN Version 2.0B "extended-CAN" frame adds an 18-bit identification field that allows application builders to more easily standardise device-naming conventions. In this context, references to CAN 2.0B "passive" mean that a controller tolerates 29-bit-identification fields; CAN 2.0B "active" means that the controller fully supports the 29-bit identifier environment. To suit applications such as industrial networking, which transmits multiple data bytes, the CAN application layer extends the protocol to allow arbitrary-length data transmissions. Other higher layer function extensions include CANopen and DeviceNet, both of which primarily target industrial environments.

As well as providing a unique device identifier for each node in the network, the identification field also supports a nondestructive bitwise priority-assignment function in which higher priority nodes have lower binary values. You must establish device priorities during system design, because you can't dynamically change them. Devices that want to transmit a message arbitrate for bus access by waiting until the bus is idle and then transmitting their identifier onto a wire-OR bus. Devices monitor the bus while they are transmitting so that they can see whether another, higher priority device is present by comparing their identifier with the bit values that the bus carries. If two or more devices concurrently request bus access, this CSMA/CA (carrier-sense-multiple-access/collision-avoidance) scheme ensures that the device that asserts the lowest binary value wins. Lower priority devices postpone their access requests until the bus becomes idle, and the highest priority device gains bus access without wasting time by having to rearbitrate.

At the physical-layer level, a CAN controller communicates with the bus via a transceiver that provides sufficient drive power as well as short-circuit and transient-overvoltage protection. The popular ISO 11898-2 standard CAN bus transmits over a three-wire bus that comprises the differential CAN_H and CAN_L lines and a ground return that's common to every transceiver on the bus. A 120Ω termination resistor at each end of the bus minimises reflections, so the resistive load that the transceiver drives is 60Ω. (To increase EMC resilience, some networks use two 60Ω resistors in series with a capacitor to ground at the junction between the resistors in place of the 120Ω resistor.) In the inactive state, transceivers bias the bus to VCC/2 or, nominally, 2.5V. For a single-ended measurement, 2.5V on both CAN_H and CAN_L signals a "recessive" state; ≥3.5V on CAN_H and ≤1.5V on CAN_L signal a "dominant" state. Differentially, these voltages become nominally 0V for recessive conditions and 2V for dominant conditions (Figure B).

For maximum efficiency, CAN uses a binary non-return-to-zero bit-coding technique in which successive runs of the same logic level can create dc offsets on the transmission line, compromising transmission integrity. To avoid this possibility, the protocol inserts an opposite-polarity "stuff bit" after a run of 5 bits of the same polarity. Transceivers monitor this bit-stuffing rule as one guard against error conditions.

Other error-detection schemes include the CRC field, which protects data at the frame level; a frame-structure check that compares the frame with the protocol's format and frame-size expectations; bit-level comparisons between sent and monitored data; and ACK (acknowledgment) of successful message reception. Transceivers that successfully receive a message assert the ACK bit; if the transmitter receives no acknowledgment, there are no receivers, or the message, the ACK bit, or both have been corrupted.

If a node detects transmission errors, it transmits an error frame to abort the transmission. Typically, the sender automatically retries within 23 to 31 bit-periods of the error's detection. But, to address the "babbling-idiot" syndrome, whereby a faulty node attempts to monopolise the bus, each node contains error counters that software can use to limit or curtail the node's transmissions. The protocol's specification shows that the likelihood of a transmission error's going undetected is less than the transmission error rate multiplied by 4.7×10–11. In statistical-average terms, the likelihood of an undetected transmission error in a car's high-speed CAN is one occurrence per millennium.

Because signals must propagate throughout the network and settle at each node before devices can arbitrate, CAN's bit-timing requirements limit network length. Together with controller-response speed and bus-transceiver characteristics, the maximum length depends upon signal-propagation speed, which in turn depends upon network construction and loading. A typical controller/transceiver combination has a propagation delay of as much as 300 nsec, and any optoisolators that the network requires for galvanic isolation may contribute 120 nsec more. Most CAN networks use a twisted-pair cable with a propagation velocity of approximately 5 nsec/m. Notice that you must double the composite delay value to allow transceivers at the far ends of the bus to receive acknowledgment of a successful transmission.

Together, such characteristics support 1-Mbps communications for a maximum of approximately 9m in an ISO-11898 system. With no optoisolators, reach can be as much as 40m. You must constrain connection stubs off the transmission line to ≤300 mm in a 1-Mbps system. Note that lowering the bit rate increases reach to as much as 1 km for a 50-kbps system, and you can employ repeater devices to build arbitrary-length networks. Also, it's desirable to keep bit rates as low as possible to increase transmission robustness and minimise EMC emissions. Accordingly, many vehicles employ a 1-Mbps system for time-critical powertrain control and a secondary 125-kbps network for ancillary body functions. These networks often join via a gateway device—typically a microcontroller with dual CAN ports that accommodate independent bit rates, such as Motorola's MPC555 PowerPC.



Reed Business Information Resource Center

Featured Company


Related Resources

ADVERTISEMENT

ADVERTISEMENT

Related Content

 

By This Author


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites