PEAK CAN USB: How Much Latency and Jitter Does It Add?

Stefan Weidner6 min read
Industrial NetworkingOther ManufacturerTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

CAN frames arrive at the host API later than their bus timestamps, or a transmit request appears on the CAN bus after a variable pause. Follow the packet through the host application, operating-system scheduler, USB transport, adapter firmware, CAN controller, and physical bus. For this module class, use 1 ms as the USB-related latency allowance in each direction. Treat that value as a transport budget, not a guaranteed bound for the complete application-to-bus path.

Which path does each CAN frame follow?

The transmit path starts when the application submits a CAN message to the API. The request then passes through the operating system and USB subsystem, reaches the module firmware and CAN controller, and waits for bus access before transmission. The receive path runs in reverse: the CAN controller accepts the frame, the module firmware timestamps the reception, USB carries the data to the host, and the API delivers it to the application.

Direction Start event Intermediate delays End event
Transmit Application submits the request Host scheduling, USB buffering, firmware handling, CAN arbitration Frame appears on the CAN bus
Receive Frame reaches its CAN acknowledgement point Firmware handling, USB buffering, host scheduling API returns or signals the message

These directions require separate measurements. A single round-trip result combines two USB transfers, application processing, CAN serialization, arbitration, and any response delay in the remote node. It cannot identify which segment produced the jitter.

Does the physical CAN path pass first?

Layer one comes before USB timing analysis. Check that the selected CAN channel uses the intended bit rate and that the bus has valid wiring, termination, grounding, and transceiver power. Inspect controller error counters and error-state indications while generating the test traffic. Error frames and retransmissions extend observed latency without changing the host-to-module USB mechanism.

Reading Outcome Decision
Independent bus capture shows errors or repeated transmissions The physical or data-link layer is adding delay Correct the bus before measuring USB overhead
Bus is error-free but transmission start varies USB, host scheduling, or CAN arbitration remains in the path Measure the transmit segments separately
Bus reception time is stable but API delivery varies The variation occurs after CAN reception Compare the firmware timestamp with host arrival time

CAN arbitration is also a variable delay. A ready frame with a lower-priority identifier can lose access to another transmitter. Record bus load and competing traffic during every test; otherwise arbitration jitter can be mistaken for module overhead.

Is USB buffering producing the observed delay?

The USB subsystem sends a package when its transport buffer becomes full or when its timeout expires. Payload therefore changes delivery behavior. Under heavier traffic, several CAN frames can share a USB transfer and fill the buffer quickly. Under light traffic, the timeout can release a package containing only one CAN frame.

Condition USB behavior Expected timing effect
Transport buffer fills Package is released because payload reached the buffer condition Lower waiting time may occur
Transport buffer remains partly filled Package waits for the timeout Latency can approach the USB allowance
Single CAN frame in a USB transfer Low payload does not amortize the transfer Allow 1 ms of USB-related delay

Apply the 1 ms allowance to reception and transmission. It does not include operating-system dispatch latency, application thread scheduling, CAN arbitration, serialization on the wire, error recovery, or processing in another node. A non-real-time operating system can add variable scheduling delay, particularly when the CPU or USB stack is busy.

What time does the receive timestamp represent?

The receive timestamp is generated in the USB device firmware and represents the actual acknowledgement time of the received CAN frame. It is not the time at which the host application reads the message. The API may deliver the message roughly one USB transport interval later while the embedded timestamp continues to identify the bus-side reception event.

Calculate receive transport latency on a common time base as:

Receive delivery latency = host API arrival time - CAN receive timestamp

Clock alignment is the deciding measurement. If the host clock and module timestamp do not share a synchronized basis, absolute subtraction can include clock offset and drift. In that case, use an independent capture system or the API's documented timestamp conversion method. Do not interpret timestamp-to-host differences until the clock relationship is known.

For transmission, the supplied receive-timestamp behavior does not provide a transmit-on-wire timestamp. Measure the application submission and the frame's physical bus appearance with instruments that share a time reference.

Is the jitter in the module, host, or bus?

Run four controlled cases: receive under light traffic, receive under sustained traffic, transmit on an idle bus, and transmit with competing CAN traffic. Keep the CAN identifier, payload length, channel, bit rate, application code path, and host power state unchanged within each comparison.

Observed change Likely location Next check
Receive latency changes with USB payload USB buffer fill versus timeout Compare single-frame and grouped transfers
API arrival varies while embedded timestamps remain regular USB delivery or host scheduling Trace API arrival and operating-system load
Transmit delay grows only with competing CAN traffic CAN arbitration Compare request time with bus start time
Both directions degrade during host load Operating-system or USB scheduling Repeat with controlled CPU and USB activity

Report jitter as a distribution, not one sample. At minimum, record the minimum, maximum, and peak-to-peak spread: Jitter = maximum latency - minimum latency. Separate cyclic from noncyclic traffic because periodic scheduling can create a different distribution from isolated event messages.

How should the resolving branch be tested?

  1. Connect an independent CAN capture point and verify that the bus is free of errors and retransmissions during the test.
  2. Record the CAN channel, identifier, payload length, bit rate, bus load, operating system, application timing method, and whether the traffic is cyclic.
  3. For reception, capture the firmware-generated CAN timestamp and the host API delivery time for every frame. Use 1 ms as the USB transport allowance.
  4. For transmission, timestamp the API submission and capture when the frame appears on the bus. Separate USB and host delay from arbitration by repeating the test on an idle bus.
  5. Repeat both directions with low payload and sustained payload. A reduction under sustained traffic points to buffer-fill behavior; variation tied to host load points to operating-system scheduling.
  6. After correcting the identified layer, repeat the same sample set under the highest intended host and CAN load. Confirm that receive timestamp-to-API latency and transmit request-to-bus latency stay within the project's limits.

FAQ

What happens if the USB transport buffer does not fill?

The subsystem waits for its timeout and can send a package containing only one CAN frame. Budget 1 ms of USB-related latency for that transfer.

What happens if the CAN timestamp is earlier than API delivery?

The timestamp records the frame's acknowledgement time in device firmware, while USB and host scheduling occur afterward. Compare the two only after establishing their clock relationship.

What happens if measured latency exceeds 1 ms?

The 1 ms value covers the USB-related allowance, not the entire path. Check host scheduling, buffer behavior, CAN arbitration, errors, and retransmissions, then repeat the loaded-path test and confirm both directional latency distributions against the project limits.

Back to blog