Wire protokolleri

CAN Sorun Giderme

Bu sayfanın teknik içeriği İngilizcedir.

Start with the interface state, then check what your capture can see. On physical hardware, do the electrical checks on an isolated bench.

Check the interface and capture

On Linux, identify the intended interface with ip -brief link. Substitute its name for can0 in these read-only commands. Record the reported driver and calculated timing, controller state, and available counters before and after the symptom.

ip -details -statistics link show dev can0
candump -e -d 'can0,0:0,#FFFFFFFF'

The filter admits all data and requests SocketCAN error notifications. -e decodes error details and -d monitors socket drops. Drivers vary in which errors and counters they report. If supported, enable berr-reporting on in the bench interface configuration while the link is down, then bring it back up. A normal running controller usually reports ERROR-ACTIVE. Use the error counters lab to compare snapshots around a known transmission. An empty capture can mean an idle bus, a wrong interface, filtering, or failure to decode frames. See the Linux SocketCAN reference and can-utils.

Isolate a missing ACK

On a two-node bench, send one known Classical frame and check for it in a capture on the peer. A receiver in normal mode that accepts the frame at the protocol level drives the ACK slot dominant, even if an application has filtered the ID out. A listen-only node does not ACK. Local SocketCAN echo and a successful socket write establish limited host-side facts. Use the second node's capture or inspect the ACK slot with a scope or physical analyzer to verify the exchange.

If the transmitter reports an ACK error, check for an unpowered peer, standby or silent transceiver, listen-only mode, mismatched nominal timing, swapped conductors, or an FD frame reaching Classical-only equipment. Correct one variable at a time, then repeat the single-frame test. Stop the sender if errors repeat because the controller may retry an unacknowledged frame. ACK establishes reception by at least one node at the link layer. Verify application delivery separately with the two-node bench lab.

Distinguish error-passive from bus-off

Compare berr-counter tx and rx, when exposed by the driver, and the changes in bus-errors, error-pass, and bus-off. Error-passive indicates elevated error counters and the controller can still participate, with passive error signaling. A bus-off controller stops participating. A rising transmit counter points you toward failures while transmitting, but ACK, timing, and electrical faults can look similar in a log. A missing ACK on an otherwise idle bus can leave a transmitter error-passive without pushing it all the way to bus-off.

Stop traffic and fix the cause before recovering. On the isolated bench, with automatic restart disabled, use sudo ip link set dev can0 type can restart after confirming the controller is bus-off and the driver supports manual restart. Recheck state, send one test frame, confirm receipt at the peer, then check that counters stay stable. If the controller returns to bus-off, stop and investigate the physical link and settings. See SocketCAN bus-off and restart controls and the counter inspection exercise.

Check termination, wiring and noise

  1. Power off the whole bench before measuring resistance. On a standard high-speed trunk with two simple 120 Ω end terminations, CAN_H to CAN_L should read about 60 Ω. Around 120 Ω suggests one effective termination, around 40 Ω suggests three, and a near short or open calls for sectional isolation. Bias networks and unusual termination can change the reading.
  2. Check continuity, H-to-H and L-to-L polarity, and the transceivers' common-mode and reference requirements. Check jumpers for hidden or duplicate terminators. Keep the pair twisted, place termination at the two physical ends, and shorten stubs.
  3. Power up. With appropriate differential probing, compare CAN_H−CAN_L at the endpoints and look for ringing, reduced amplitude or intermittent disturbances. Check the common-mode range against the actual transceiver datasheet. Repeat the same traffic after moving noisy cabling, correcting grounding, or shortening a stub, and compare scope traces and error counters.

See TI's high-speed CAN physical layer application report for topology, termination and signal integrity. The bench lab includes an unpowered resistance check.

Verify bitrate and sample point

Compare bitrate, sample_point, tq, segment lengths, sjw, and clock at both nodes. For FD with BRS, also compare dbitrate and data-phase timing and confirm ISO mode. An incorrect module oscillator setting can make the software report the requested bitrate while the waveform uses a different bit duration. Start at a shared known nominal bitrate on a short bench link. When only BRS traffic fails, inspect the data phase and transceiver capabilities first.

Use the bit timing calculator with the actual controller clock and segment limits. Verify the timings the driver actually selected, then check bit duration and settling at the far end. A matching nominal bitrate alone leaves propagation, oscillator tolerance, and sample point to check. The MCP2515 lab shows where the Linux driver gets its controller clock and interrupt settings.

Investigate periodic gaps and capture loss

Save a timestamped capture and record its interface, timestamp source and any drop counts. In the capture analyzer, compare timestamps per interface, identifier width, identifier and frame type. An anomalous gap can come from source scheduling, bus access, retransmissions, filtering or loss in the receive path. Inspect socket drops and interface statistics and repeat at a lower sender rate. Compare with an independent capture if possible. A capture interval describes observed arrivals and does not on its own establish missed transmissions or bus utilization.

Use the periodicity lab to establish a virtual baseline before checking physical behavior. For application delays, compare observed intervals with process-side activity using Execmap's Linux runtime analysis guide.