The can-bus state is ERROR-PASSIVE when first packet receive

My board is

  1. jetson xavier agxi.
  2. jetpack 4.6.3
  3. linux-tegra 4.9.299
  4. bsp L4T 32.7.3

I am developing can-bus application.
I faced the problem is can-bus state.
When my board is booted, can-bus receive data .
The state change ERROR-ACTIVE to ERROR-PASSIVE when can-bus is received first packet
To resolve this problem I reset can-bus driver.
for example

  1. rmmod mttcan
  2. modprobe mttcan
  3. interface up…

This reactivated can-bus works well for a long time.
It only problem when the first packet is received.
can i get help?

Hi Ryan1613,

Are you using Xavier AGX Industrial or Xavier NX?
Is that the devkit or custom board?

Is it 100% reproducible the state changed after the first packet received?

Could you send/receive data when the state is ERROR-PASSIVE?

  1. I am using Xavier AGX Industrial and the custom board.
  2. Yes. it is 100% reproducible
  3. I can not send or receive data.

I’ve moved your topic to the correct category for AGX Xavier Industrial.

Coud you help to share the full serial console log and the result of ifconfig can0 for further check?

This is a log when another can device is making a request to xavier periodically.
It is time within 30 seconds after booting.


nvidia@tegra-ubuntu:~$ ifconfig can0
can0: flags=193<UP,RUNNING,NOARP> mtu 72
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 75 bytes 600 (600.0 B)
RX errors 73 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 69


nvidia@tegra-ubuntu:~$ ip -d -s link show can0
6: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can <BERR-REPORTING,FD> state ERROR-PASSIVE (berr-counter tx 0 rx 127) restart-ms 0
bitrate 249350 sample-point 0.870
tq 52 prop-seg 33 phase-seg1 33 phase-seg2 10 sjw 10
mttcan: tseg1 2…255 tseg2 0…127 sjw 1…127 brp 1…511 brp-inc 1
dbitrate 249350 dsample-point 0.863
dtq 182 dprop-seg 9 dphase-seg1 9 dphase-seg2 3 dsjw 3
mttcan: dtseg1 1…31 dtseg2 0…15 dsjw 1…15 dbrp 1…15 dbrp-inc 1
clock 38400000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 418 0 1 1 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
3360 420 418 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0


nvidia@tegra-ubuntu:~$dmesg
[ 25.013476] mttcan c310000.mttcan can0: Stuff Error Detected
[ 25.013613] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x711
[ 25.013754] mttcan c310000.mttcan can0: Format Error Detected
[ 25.013870] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x712
[ 25.013983] mttcan c310000.mttcan can0: Format Error Detected
[ 25.014106] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x712
[ 25.014234] mttcan c310000.mttcan can0: Format Error Detected
[ 25.014350] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x712
[ 25.014460] mttcan c310000.mttcan can0: Format Error Detected
[ 25.019691] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x712

Could you share the full dmesg as file here?

How do you use another can device to make request to current Xavier periodically?

sorry. I was on vacation last week. So late reply.
And I attached dmesg.txt

Create signals with STM microcontrollers that are being used in other projects.
I also tried Kvaser, a can simulator, and it was the same phenomenon.
dmesg.txt (76.1 KB)

Could you share the block diagram of your connections?
and also the full commands you used to setup both can0 and can1.

  1. install
    sudo busybox devmem 0x0c303018 w 0x458 # can 0 / in
    sudo busybox devmem 0x0c303010 w 0x400 # can 0 / out
    sudo busybox devmem 0x0c303008 w 0x458 # can 1 / in
    sudo busybox devmem 0x0c303000 w 0x400 # can 1 / out
    sudo modprobe can
    sudo modprobe can_raw
    sudo modprobe mttcan
    sudo ip link set can0 up type can bitrate 250000 sjw 10 dbitrate 250000 dsjw 7 berr-reporting on fd on
    sudo ip link set can1 up type can bitrate 250000 sjw 10 dbitrate 250000 dsjw 7 berr-reporting on fd on

  2. I made a script with the above command and called by my application when booting.
    The can1 does not use now. It’s just a setting.

1 Like

Could you help to use the following command to setup both can0 and can1 w/o fd mode enabled?

$ sudo ip link set can0 up can0 bitrate 1000000
$ sudo ip link set can1 up can1 bitrate 1000000

and please also share the commands you used to send/receive packet.

  1. When I was used command “sudo ip link set can0 up can0 bitrate 1000000”, It is not work and view error message “Error: either “dev” is duplicate, or “can0” is a garbage.”
    So I changed the command to “sudo ip link set can0 up type can bitrate 1000000”.
nvidia@tegra-ubuntu:~/NV-DPU$ ip -d -s link show can0
6: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-PASSIVE (berr-counter tx 0 rx 127) restart-ms 0 
	  bitrate 1010526 sample-point 0.736 
	  tq 52 prop-seg 6 phase-seg1 7 phase-seg2 5 sjw 1
	  mttcan: tseg1 2..255 tseg2 0..127 sjw 1..127 brp 1..511 brp-inc 1
	  mttcan: dtseg1 1..31 dtseg2 0..15 dsjw 1..15 dbrp 1..15 dbrp-inc 1
	  clock 38400000
	  re-started bus-errors arbit-lost error-warn error-pass bus-off
	  0          0          0          1          1          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
    RX: bytes  packets  errors  dropped overrun mcast   
    16         2        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0 
  1. I am using PF_CAN socket and to receive can data using select API.
    If FD_ISSET is return FD, send can data.

Sorry that it’s my typo, your command should be right.

Do you know what causes can0 enter into ERROR-PASSIVE state?

can state ERROR-PASSIVE (berr-counter tx 0 rx 127) restart-ms 0 

There’s berr-counter in rx, it should be caused from wrong configuration for either side in CAN communication.
Could you send/receive data when you are in ERROR-PASSIVE state?

I can not send/receive data.

I don’t know why the state entered ERROR-PASSIVE.
However, I ran the following test to know the problem.

  1. The STM transmits can data periodically.
  2. Boot up the xavier board.(no load can driver)
  3. Load can driver after booting completed.
  4. When xavier receive first packet, can0 state changed from ERROR-ACTIVE to ERROR-PASSIVE.
  5. Reload can driver
  6. The can0 state is ERROR-ACTIVE and remain it when receive first packet after reloading driver.
  7. Restarting my application or reloading the driver works fine.
  8. However, rebooting the xavier board is the same as in #4.(power down)

Analyzing the above phenomenon, power is applied for the first time and the first packet reception becomes a problem. So the initial driver status is questionable.

Could you refer to the following thread to apply that patch to check if it could help for your case?
MTTCAN on Orin NX issues - #22 by KevinFFF

Doesn’t help in my case.

After applying that patch, you may just need to re-configure the can0 interface instead of re-load the kernel module.

Have you tried to start transmit can data from STM after the can setup finished on the Xavier board?
Entering ERROR-PASSIVE state may be caused from un-matched bitrate or configuration for both sides.

It helped a lot, but didn’t solve the problem. thank you

I found you setup both can0 and can1 with sjw 10.
The valid value seems to be 1-4. Could you help to try setup with other values or just remove them?

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