Tools for Troubleshooting CAN and NMEA2000 with Warwick Controls

6 days ago by Warwick Control Technologies
Tools for Troubleshooting CAN and NMEA 2000

For interfacing marine electronics, the NMEA2000 serial network is utilized as the communication standard.

Most marine electronic products today are NMEA2000 compliant for ease of connection with electronic components in seagoing vessels. The NMEA2000 protocol utilizes CAN (Controller Area Network) for transporting digital information between devices. Many tools for NMEA2000 installation and troubleshooting are concerned with physical wiring (length, drops, terminations, power requirements, etc.).

This article covers tools for analysis and troubleshooting the CAN portion of an NMEA2000 installation.

CAN was originally developed by Bosch in the mid-1980s for the automotive industry, and it has been developed for use in many other industries, including marine (NMEA2000)..

The CAN protocol can be broken down in three levels:

  1. Application Layer
  2. Data Link Layer
  3. Physical Layer

Briefly, the Application Layer (sometimes known as the Higher Layer Protocol) is the embedded software within the ECU’s microcontroller that processes the inputs from sensors, makes calculations, and provides outputs to the actuators. For this article, the application layer is specified by NMEA2000.

Sometimes, the input/output information needs to be relayed directly between instruments and sensors and actuators, e.g. Compass, Depth transducer, Speed transducer, etc. This is efficiently done through the CAN bus.

A view of this can be seen in Figure 1.

When a controller wants to relay information to another controller (or sensor/actuator), it passes information to the Trunk Line via the CAN controller and transceiver (Data Link Layer and Physical Layer). The CAN controller packages the data and provides it with a functional address in a standardized format determined by the Application Layer. The CAN Transceiver formats the electrical signal to transfer the data across the twisted pair CAN bus in the Trunk Line. The physical signal is designed in a manner to allow communications across a noisy electrical environment.

Figure 1. Example NMEA2000 Network
Figure 1. Example NMEA2000 Network

The tools covered in this article address these distinct areas of CAN and NMEA2000. We show how to connect to a NMEA2000 data using Warwick’s X-Analyser 3 analysis and data logger tools to solve your NMEA2000 and CAN problems. Also, we show a PC-based oscilloscope solution in the form of PicoScope to analyze the integrity of the CAN physical signaling on the NMEA2000 Trunk Line.

The software tools covered here (X-Analyser 3 Professional and PicoScope 6) are supported by the following hardware:

  • Kvaser Leaf Light CAN interface – for data logging and analysis.
  • PicoScope model 2206B two channel interface with 50 MHz bandwidth.
  • M12 to D9 adaptor cable to attach the NMEA2000 Trunk Line to the Kvaser CAN interface. There are some Kvaser interfaces that have a M12 built in.
  • M12 to dual BNC adaptor cable to attach the NMEA2000 Trunk Line to the PicoScope interface.
  • Carrying case.

Warwick Control offers a NMEA2000 maintenance Kit that incorporates all the above items including the software.

View Kit >>

The rest of this article describes the tools available to view the CAN data and assist in analysis for any necessary maintenance and troubleshooting. Here we will start from the Physical Layer and work our way up to the Application Layer via the Data Link Layer.

Tools for Maintenance and Troubleshooting

For viewing the integrity of the physical signal of the CAN frame, an economical solution is the use of the PicoScope. If you have a laptop computer, you have the facility for a low cost but powerful Oscilloscope. As CAN is a comparatively low bandwidth communication protocol, for viewing CAN frames a lower spec model of PicoScope. Is quite suitable. Of course, a 2-channel scope is necessary for viewing CAN_H and CAN_L.

An example oscilloscope view of a CAN frame is shown in Figure 2. Here you can see that there are 2 electrical traces – CAN High (CAN_H) and CAN Low (CAN_L). CAN_H is blue and CAN_L is red. Note the voltage levels showing recessive bits and bus idle (bit level 1) where CAN_H and CAN_L are both at 2.5 volts, and dominant bits (bit level 0) where CAN_H and CAN_L transition to 3.5 volts and 1.5 volts respectively.

Figure 2. CAN frame on Oscilloscope
Figure 2. CAN frame on Oscilloscope

This differential signaling allows for communication in noisy environments. Note some of the noise spikes within the signals. Because of the differential signaling, the noise is cancelled out. If you measure the width of a bit, you will see that it is 4µseconds, which equates to 250 Kbps.

The PicoScope can be essential for spotting problems with the wiring by observing the physical signal levels of the CAN frame. For example, referring to Figure 1, note that there are Trunk termination resistors at each end of the Trunk Line. These are simply two 120Ω resistors connected between CAN_H and CAN_L. During digital communication, they prevent RF signals from being reflected back from the end, causing interference. If a terminator resistor is missing, the resulting waveform can appear as shown in Figure 3. Note the overshoot ringing at the transitions. This can cause CAN frame errors, interrupting normal communication.

Figure 3. CAN frame disturbance reflections due to missing Terminator
Figure 3. CAN frame disturbance reflections due to missing Terminator

Another problem area can occur when there are too many Termination resistors attached to the Trunk Line. This will reduce the overall termination resistance of the bus, which can cause a reduced performance of the CAN bus. The resulting oscilloscope trace of this situation will result in the reduction of the differential voltage between CAN_H and CAN_L.

Figure 4 shows what can happen if CAN_H and CAN_L low are shorted together. Here you can see that the scope trace shows a waveform, but there is no communication.

Figure 4. CAN_H shorted to CAN_L
Figure 4. CAN_H shorted to CAN_L

