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
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
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
For viewing CAN frames at the Data Link level, we utilise the Warwick X-Analyser for CAN/J1939/NMEA 2000® 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
For the Application Layer, the X-Analyser 3 Professional has the option to load a NMEA 2000® CAN database to facilitate the display of the NMEA 2000® 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 NMEA 2000® 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 NMEA 2000® 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 NMEA 2000® 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. NMEA 2000® 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
Also, the selected signals (Fields) can be seen in this display. These were selected from the NMEA 2000® CAN database embedded in the X-Analyser. This database contains all the standard NMEA 2000® messages (PGNs) with their assigned data according to the NMEA 2000® 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
This display is useful for viewing the physical integrity of the CAN frames. It allows ease of selection of a NMEA 2000® 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/NMEA 2000®.
Interfacing with the NMEA 2000® CAN bus
To connect the above tools to the NMEA 2000® 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 NMEA 2000® 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 NMEA 2000® 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 NMEA 2000® CAN bus via a specialized M12 to dual BNC connector supplied by Warwick Control.
Connecting the above devices to the NMEA 2000® Trunk Line is a simple matter of adding a M12 T-connector at any point of the NMEA 2000® 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 NMEA 2000® Trunk Line
Throughout this article, we have covered the aspects of CAN and how it maps into the NMEA 2000® standard. We have shown the layered structure of this protocol, and how we can analyze, test and troubleshoot with tools available for CAN and NMEA 2000®. This article is meant to provide a “brief” overview of CAN and NMEA 2000®. For more in-depth information, please contact Warwick Control at [email protected].