Python CAN Bus Timing Issue on Jetson Orin Nano: Missed & Delayed Packets with 1ms Loop

copy of this post: Reddit - The heart of the internet

I’m developing a real-time control system on Jetson Orin Nano, with a main loop running every 1ms.
The system uses a single CAN bus running at 1Mbps, communicating with sensors and motors as follows:

*** Sensors**

  • 2 Loadcells (Left & Right) → Each sends 1 CAN packet every 1ms → Total: 2 packets/ms
  • 2 IMUs (Left & Right) → Each sends 3 packets every 10ms (quaternion, gyroscope, accelerometer) → Total: 6 packets every 10ms~0.6 packets/ms average

*** Actuators**

  • 2 Motors (Left & Right) → Jetson sends 1 control command per motor every 1ms2 packets/ms

*** Estimated Load**

  • Total ≈ 4.6 packets per ms, at 1 Mbps CAN speed → approx. 60–65% bus utilization
  • This seems to push the CAN bus close to saturation.

*** In an ideal setup:**

  • A Loadcell packet sent at 4ms is received by Jetson before 5ms, and used in the 5ms control loop.

*** However, I’m observing:**

  1. Some packets are lost or delayed due to CAN congestion (maybe)
  2. Packets are occasionally received in bursts (e.g., Jetson receives two packets in one 1ms loop)
  • For example, 4ms packet is missed, then both 4ms and 5ms packets arrive at 6ms, which causes loop misalignment.

*** Question**

  • Has anyone experienced similar issues with python-can under high-frequency (1kHz or over 1kHz) traffic?
  • Would moving to C++ improve reliability and latency?

Hi soonho0705,

Are you using the devkit or custom board for Orin Nano?
What’s the Jetpack version in use?

Are you using internal mttcan to connect with your sensors and motors?

Would you hit the delay issue if you connect only one CAN device?
Is there any error in dmesg at this moment?

  1. Are you using the devkit or custom board for Orin Nano?

I’m using the devkit.

  1. What’s the Jetpack version in use?

The Jetpack version I’m using is 6.2.

  1. Are you using internal mttcan to connect with your sensors and motors?

Yes, I believe I followed the setup described in this link (Controller Area Network (CAN) — Jetson Linux Developer Guide documentation) and I’m currently using this library(GitHub - hardbyte/python-can: The can package provides controller area network support for Python developers).

  1. Would you hit the delay issue if you connect only one CAN device? Is there any error in dmesg at this moment?

I haven’t checked that yet, but I will verify and share the results.

Also, based on theoretical calculations, I understand that if CAN bus utilization exceeds 80%, communication may fail.
I’m wondering if it’s expected behavior for CAN packets to be delayed as CAN bus utilization increases.

It seems the expected result since they are from the same CAN interface.
The CAN bus uses the CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) protocol for communication. When multiple nodes attempt to transmit data simultaneously, the bus arbitrates based on message priority (determined by the CAN ID). Lower-priority messages must wait for higher-priority messages to finish transmitting, leading to increased arbitration delays as bus utilization rises.

Please check if your delay issue is caused from multiple CAN devices on your CAN bus.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.