Skip to content

About

Record a CAN bus to pcap with a Canis Labs CANPico: listen-only by default (Caterham CAN Logger Display bench and car tool)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

CANPico capture

Records a CAN bus to a pcap file with a Canis Labs CANPico plugged into a laptop's USB. It is listen-only by default: the CANPico never drives the bus.

It was built for the Caterham CAN Logger Display project, to give:

  • an independent view of the car's bus: what the ECU, Easimap and the dash actually send;
  • bench tests of the dash: recording what it sends, without a commercial USB-CAN adapter;
  • bench traffic: ./replay plays a recording back into a dash or a CAN node. It transmits, so it's bench only.

Wireshark opens the files, and the Caterham ECU skills' mbetool reads them: can-summary, decode-can and easimap-trace.

Quick start

make venv                                   # once: a local Python with pyserial
./capture                                   # listen-only, 500 kbit/s, until Ctrl-C
./capture -o idle.pcap --seconds 60 --log   # stop after 60 s; also a candump-style .log
  • While recording, it shows frames a second, error events and the busiest IDs, once a second.
  • At the end, it switches the CANPico off the bus and prints a count per ID.
  • capture uses this folder's .venv when it exists, so there's nothing to activate.

Modes

Option What the CANPico does on the bus Where
(default) --mode listen Nothing at all: no frames, no acknowledgements, no error flags Safe on a car. Something else must acknowledge the frames
--mode ack Acknowledges the frames it receives; sends none Only when nothing else on the bus acknowledges
--bench-beacon Transmits a frame on 0x0CBB0001 every 10 ms, so a dash on the bench has traffic to find the bitrate from Bench only. Never on a car

Replay (bench only)

./replay --bench car.pcap                          # play a recording into a dash or node on the bench
./replay --bench --id 0x0CBB0001 --loop car.pcap   # just the broadcast, round and round

It reads pcap, pcapng, candump -L logs and mbetool can-dump CSV, and keeps the recorded timing (--speed, --start, --seconds). It refuses to run without --bench, skips a frame rather than wait when nothing acknowledges, and leaves the CANPico offline. Details are in docs/using-it.md.

--bitrate takes 125000, 250000, 500000 (the default) or 1000000.

Private data

A recording of your car is private vehicle data. For example, Easimap's identify reply includes the ECU's ID string.

  • .gitignore keeps *.pcap, *.pcapng and *.log out of this repository.
  • Keep recordings off GitHub altogether.

Documentation

Document What's in it
docs/using-it.md Connecting on the bench and the car, termination (JP1), recording, replaying on the bench, checking a capture, troubleshooting
docs/architecture.md How it works: the recorder on the CANPico, the line protocol, the pcap format, timestamps
docs/requirements.md The requirements, with IDs
docs/test-plan.md Host tests, bench and car checks
docs/adr/ Architecture decision records

Status

  • The laptop side is covered by make test, which feeds made-up frames through a fake CANPico, including a timer wrap, and reads the pcap back.
  • The same CANPico has replayed recorded traffic into the dash and captured the dash's read requests on the bench, using simpler scripts. ./replay is those scripts made into a tested command; its own hardware check is in the test plan.
  • It has recorded a live bus: on 2026-11-27, a Caterham 420R's bus at the OBD port, listen-only, with Easimap reading. The other hardware checks are listed in the test plan.
  • Changes are listed in CHANGELOG.md.

About

Record a CAN bus to pcap with a Canis Labs CANPico: listen-only by default (Caterham CAN Logger Display bench and car tool)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages