Case Studies

The DMC Multi-Protocol CAN Logger

Posted in LabVIEW, Test & Measurement Automation

Summary

DMC has many clients who require simultaneous logging of all CAN traffic on a number independent of interfaces, so we designed a Multi-Protocol CAN Logger (MPCL) that can operate stand-alone or integrate with existing systems.

Solution

The Multi-Protocol CAN Logger provides a unified and automated solution for acquiring, organizing, processing, and storing CAN data from multiple CAN busses via multiple CAN protocols, including

  1. CAN 2.0A (11-bit Identifiers) or 2.0B (29-bit Identifiers)
  2. User-defined CAN Databases in *.dbc, FIBEX, or *.ncd formats
  3. SAE J1939
  4. Unified Diagnostic Services (UDS)
  5. XCP (Universal Measurement and Calibration Protocol)

The software is predominately built around NI’s XNET API for LabVIEW, which allows reading raw frames and parsing frames against a provided DBC or FIBEX database to extract meaningful signals in engineering units.

During operation, the MPCL reads all data from the bus, filters to show signals of interest, displays the live data on the screen, and logs to the efficient and compact TDMS file format.

Sessions and Automatic Tagging

The Multi-Protocol CAN Logger supports organizing data into logical sessions.  For example, some DMC clients connect an ECU at the beginning of a session, run series of tests, then disconnect the ECU to conclude the session. Each session then contains logged CAN data alongside other important pieces of information, such as the ECU's firmware version, serial number, test ID, etc. 

The MPCL is designed to sit idle until the designated CAN bus detects traffic. When traffic is detected, the MPCL optionally performs a startup sequence that can wake up, configure, and/or identify the ECU (see Figure 1, “ECU Identification / Wake up”). 

In one example deployment of the MPCL, a client used the ECU Identification portion to request a number of parameters from ECUs under test (using DMC’s J1939 toolkit), including firmware version, serial number, and other key pieces of information that could be used to provide context to the data files for that session. In this system, the serial number or firmware version of the ECU is used by the software to dynamically decide which database files to utilize, with no user interaction required.  This gives the MPCL pre-configured flexibility to communicate with many ECU models properly.  

TDMS Logging

When a new session starts, a TDMS file is created and populated with tags.  The MPCL initializes relevant CAN communication sessions for whatever protocols the user has enabled (frames, databases, XCP, UDS, J1939, etc.).  The software starts reading, displaying, parsing, and logging all data sent via CAN. If the MPCL detects inactivity, the tool closes the sessions and concludes reading and logging.

TDMS logging

Figure 1: A diagram representing the typical states and transitions of the system.

XCP

The CAN bus for some ECU’s may support XCP, a higher-level “application layer” protocol that builds structure and functionality on top of the CAN data-link layer.  XCP works differently than “broadcast” CAN in that XCP messages don’t get transmitted without a request-response process.  The MPCL manages the initialization and servicing of XCP DAQ sessions to gather desired XCP data.  These MPCL functions are built upon NI’s ECU Measurement and Calibration toolkit which enables full implementation of the XCP master node specification.  The software uses A2L database files to carry out XCP communications.

Unified Diagnostic Services (UDS) Protocol

The Multi-Protocol CAN Logger supports the most powerful features of the UDS Protocol, including:

  1. Service ID 0x10: Diagnostic Session Control
  2. Service ID 0x27: Security Access (seed key authentication)
  3. Service ID 0x3E: Tester Present
  4. Service ID 0x22: Read Data by Identifier
  5. Service ID 0x2E: Write Data by Identifier
  6. Service ID 0x19: Read DTC Information
  7. Service ID 0x31: Routine Control (Start, Read, Stop)

SAE J1939 Protocol

The MPCL supports the most powerful and common features of the J1939 protocol, including:

  1. Read Parameter Group Number (PGN)
  2. Retrieve Active Diagnostic Trouble Codes (DM1 and DM2)
  3. Clear Active/Inactive DTCs (DM3, DM11)
  4. Memory Access Request (DM14)
  5. Memory Access Response (DM15)
  6. Binary Data Transfer (DM16)
  7. Seed Key security (DM18)
  8. Multi-packet Transport Protocol

Learn more about DMC's Test & Measurement Automation services.

Contact us today to get started on your project.

Customer Benefits

  • Increased visibility into CAN communications for debugging purposes
  • Easily searchable historical records of CAN data from past tests
  • Automatic parsing of CAN frames against a user-defined CAN database file
  • Automatic partitioning (based on test session) and tagging of datafiles

Technologies

  • NI XNET 9260 CAN Modules + External Transceivers
  • NI cDAQ 9184
  • NI LabVIEW
  • ECU Measurement and Calibration Toolkit (LabVIEW API)
  • CAN, J1939, XCP (over CAN)