Matlab Use Vehicle Network
MathWorksOfficialCreated by MathWorks
- Skill
- Tool integration
- Science and research
- BSD-2-Clause
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a comprehensive guide for using the MATLAB Vehicle Network Toolbox to establish communication with vehicle networks. It covers the complete lifecycle of CAN and CAN FD channels, including hardware discovery, channel configuration, message transmission, and signal decoding. The skill is designed to help users navigate vendor-specific requirements for hardware like Vector, Kvaser, PEAK-System, and NI, while providing structured troubleshooting paths for common bus communication issues.
What it does
- Discovers and initializes vehicle network hardware channels.
- Configures bus speeds and communication parameters for CAN and CAN FD.
- Facilitates message transmission and reception using standard and extended frames.
- Supports signal-level encoding and decoding using database files.
- Provides structured diagnostic workflows for troubleshooting bus communication errors.
- Manages channel lifecycles to ensure proper hardware release and initialization access.
When to use it
- When setting up a test bench for CAN or CAN FD communication in MATLAB.
- When you need to send or receive messages on a vehicle bus.
- When troubleshooting connectivity or bus status errors in a vehicle network.
- When you need to perform signal-level analysis on raw network traffic.
- When configuring hardware from supported vendors like Vector, Kvaser, or NI.
Advantages
- Standardizes the workflow for diverse hardware vendors.
- Provides clear, vendor-specific syntax for complex bus speed configurations.
- Includes mandatory verification steps to ensure bus health after transmission.
- Offers a structured diagnostic path to resolve common communication failures.
- Supports both physical hardware and virtual channels for flexible testing.
Usage examples
- “How do I create a CAN FD channel for my Vector hardware?”
- The agent will provide the specific canChannel constructor syntax with the 'ProtocolMode' set to 'CAN FD' and advise on using the advanced configBusSpeed form.
- “My CAN bus is not receiving messages, what should I do?”
- The agent will initiate the diagnostic workflow, starting with checking the bus status and error counters (TEC/REC) to identify the root cause.
- “How do I send a periodic message in MATLAB?”
- The agent will explain the use of transmitPeriodic for hardware-timed, non-blocking transmission and how to use pack to update signal data.
Install
11 of its files are not mirrored here, so install it from its source:
https://github.com/matlab/matlab-agentic-toolkit/tree/2a7f215e965597acf6ed495beb9e7b8aff45a3be/skills-catalog/test-and-measurement/matlab-use-vehicle-network
Documentation by MathWorks
MATLAB Vehicle Network Communication
Prerequisites
MATLAB R2021a or later
Vehicle Network Toolbox installed (
ver('vnt')to verify)For physical hardware: vendor-specific drivers installed (Vector CANlib, Kvaser CANlib, NI-XNET, PEAK PCAN driver)
For testing without hardware: MathWorks Virtual channels are always available
Overview
Guide Claude through helping users establish vehicle network communication using MATLAB Vehicle Network Toolbox. This skill covers the full workflow from hardware discovery to message exchange across all supported protocols and vendors.
Implemented protocols:
CAN / CAN FD — fully documented
Planned protocols (architecture ready, not yet documented):
J1939 — parameter groups, transport protocol, address claiming
XCP — measurement, calibration, A2L file handling
Additional protocols as VNT adds support
When to Use
User wants to send/receive messages on a vehicle network bus in MATLAB
User is setting up a communication test bench or loopback verification
User asks about Vehicle Network Toolbox channel configuration
User encounters channel errors (initialization access, bus speed, no acknowledgment)
User wants to filter, decode, or analyze vehicle network messages
User asks which hardware works on their platform
User wants passive bus monitoring without affecting traffic
User needs to encode/decode signal data from messages
When NOT to Use
User wants to log/replay BLF files without live communication — use a BLF logging skill
User is building Simulink vehicle network blocks — use Simulink-specific skills
User needs CAN database file (DBC/LDF/A2L) creation or editing — this skill covers using existing files only
User is working with a protocol not yet documented in this skill (check protocol sections below)
Protocol Router
Use this decision tree to identify which protocol the user needs:
| User's Goal | Protocol | Reference Section |
|---|---|---|
| Send/receive CAN or CAN FD messages | CAN/CAN FD | references/can/ |
| Work with SAE J1939 parameter groups | J1939 | Not yet documented |
| ECU measurement or calibration via XCP/CCP | XCP | Not yet documented |
| General hardware discovery (any protocol) | Shared | references/shared/ |
If the user asks about a protocol not yet documented, inform them which protocols are currently covered and offer to help with those.
Shared Concepts (All Protocols)
Hardware Discovery
t = canChannelList; % CAN/CAN FD/J1939 devicesAll VNT protocols share the same hardware discovery mechanism. See references/shared/hardware-discovery.md.
Channel Lifecycle
All protocols follow the same lifecycle pattern:
Create Channel → Configure → Start → Operate → Stop/CleanupKey rules:
Configuration (bus speed, filters) must happen BEFORE
startclear chreleases the channel (equivalent to stop + destroy)Use
onCleanup(@() stop(ch))for error-safe cleanupRunning channels hold InitializationAccess — blocking new channel creation
See references/shared/channel-lifecycle.md.
Vendor / Platform Matrix
| Vendor | Windows | Linux | Notes |
|---|---|---|---|
| Vector | Yes | No | Virtual channels if driver installed |
| NI | Yes | No | No channel index in constructor |
| Kvaser | Yes | Yes | Restart MATLAB after connecting hardware |
| PEAK-System | Yes | Yes | 10-arg clock-based configBusSpeed |
| SocketCAN | No | Yes | Configure speed at OS level via ip link |
| MathWorks Virtual | Yes | Yes | Always available, no driver needed |
CAN / CAN FD
Troubleshooting Gate
If the user reports a CAN/CAN FD problem — "not working", "trouble", "error", "can't connect", "no messages", hardware not detected, or any communication failure — you MUST do one of the following:
Domain-knowledge question ("why does X cause Y", "what's the maximum stub length for CAN FD", "explain bit rate switching") — answer from references/can/troubleshooting/l1-domain-knowledge.md without running diagnostics.
Actionable problem requiring diagnosis — Load references/can/troubleshooting/diagnostic-workflow.md BEFORE responding. Follow its Entry-Point Routing to select the correct starting step. Do NOT diagnose from this file. The tables, pitfalls, and patterns below are reference material for healthy operation — they are NOT a diagnostic procedure. Improvising from them produces wall-of-text responses with multiple guesses instead of structured one-question-at-a-time triage.
Core Workflow
digraph can_workflow {
rankdir=TB;
node [shape=box];
discover [label="1. Discover Hardware\ncanChannelList"];
decide [label="CAN Classic or CAN FD?" shape=diamond];
create_classic [label="2a. Create Channel\ncanChannel(vendor, device, ch)"];
create_fd [label="2b. Create FD Channel\ncanChannel(..., ProtocolMode='CAN FD')\nor canFDChannel(...)"];
config [label="3. Configure Bus Speed\nconfigBusSpeed (vendor-specific syntax)"];
start [label="4. Start Channel\nstart(ch)"];
operate [label="5. Transmit / Receive\ntransmit, receive\ntransmitPeriodic, transmitEvent, replay"];
cleanup [label="6. Cleanup\nstop(ch) or clear ch"];
discover -> decide;
decide -> create_classic [label="Classic"];
decide -> create_fd [label="CAN FD"];
create_classic -> config;
create_fd -> config;
config -> start;
start -> operate;
operate -> cleanup;
}Post-Transmit Verification (MANDATORY)
After ANY transmit, verify the bus accepted the frame before reporting success:
pause(0.5);
fprintf('TEC=%d REC=%d BusStatus=%s\n', ch.TransmitErrorCount, ch.ReceiveErrorCount, ch.BusStatus);| Result | Action |
|---|---|
| TEC=0, REC=0, ErrorActive | Healthy — report success |
| TEC>0 OR REC>0 OR not ErrorActive | Unhealthy — report counters to user, route to diagnostic workflow Step 0.5. Follow diagnostic Interaction Rules (one question at a time). |
Never claim "sent successfully" from transmit returning without error. It is non-blocking and returns immediately regardless of bus state. When routing to diagnostics, do NOT list multiple possible causes — let Step 0.5 identify the root cause and ask one targeted question.
CAN Classic vs CAN FD Decision
| Aspect | CAN Classic | CAN FD |
|---|---|---|
| Max payload | 8 bytes | 64 bytes |
| Message constructor | canMessage(id, ext, dlc) | canFDMessage(id, ext, dlc) or canMessage(..., ProtocolMode="CAN FD") |
| Channel creation | canChannel(vendor, device, ch) | Add 'ProtocolMode', 'CAN FD' or use canFDChannel |
| Bus speed config | Single speed | Arbitration + Data phase (vendor-specific syntax) |
receive output | Objects or timetable | Always timetable |
| Valid DLCs | 0–8 | 0, 8, 12, 16, 20, 24, 32, 48, 64 |
Critical Patterns (Non-Obvious API Behavior)
These patterns are where the API behaves differently than expected. Follow these exactly.
attachDatabase operates on MESSAGES, not channels
% WRONG — will error
attachDatabase(ch, db);
ch.Database = db; % only valid for name-based filterAllowOnly
% CORRECT — attach to received message object
rxMsg = receive(ch, 1);
attachDatabase(rxMsg, db);
speed = rxMsg.Signals.EngineSpeed;transmitPeriodic + pack for live signal updates
% WRONG — manual loop blocks MATLAB, timing is inaccurate
while running
pack(msg, newValue, 0, 16, 'LittleEndian');
transmit(ch, msg);
pause(0.1);
end
% CORRECT — hardware-timed, non-blocking
transmitPeriodic(ch, msg, 'On', 0.1);
start(ch);
pack(msg, newValue, 0, 16, 'LittleEndian'); % next cycle sends updated datafilterAllowOnly REQUIRES type argument for numeric IDs
% WRONG — errors with "Expected NAME to be one of these types: char, cell"
filterAllowOnly(ch, [0x180 0x181]);
% CORRECT — must specify 'Standard' or 'Extended'
filterAllowOnly(ch, [0x180 0x181], 'Standard');
filterAllowOnly(ch, [0x18FEF100], 'Extended');CAN FD configBusSpeed is vendor-specific
% MathWorks Virtual / NI — simple 3-arg form works
configBusSpeed(ch, 500000, 2000000);
% Vector / Kvaser — REQUIRES 9-arg advanced timing form
configBusSpeed(ch, 500000, 2, 6, 3, 2000000, 2, 6, 3);
% PEAK-System — REQUIRES 10-arg clock-based form
configBusSpeed(ch, 20, 5, 1, 2, 1, 2, 1, 3, 1);CAN FD receive ALWAYS returns timetable
% CAN FD channels ignore OutputFormat — always timetable
msgs = receive(fdCh, Inf); % returns timetable
msgs.ID % numeric vector of IDs
msgs.Data{1} % uint8 vector for first message
% WRONG: msgs(1).Data, msgs.Data(1) — these error on timetabletransmitEvent fires on ANY .Data write (including pack)
transmitEvent(ch, msg, 'On');
start(ch);
pack(msg, value, 0, 16, 'LittleEndian'); % this auto-transmits!
% No explicit transmit() call needed — pack triggers itCommon Pitfalls
| Pitfall | Symptom | Fix |
|---|---|---|
| Stale channel object | "lacks initialization access" | clear the variable or stop prior channel |
canMessage for FD payload | "DATALENGTH must be <= 8" | Use canFDMessage or add ProtocolMode="CAN FD" |
| No acknowledging node | Transmit retries continuously | Ensure another node/channel is started on the bus |
| Claiming success without checking counters | User believes data sent; bus is ErrorPassive | ALWAYS check TEC/REC/BusStatus after transmit |
| Bus speed mismatch | Transmit succeeds, receive empty | All nodes must share same speed |
configBusSpeed after start | Error | Must configure while channel is offline |
| Reusing variable | Error on creation | clear variable before creating new channel |
configBusSpeed on SocketCAN | Not supported | Configure speed at OS level via ip link |
| CAN FD on PEAK-System Linux | Self-receive not supported | Use SocketCAN as workaround |
unpack on timetable | "Incorrect number or types of inputs" | CAN FD always returns timetable; use typecast(data(1:2), 'int16') on raw bytes |
CAN References
Detailed API documentation (load on demand):
references/can/channel-creation.md —
canChannel,canFDChannel, vendor-specific syntaxreferences/can/bus-speed-config.md —
configBusSpeed, vendor-specific argument countsreferences/can/message-creation.md —
canMessage,canFDMessage, valid FD DLCsreferences/can/transmit.md —
transmit,transmitPeriodic,transmitEvent,replayreferences/can/receive.md —
receive,SilentMode, timetable output, FIFO behaviorreferences/can/filters.md —
filterAllowOnly,filterBlockAll,filterAllowAllreferences/can/database.md —
canDatabase,attachDatabase, signal-level decode/encodereferences/can/pack-unpack.md —
pack,unpack, signal extraction, byte-orderreferences/can/message-extraction.md —
extractAll,extractRecent,extractTime,discard
CAN Troubleshooting
See Troubleshooting Gate at the top of this section. Also route to diagnostics when the agent observes unhealthy bus state (TEC/REC > 0, BusStatus not ErrorActive) during any operation — including after transmit verification.
references/can/troubleshooting/diagnostic-workflow.md — Full diagnostic procedure (Phase 0 automation, L1 physical, L2 traffic analysis)
references/can/troubleshooting/script-interfaces.md — Function signatures, arguments, and outputs for all diagnostic/analysis scripts
Shared References
references/shared/hardware-discovery.md —
canChannelList, platform constraintsreferences/shared/channel-lifecycle.md —
start,stop,onCleanup, channel releasereferences/shared/limitations.md — Vendor/platform-specific constraints
Copyright 2026 The MathWorks, Inc.
Files
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSELicence file added by AutoGineer1.4 KiB
- SKILL.md13.1 KiB
- manifest.yaml537 B
- references/can/bus-speed-config.md2.2 KiB
- references/can/channel-creation.md1.5 KiB
- references/can/database.md3.0 KiB
- references/can/filters.md2.8 KiB
- references/can/message-creation.md1.3 KiB
- references/can/message-extraction.md3.8 KiB
- references/can/pack-unpack.md2.6 KiB
- references/can/receive.md1.9 KiB
- references/can/transmit.md2.3 KiB
- references/can/troubleshooting/bus-length-guidelines.md3.5 KiB
- references/can/troubleshooting/diagnostic-workflow.md21.4 KiB
- references/can/troubleshooting/l1-branches.md11.1 KiB
- references/can/troubleshooting/l1-domain-knowledge.md6.8 KiB
- references/can/troubleshooting/l1-failure-scenarios.md3.6 KiB
- references/can/troubleshooting/l2-analysis-pipeline.md4.5 KiB
- references/can/troubleshooting/l2-interpretation-tables.md1.8 KiB
- references/can/troubleshooting/script-interfaces.md2.6 KiB
- references/shared/channel-lifecycle.md1.1 KiB
- references/shared/hardware-discovery.md1.1 KiB
- references/shared/limitations.md1.7 KiB
- scripts/can/troubleshooting/canBaudRateScanActive.p(opens on GitHub)Not mirrored: opens on GitHub1.0 KiB
- scripts/can/troubleshooting/canBaudRateScanPassive.p(opens on GitHub)Not mirrored: opens on GitHub1.0 KiB
- scripts/can/troubleshooting/canBurstDetection.p(opens on GitHub)Not mirrored: opens on GitHub488 B
- scripts/can/troubleshooting/canBusLoadCalc.p(opens on GitHub)Not mirrored: opens on GitHub787 B
- scripts/can/troubleshooting/canChannelHealthCheck.p(opens on GitHub)Not mirrored: opens on GitHub902 B
- scripts/can/troubleshooting/canCycleTimeAnalysis.p(opens on GitHub)Not mirrored: opens on GitHub558 B
- scripts/can/troubleshooting/canDiagnosticProbe.p(opens on GitHub)Not mirrored: opens on GitHub335 B
- scripts/can/troubleshooting/canHardwareDiscovery.p(opens on GitHub)Not mirrored: opens on GitHub290 B
- scripts/can/troubleshooting/canLoopbackSelfTest.p(opens on GitHub)Not mirrored: opens on GitHub628 B
- scripts/can/troubleshooting/canSupportSummary.p(opens on GitHub)Not mirrored: opens on GitHub1.4 KiB
- scripts/can/troubleshooting/canTrafficOverview.p(opens on GitHub)Not mirrored: opens on GitHub900 B
references/can/troubleshooting/diagnostic-workflow.md
CAN Network Diagnostic Workflow
Diagnoses CAN/CAN FD network health across physical (L1) and data link (L2) layers. Automates what MATLAB can observe, then guides manual investigation for what it cannot.
Announce at start: "Using CAN Diagnostics — I'll check your hardware and network health."
Interaction Rules
Route on what's given. If the user already provided diagnostic data, skip to the relevant phase — don't re-ask what they told you. See Entry-Point Routing below.
Automation first. Use MCP (
mcp__matlab__evaluate_matlab_code) to run diagnostics directly. Only provide code snippets if MCP is unavailable or customer declines.One question at a time. Don't ask multiple branching questions in a single response. Present ONE question with numbered options (1, 2, 3...) and a final "Other" option. But DO provide the diagnosis and recommended action path alongside the question.
Don't ask what you can measure. If the channel is live, read BusStatus/TEC/REC directly.
Stop when the root cause is found. If L1 explains the problem, don't proceed to L2.
L2 only if symptoms remain after L1 checks pass or the customer confirms their issue isn't resolved.
Run functions, don't read them. Execute via
mcp__matlab__evaluate_matlab_codewithproject_pathset to the skill'sscripts/can/troubleshooting/directory — only the output enters context. See script-interfaces.md for all function signatures.
Entry-Point Routing
Before starting Phase 0, assess what the user has already told you and route accordingly:
User gave specific diagnostic data (BusStatus, TEC/REC values, FilterHistory, error symptoms with measurements): → Acknowledge what they reported, state your interpretation in one sentence, then jump directly to the relevant phase/step.
Agent self-detects unhealthy bus state (TEC/REC > 0, BusStatus not "ErrorActive" observed during transmit/receive — not reported by the user): → Stop further operations. Report the observed state and a one-sentence interpretation from Step 0.5 (e.g., "TEC=128, REC=0 indicates no other node is acknowledging"). Then present a brief plan (2-3 steps) and ask ONE targeted question to move forward. All Interaction Rules apply — do NOT list multiple possible causes or ask multiple questions.
User mentions hardware not showing up (canChannelList empty, device not found, hardware missing): → Acknowledge, then go straight to Step 0.2 (run canSupportSummary).
User already has a traffic timetable (from live capture, BLF import, or any source): → Acknowledge, then go straight to Phase 2 (traffic analysis).
User is vague ("CAN isn't working", "not receiving messages", "having communication problems" — no specifics): → Respond with:
A one-sentence acknowledgment of the symptom
A brief plan (2-3 steps, one line each): "Here's what I'll check: ..."
ONE question to get the first piece of info you need (hardware present? live bus? log file?)
Do NOT dump a multi-paragraph troubleshooting guide. Do NOT ask multiple questions. The plan shows you have a structured approach; the single question moves things forward.
Phase 0: Automated Hardware Check
Always attempt this first. MCP tool permissions handle user consent for code execution — do not add redundant "should I check?" prompts. Proceed directly.
Step 0.1: Discover Hardware
Purpose: Find what CAN hardware is connected to this machine.
Action: Run canHardwareDiscovery() — do not read the source, execute it.
Routing:
| Condition | Next |
|---|---|
| One physical device found | Auto-select it, proceed to Step 0.4 |
| Multiple physical devices found | Ask which one, then Step 0.4 |
| User selects Virtual | Treat as Virtual-only (Step 0.3, option 4) |
| No physical hardware (Virtual only) | Step 0.2 |
| ERROR | Step 0.2 |
Step 0.2: Driver Baseline
Purpose: Establish what drivers and plugins are installed so we can identify what's missing.
Action: Run canSupportSummary() — do not run raw canSupport followed by type('cansupport.txt'). The function runs canSupport internally and extracts only what matters: version info, available hardware, vendor driver status, and channel creation results.
If canSupportSummary was already run (e.g., arriving from Step 0.6 loopback pass), use those results — no need to re-run unless the user has made changes.
The summary output tells you:
Which vendor plugins are installed (PEAK, Vector, Kvaser, NI, Intrepid)
Whether vendor OS-level drivers are detected (driver version present vs missing)
Channel creation success/failure per vendor
MATLAB and VNT version info
Routing: Use these results to inform Step 0.3. Do not dig into DLLs, System32 paths, or non-user-facing internals — the script already checks all of that.
Step 0.3: Resolve Missing Hardware
Purpose: Determine why physical hardware isn't appearing and guide the user to fix it.
Action: Present the canSupportSummary findings alongside the question. The most common cause is the device is not plugged in (or not passed through — VM USB passthrough, remote desktop). After confirming connectivity, check vendor drivers.
I ran diagnostics and here's what I found: [summarize key findings from report]. No physical CAN hardware detected. Most common cause is the device isn't connected to this machine yet.
The device is plugged in via USB — I expected it to appear
Let me plug it in / check the USB connection, then retry
I'm using a VM or remote machine — USB passthrough may be the issue
I only have Virtual channels and that's intentional (simulation / software testing)
Other: ___
If 1 -> Use canSupportSummary results to identify the specific missing driver. If it shows the vendor plugin exists but the OS driver is missing, tell the user exactly which driver to install (e.g., "PEAK Device Driver package including PCANBasic API", "Vector Driver Setup", "Kvaser CANlib"). If it shows no plugin for their vendor, the VNT support package may need installing.
If 2 -> Wait, then re-run
canHardwareDiscovery(). If still missing -> same as 1.If 3 -> Advise checking VM USB passthrough settings. Re-run after they confirm.
If 4 -> Virtual-only is valid. Skip L1 entirely. Offer loopback self-test (Step 0.6) to verify VNT is healthy, then proceed to Phase 2 if they have traffic to analyze.
If 5 -> Re-examine canSupportSummary output for clues.
Step 0.4: Health Snapshot
Purpose: Connect to the selected hardware and get a baseline reading of bus health.
Action: Run canChannelHealthCheck(vendor, device, chIndex, useFD) — do not write custom inline code for this. Example:
canChannelHealthCheck("Vector", "VN1610 1", 1, false)It handles channel creation, bus speed display, start, 5-second listen, traffic sample, and before/after counter comparison.
Routing:
| Condition | Next |
|---|---|
| Channel creation FAILS | Step 0.6 (loopback self-test) |
| Start FAILS | Note BusOff/hardware issue, proceed to Step 0.5 |
| Success | Step 0.5 (interpret results) |
Step 0.5: Interpret and Route
Purpose: Classify the health check results and route to the correct next phase.
Action: Match results against this table:
| Result | Meaning | Action |
|---|---|---|
| BusStatus = "ErrorActive", traffic flowing | Channel healthy | If issues remain -> Phase 2. If errors on specific frame types -> Phase 1, Step 1.2. |
| BusStatus = "ErrorActive", 0 messages | Local interface OK, no traffic arriving | Check FilterHistory. If "Block All" -> fix filters. If "Allow All" -> Step 0.7. |
| BusStatus = "N/A", 0 messages, TEC=0, REC=0 | Receive-only with no traffic | If Virtual -> confirm paired endpoint transmitting. If physical -> Step 0.8. |
| BusStatus = "ErrorActive", REC <= 20, stable | Normal or residual errors | Ask: "Can you reproduce the fault while I monitor?" If yes -> longer capture. If no -> Phase 1, Step 1.2. |
| BusStatus = "N/A" | Channel idle, Virtual, or hardware doesn't expose state | Rely on traffic presence and counters. If traffic -> healthy. If 0 msgs + Virtual -> confirm paired endpoint. If 0 msgs + physical -> Step 0.8. |
| BusStatus = "ErrorPassive" | TEC or REC >= 128, physical stress or no ACK | -> Phase 1 Automated L1 Triage |
| BusStatus = "BusOff" | Severe physical or configuration problem | -> Phase 1 Automated L1 Triage |
| ErrorPassive + flood of garbage frames | Baud mismatch | -> Phase 1 Automated L1 Triage (will run baud scan) |
| TEC=128, REC=0 (transmitting) | No ACK — no other node listening | Check other nodes online at same baud. -> Branch: Bit Timing |
| TEC=0, REC=128 (transmitting) | No termination or open bus | -> Branch: Termination |
| TEC=0, REC maxed (not transmitting) | Monitor overwhelmed — over-terminated or baud-mismatched | -> Phase 1, Step 1.2 |
| TEC climbing, REC stable | This node's TX path is broken | -> Phase 1, Voltage branch |
| REC increasing, TEC stable | Receiving corrupted data | -> Phase 1, Ground branch |
| BusSpeed unexpected | Baud rate mismatch | Report mismatch. Ask what network expects. If unknown -> run canBaudRateScanPassive(vendor, device, chIndex). |
| Filter = "Block All" | Vendor default or leftover config | Fix filters, then re-listen. |
Step 0.6: Loopback Self-Test
Purpose: Confirm VNT itself works independently of the user's hardware.
Action: Run canLoopbackSelfTest().
Routing:
| Result | Meaning | Next |
|---|---|---|
| PASS | VNT is healthy. Hardware/driver is the problem. | -> Step 0.2 (re-run if not already done) |
| FAIL | VNT itself is broken. | -> Recommend: check license (ver), restart MATLAB, reinstall VNT |
Step 0.7: Connectivity Check
Purpose: Determine why no messages are arriving when filters are open.
Action: First, automate the channel sweep (passive — no user input needed).
If the adapter has multiple channels, listen briefly on each available channel before asking the user anything:
% TEMPLATE — not executable
chList = canChannelList;
% Filter to same vendor/device, try each channel index
% Listen 2s per channel, report if any receives trafficReport results: "I checked channels 1 and 2 — channel 2 is receiving traffic at 500 kbit/s."
If channel sweep finds traffic: Inform user they were on the wrong channel. Done.
If no channel receives traffic: Ask about remote devices:
I checked all available channels — none are receiving traffic. This means either:
The other ECUs/nodes aren't powered on or transmitting
There's a baud rate mismatch (I can scan for the correct rate — CAN Classic only; for CAN FD I'll ask directly)
Both are confirmed on and at the right rate — try a transmit probe
Not sure
Routing:
If 1 -> Ask them to verify power and cable connections, then retry.
If 2 -> Run
canBaudRateScanPassive(vendor, device, chIndex)(passive, no permission needed). If passive scan returns NO_TRAFFIC_AT_ANY_RATE: the remote device may be respond-only (ACKs but doesn't broadcast). Ask permission to transmit, then runcanBaudRateScanActive(vendor, device, chIndex)which transmits at each rate and checks for ACK. Do NOT re-run the passive scan or speculate — go straight to active.If 3 -> Step 0.8 (diagnostic probe — requires permission to transmit).
If 4 -> Run passive baud scan first, then escalate to active if no traffic found (same as option 2).
Step 0.8: Diagnostic Transmit Probe
Purpose: Test bus connectivity by sending a single frame (requires explicit user consent).
Action: Ask the customer first:
No traffic detected. I can send a single diagnostic frame to check bus connectivity. This will briefly transmit on the bus — is that OK?
Yes — send a test frame
No — this is a listen-only setup, don't transmit
I'm not sure if transmitting is safe
If 1: Run canDiagnosticProbe(canCh) (requires canCh to be a started channel in workspace).
| Result | Meaning | Action |
|---|---|---|
| TEC=0 after probe | Got ACK — bus connected, other nodes present but not transmitting to us | Ask what IDs they expect. Check if other nodes need triggering. |
| TEC=128, REC=0 | No ACK — no other node acknowledged | Confirm other nodes powered and online at same baud. -> Branch: Bit Timing |
| TEC=0, REC=128 | No termination — cable disconnected or unterminated | -> Branch: Termination |
If 2 or 3: Cannot probe. -> Phase 1, Step 1.2 (manual investigation path).
Phase 1: L1 Physical Layer Diagnosis
Enter when Phase 0 shows bus problems, error counters climbing, or customer describes physical-layer symptoms.
For detailed branch question trees: Read l1-branches.md For domain theory (explaining WHY): Read l1-domain-knowledge.md For rapid pattern matching: Read l1-failure-scenarios.md
Step 1.1: Automated L1 Triage
Purpose: Run passive automated checks before asking the user any questions.
Action: Listen/read = do it automatically. Transmit = ask first. Run checks based on what Phase 0 already revealed:
| Phase 0 Result | Automated Action | Ask user? |
|---|---|---|
| TEC=128 + REC>0 (mismatch signature) | Run canBaudRateScanPassive(vendor, device, chIndex) (passive). If NO_TRAFFIC_AT_ANY_RATE → ask permission, then run canBaudRateScanActive(vendor, device, chIndex) | Passive: No. Active: Yes (transmits) |
| 0 messages + multi-channel adapter | Try other channel indexes via health check | No — passive |
| ErrorPassive or BusOff | Re-read TEC/REC after 2s pause to determine trend | No — read-only |
| ErrorActive + 0 msgs + filters open | Already handled by Step 0.7 | — |
CAN FD gate: Do NOT run canBaudRateScanPassive for CAN FD channels AND do NOT build a custom FD rate-scanning script. Automated scanning is not viable for CAN FD because dual-rate timing requires vendor-specific multi-argument configuration that cannot be iterated generically. Instead, ask the user directly: "What arbitration and data rates does your network use? Common combinations: 500k/2M, 500k/4M, 1M/2M, 1M/5M."
Report findings from automated checks, THEN ask Step 1.2 only if the root cause isn't already clear. If automated triage identifies the problem (e.g., baud scan found the correct rate), skip the question tree and present the fix directly.
Step 1.2: Situation
Purpose: Classify the failure mode to route to the correct branch.
Action: Ask:
New setup — never communicated successfully
Was working before — now failing completely
Was working before — now failing intermittently
Error counters climbing but still communicating
Errors specific to CAN FD (long frames, data phase only)
Other: ___
Routing:
1 -> Step 1.3 (new setup)
2 -> Step 1.4 (complete failure)
3 -> Step 1.5 (intermittent)
4 -> Step 1.6 (error counters)
5 -> Branch: CAN FD (L1-FD-1 directly)
6 -> Step 1.3
Step 1.3: Scope (New Setup)
Purpose: Understand the network scale and current state to narrow the fault domain.
Action: Ask:
Two nodes (point-to-point)
Three to five nodes
More than five nodes
Not sure
Then:
Are any nodes communicating, or is everything silent?
Complete silence — no traffic at all
Some nodes talk, but one or more can't
Traffic exists but full of errors
Other: ___
Routing:
Silence -> Branch: Termination
Some failing -> Branch: Bit Timing
Errors -> Branch: Bit Timing
Step 1.4: Complete Failure (Was Working)
Purpose: Identify what changed to cause the regression.
Action: Ask:
Added a new node or tool to the bus
Changed wiring or connectors
Updated firmware/configuration on a node
Moved the system to a different location
Nothing changed — it just stopped
Other: ___
Routing:
1 -> Branch: Termination
2 -> Branch: Voltage
3 -> Branch: Bit Timing
4 -> Branch: Ground
5, 6 -> Branch: Termination
Step 1.5: Intermittent Failure
Purpose: Find the environmental or temporal correlation to narrow root cause.
Action: Ask:
Happens when motors/fans/heaters/VFDs activate
Happens under heavy CAN bus traffic
Worse when hot (temperature-related)
Happens at random — no pattern I can see
Happens with specific messages only
Other: ___
Routing:
1 -> Branch: Ground
2 -> Branch: Bit Timing
3 -> Branch: Waveform
4 -> Branch: Ground
5 -> Branch: Bit Timing
6 -> Branch: Ground
Step 1.6: Rising Error Counters
Purpose: Interpret error counter patterns and route to the appropriate physical branch.
Action: If no physical changes since Phase 0, you already have TEC/REC — use the Error Counter Interpretation Guide below to route directly.
If the user made physical changes (reconnected cables, added termination, swapped nodes) or the skill previously suggested physical debugging: re-read counters before routing — the values may have shifted.
Routing:
1 -> Branch: Voltage
2 -> Branch: Ground
3 -> Branch: Termination
4 -> Branch: Voltage
Error Counter Interpretation Guide
| Pattern | Likely Cause |
|---|---|
| Single node TEC climbing, others fine | That node's TX path (transceiver, wiring, stub) |
| Single node REC climbing, TEC normal | Receiver seeing corruption (ground issue at that node) |
| All nodes REC climbing together | Shared physical problem (termination, backbone) |
| Counters spike then recover | Intermittent (connector, thermal, EMI burst) |
| Node goes Bus Off repeatedly | Severe local issue — check entire physical interface |
| Errors only with specific message ID | Not physical — bit timing mismatch or data-dependent stuff pattern |
L1 Assessment
After completing relevant branches:
=== L1 Physical Layer Assessment ===
Termination: [OK / Issue: ___]
DC Voltages: [OK / Not checked / Issue: ___]
Ground: [OK / Suspect / Issue: ___]
Waveforms: [OK / Not checked / Issue: ___]
Bit Timing: [OK / Mismatch / Issue: ___]
CAN FD: [N/A / OK / Issue: ___]
Root Cause: ___
Recommended Actions:
1. ___
2. ___After L1 report, ask:
Does this explain the issue you're seeing, or do you still have symptoms?
That explains it — I'll fix the physical layer issue
I still have problems even though physical looks OK
Not sure — let me fix this first and come back
If 1 -> Done.
If 2 -> Phase 2.
If 3 -> Done for now.
Phase 2: Traffic Analysis
Entry conditions (either path):
Live capture: Phase 0 showed healthy bus but customer still has issues, or L1 checks passed but symptoms remain. Capture traffic into
rawMsgstimetable viareceive(canCh).Pre-loaded timetable: Customer already has a
rawMsgstimetable in the workspace (from any source — live capture, BLF import via the data import/export skill, or MDF/MAT load).
Requirement: A rawMsgs timetable must exist in the workspace before running scripts. If not present, either capture live or ask the user to load their data first.
Full analysis pipeline: Read l2-analysis-pipeline.md Interpretation thresholds: Read l2-interpretation-tables.md
L2 Functions (run, don't read):
canTrafficOverview(rawMsgs)— per-ID breakdown, dropout detectioncanCycleTimeAnalysis(rawMsgs)— jitter stats per IDcanBusLoadCalc(rawMsgs, busSpeedBps)— bus load estimation + starvation checkcanBurstDetection(rawMsgs, busSpeedBps)— temporal burst profiling (conditional)
Common Mistakes
Asking multiple questions at once — confuses users. ONE question per response.
Filters blocking everything — some vendors default to "Block All". Always check FilterHistory and call
filterAllowAllexplicitly.Mismatched bus speed — #1 cause of immediate BusOff. Verify speed matches the network.
Interpreting Virtual channel jitter as a problem — Virtual has ~8% OS jitter. Real hardware is much tighter.
Jumping to driver installation first — check physical connection before suggesting drivers. But vendor drivers (PEAK, Vector, Kvaser, etc.) ARE required for the OS to see the device. Diagnostic order: physical connection ->
canChannelList->canSupportSummary-> verify vendor drivers installed.Routing Virtual channel users into L1 — Virtual has no physical layer. Skip L1 entirely.
Saying "ErrorActive rules out cabling" — ErrorActive with 0 messages only means local transceiver is OK. Far end could be disconnected.
"lacks initialization access" — another application (e.g., Vector CANoe, PEAK PCAN-View, Kvaser CANKing, NI MAX) holds init access.
configBusSpeedwill fail. Close the other tool or configure bus speed there.Fabricating specific driver package names — say "vendor drivers" or "Vector drivers", not "XL Driver Library" or other specific package names the user might search for incorrectly. Let
canSupportSummaryoutput identify exactly what's missing.40 ohm termination — almost always means three terminators. Ask about tools.
"Works on bench, fails in vehicle" — always a ground problem until proven otherwise.
Analyzing too short a capture — need at least 3x the longest cycle time.
Not accounting for event-driven messages — some transmit on change only. High jitter is expected.
Copyright 2026 The MathWorks, Inc.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- MathWorks
- Publisher
- MathWorks (Official)
- Source
- matlab/matlab-agentic-toolkit · skills-catalog/test-and-measurement/matlab-use-vehicle-network · commit 2a7f215
- Licence
- BSD 2-Clause License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE.md)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by MathWorks or MathWorks.
Get it from the source
11 of this skill’s files are not mirrored here, so there is no ZIP. Get the complete skill from its source: matlab/matlab-agentic-toolkit