Recording a charging session for analysis

What to record (powerline traffic, the Control Pilot, CAN, TLS keys, the OCPP log), which kinds of equipment do it, what makes a capture good enough to judge a session, the formats the analyzer reads and the mistakes that cost the most time.

What to record

SourceWhat it showsNeeded for
Powerline traffic on the Control Pilot (pcap or pcapng)SLAC, SDP, TCP, TLS and every V2G message of both sidesEvery CCS session: the stages, the sequence, the timing and the TLS checks
The Control Pilot voltage (CSV)States A to F and the duty cycle; with extra columns the phase currents, the voltages and the proximity pinCP-01 to CP-10, PW-01 to PW-03, PP-01 and the Power tab
CAN trafficEvery frame of a CHAdeMO or GB/T 27930 sessionThe CAN protocols; a CCS session has no CAN on the charging cable
A TLS key log (NSS format)Nothing by itself; it opens the V2G messages of a TLS sessionEvery check on the messages of an encrypted session
The charger's OCPP logWhat the charger told its backend: status, authorization, transactionsThe OCPP tab; it never changes a check or the verdict

Only the first is essential for a CCS session. The Control Pilot log turns a message trace into a picture of what happened electrically, and it is the only record of a session that never got as far as SLAC.

Equipment

  • A charging test system or protocol analyser placed between car and charger records both directions, often with the Control Pilot and the currents on the same clock, and exports pcap or pcapng. Some can also hand out the TLS keys of a session they take part in.
  • A passive sniffer: a Green PHY modem coupled to the Control Pilot and protective earth of the cable, bridged to an Ethernet port on which Wireshark or tcpdump records. It hears both sides without taking part. To see the IP traffic it has to join the logical network of the session, which sniffer setups do by reading the network key from the SLAC match (see HomePlug Green PHY: powerline on the Control Pilot).
  • A capture on a device you control: tcpdump on the powerline interface of the charger or the car controller. It has all the IP traffic of that side and access to its TLS keys, but misses SLAC messages the modem handles itself.
  • For the Control Pilot, an oscilloscope or a data logger between CP and PE, sampling at 20 kHz or more so that each 1 kHz period has at least 20 points; the analyzer warns below that. Current clamps on the phases or the DC lead add the Power tab.
  • For CAN, any interface that logs with timestamps: SocketCAN with candump, or a vendor tool that exports Vector ASCII or a PCAN trace. Binary vendor formats such as BLF have to be exported to one of these first.

Connect measurement equipment to a charging circuit only if you are qualified to and the equipment is rated for it. The Control Pilot is a low voltage signal, but it sits in a connector next to mains or DC high voltage.

What makes a good capture

  • Start before the plug goes in and stop after the unplug. SLAC and SDP happen in the first seconds; a recording started later has no beginning, and one stopped early reads as Incomplete capture.
  • Both directions. A sniffer tapped where it hears only one modem gives half a conversation; the Capture tool reports a side that was never heard.
  • Whole frames. Set the snap length so no frame is cut; a truncated frame leaves holes in the TCP stream that no decoder can fill.
  • No dropped frames. A busy host, a slow disk or a USB adapter at its limit drops frames; the Capture tool shows the result as TCP bytes that never arrived, and as answers missing although the car went on.
  • Timestamps you can trust: absolute time in every file, from synchronised clocks where possible. Otherwise note the offset; the Alignment tab lines a relative Control Pilot log up on the 5 percent duty cycle and, on AC, on the B to C change right after PowerDeliveryReq Start.
  • One session per recording is easiest to read, but a file with a day of bench sessions is fine: the analyzer splits it.

Formats the analyzer reads

KindFormatsNotes
Network capturepcap (microsecond and nanosecond timestamps, both byte orders), pcapng, and Wireshark JSON exports with the raw bytes (tshark -T json -x or -T ek -x)Link types Ethernet (with VLAN tags), Linux cooked capture v1 and v2, and SocketCAN. Raw IP and loopback captures are refused: export them as Ethernet
CAN logcandump (screen output and log file form), Vector ASCII, PCAN traceCAN frames recorded in a pcap on a SocketCAN interface are read too
Control Pilot logCSV: a raw waveform (time and voltage) or processed rows (time, state, duty cycle)Comma, semicolon, tab or bar separated; a mapping dialog asks when the columns are unclear
TLS key logNSS key log lines: CLIENT_RANDOM for TLS 1.2, the traffic secrets for TLS 1.3Loaded as a file of its own; keys in a pcapng decryption secrets block are not read. Some test systems send the key lines inside the capture, and those are read
OCPP logOCPP-J frames one per line with a timestamp, or JSON LinesRecognised from its content and placed in the session it falls in

The format of every file is decided by reading its first bytes, never by its name, so a capture called .bin or a CAN log called .txt still opens. See Which files the tool reads and Control Pilot logs for the details of each format.

Common mistakes

MistakeWhat the analyzer shows
Capturing the charger's backend link or the office networkNo charging session in the file; the warning lists what the file holds instead
Starting the recording after plug inNo SLAC and no SDP; the stages start late
A sniffer that missed the SLAC matchSLAC, then no V2G traffic although the car charged
A capture filter for IPv4 or TCP onlyNo SLAC (Ethertype 0x88E1), and no SDP or neighbour discovery (IPv6 and UDP)
A TLS session without its key log, or with the key log of another sessionEncrypted, not decrypted; TL-08 says whether a key log opened the session
Clocks of the capture and the Control Pilot log not alignedCP-07, CP-08 and PW-02 compare the wrong moments; check the Alignment tab
A Control Pilot log sampled too slowlyDuty cycle and edges cannot be measured, and the analyzer warns

Sources

  • SPEC.md of this tool, section 4 (input formats) and 15.1 (TLS decryption)
  • ISO 15118-3:2015, powerline coupling and SLAC
  • IEC 61851-1:2017, Annex A, the Control Pilot circuit
  • PCAP Next Generation (pcapng) capture file format, IETF OPSAWG draft
  • NSS key log format