For viewing CAN frames at the Data Link level, we utilise the Warwick X-Analyser for CAN/J1939/NMEA2000 analysis and testing. Figure 5 shows the raw CAN data view in the main display. Here it can be seen that the CAN frame ID in Hex with its raw CAN data time stamped. Note the bus statistics area show the bus load, frame count and error frames (if there are any). The display is static updating each frame ID, but there is a Chronological display option to view each message as it arrives on the CAN bus.

Figure 5. X-Analyser view of CAN frame
Figure 5. X-Analyser view of CAN frame

For the Application Layer, the X-Analyser 3 Professional has the option to load a NMEA2000 CAN database to facilitate the display of the NMEA2000 Parameter Group Numbers (PGNs) and their respective Fields. The PGN describes the content and purpose of the message, e.g. Speed (PGN 1F503), Fluid Level (PGN 1F211). In Figure 5, the display shows Message names that relate to the PGNs, and in the Signals area there is a selection of Fields (Signals) chosen for this display. These are based on the NMEA2000 standard CAN database supplied with the X-Analyser.

There is also an SAE J1939 database embedded in the X-Analyser 3. This can be useful as many boats have a combination of both of these protocols on board, and with a two CAN channel Kvaser interface both CAN data buses can be viewed simultaneously. A good example of where this could be useful is where there is a NMEA2000 to J1939 gateway on board. There are several companies that provide these gateways for the solution where the engine controls utilize the J1939 protocol, and we need to relay that information to the NMEA2000 bus. Here we can use the X-Analyser to view both the J1939 and NMEA2000 CAN data buses at the same time.

The structure of the NMEA2000 CAN Identifier is based on a similar structure as SAE J1939, where the arrangement appears as shown in Figure 6. Here it can be seen that the 29-bit CAN ID is sectioned (from right to left) with one byte of Source ID (or node ID). The next two bytes make up the Parameter Group Number(PGN).

Figure 6. NMEA2000 CAN ID field
Figure 6. NMEA2000 CAN ID field

Another display option of the X-Analyser is to view a display showing the CAN ID broken down by PGN, Source Address, Data Page, Priority as explained in Figure 6. An example of this display can be seen in Figure 7.

Figure 7. X-Analyser view of the NMEA2000 Application Layer
Figure 7. X-Analyser view of the NMEA2000 Application Layer

Also, the selected signals (Fields) can be seen in this display. These were selected from the NMEA2000 CAN database embedded in the X-Analyser. This database contains all the standard NMEA2000 messages (PGNs) with their assigned data according to the NMEA2000 specification.

Another option of X-Analyser that combines a 3-in-1 feature where all three layers are considered is the PicoScope option of X-Analyser. This is a future version of X-Analyser 3. As shown in Figure 8, we can see that the Data Link display is combined with the Physical Layer display at the bottom. Here we have highlighted the Fluid Level message, which is PGN F211 (the preceding 1 indicates the DP of 1), and source address of 70. The Physical Layer component of this message is shown at the bottom of this display. The CAN_H is shown in blue, and the CAN_L is shown in red. The green waveform shows the differential voltage relationship between CAN_H and CAN_L. Also note that each component of the CAN frame is highlighted within the frame.

Figure 8. The 3-in-1 Analyser Concept
Figure 8. The 3-in-1 Analyser Concept

This display is useful for viewing the physical integrity of the CAN frames. It allows ease of selection of a NMEA2000 message, and view it on all levels (Application, Data Link and Physical Layers). In troubleshooting, it can be instrumental for seeing if there is too much noise disturbance on the wire. Also, “ringing” during transitions of data can indicated terminator problems. Another display that can be added to this tool is the Signal (Fields) module that can show selected Signals for the CAN database, covering the Application Layer of CAN/NMEA2000.

Interfacing with the NMEA2000 CAN bus

To connect the above tools to the NMEA2000 data bus, several specialized connectors were utilized that are available from Warwick Control. For interfacing to the PC based X-Analyser software, any Kvaser CAN interface can be used. In the Warwick NMEA2000 maintenance Kit, the Kvaser Leaf Light is used. Most Kvaser interfaces connect to the USB on the PC, and connect to the CAN bus via a D9 connector. There are Kvaser models that have the NMEA2000 M12 connector option, but if you are utilizing the standard D9 connection version, Warwick Control offer a M12 to D9 adaptor cable.

For connecting the Oscilloscope option, the PicoScope PC-based software is used. In the Warwick Kit, the PicoScope model 2206B is used, which is a USB/PC based oscilloscope interface. The software is supplied by PicoScope. The two-channel interface is connected to the two CAN wires on the NMEA2000 CAN bus via a specialized M12 to dual BNC connector supplied by Warwick Control.

Connecting the above devices to the NMEA2000 Trunk Line is a simple matter of adding a M12 T-connector at any point of the NMEA2000 trunk line. These are easily acquired by many manufacturers. Figure 9 reviews these options that are available in the Warwick Control NMEA2000 maintenance Kit.

Figure 9. Connections for the NMEA2000 Trunk Line
Figure 9. Connections for the NMEA2000 Trunk Line

Throughout this article, we have covered the aspects of CAN and how it maps into the NMEA200 standard. We have shown the layered structure of this protocol, and how we can analyze, test and troubleshoot with tools available for CAN and NMEA2000. This article is meant to provide a “brief” overview of CAN and NMEA2000. For more in-depth information, please contact Warwick Control at [email protected].

Warwick Control Technologies

Warwick Control Technologies is a create of software and distributor of hardware that focuses on in-vehicle networking technology including CAN, CAN-FD, NMEA 2000, LIN, FlexRay and Ethernet, and automation industries using CAN.

Get more info on Warwick Control Technologies >>