AGX Orin: CAN bus does not recover from BUS_OFF state

Hi @KevinFFF,

thanks for the quick reply! I indeed missed step 8, so now I can actually see the prints I added to the function. Unfortunately, after the down&up, the cangen can0 runs for a little while and then shows the “no buffer space available” error again.

Here’s the output when I’m following your steps:

$ sudo modprobe mttcan

$ sudo ip link set can0 up type can bitrate 100000 berr-reporting on restart-ms 1000
RTNETLINK answers: Device or resource busy
# don't know if above error is a problem?

$ cangen can0
# runs fine, now short CAN-H/CAN-L
write: No buffer space available
# ... stop shorting

$ sudo ip -d -s link show can0
12: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 minmtu 0 maxmtu 0
    can <BERR-REPORTING> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1000
          bitrate 500000 sample-point 0.870
          tq 20 prop-seg 43 phase-seg1 43 phase-seg2 13 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 50000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          2          6          0          2          2          2         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    RX: bytes  packets  errors  dropped overrun mcast
    4980525    689926   6       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    1129       198      0       0       0       0

$ cangen can0
write: No buffer space available

$ sudo ip link set can0 down
$ sudo ip link set can0 up type can bitrate 100000 berr-reporting on restart-ms 1000

$ cangen can0
# runs for a couple of seconds but then prints this again
write: No buffer space available

When looking at dmesg, you can see that the patch is there (I printed each line):

$ sudo dmesg
[ 3430.899903] mttcan c310000.mttcan can0: entered error warning state
[ 3430.906431] mttcan c310000.mttcan can0: entered error passive state
[ 3430.912903] mttcan c310000.mttcan can0: Bit0 Error Detected
[ 3430.918664] mttcan c310000.mttcan can0: IR 0x9800000 PSR 0x77d
[ 3430.924713] mttcan c310000.mttcan can0: entered bus off state
[ 3430.931473] mttcan c310000.mttcan can0: Bit0 Error Detected
[ 3430.937252] mttcan c310000.mttcan can0: IR 0xa000000 PSR 0x7e5
[ 3431.950397] mttcan_controller_config: ctrlmode 10
[ 3431.950423] mttcan c310000.mttcan can0: Bitrate set
[ 3431.950434] mttcan c310000.mttcan can0: wait for bus off seq
[ 3431.962506] mttcan c310000.mttcan can0: Bit0 Error Detected
[ 3431.968252] mttcan c310000.mttcan can0: IR 0xa000000 PSR 0x70d
[ 3431.974301] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 3432.101006] mttcan c310000.mttcan can0: entered error warning state
[ 3432.107504] mttcan c310000.mttcan can0: entered error passive state
[ 3432.113967] mttcan c310000.mttcan can0: Bit0 Error Detected
[ 3432.119722] mttcan c310000.mttcan can0: IR 0x9800000 PSR 0x76d
[ 3432.125776] mttcan c310000.mttcan can0: entered bus off state
[ 3432.132509] mttcan c310000.mttcan can0: Bit0 Error Detected
[ 3432.138261] mttcan c310000.mttcan can0: IR 0xa010000 PSR 0x7e5
[ 3433.134369] mttcan_controller_config: ctrlmode 10
[ 3433.134393] mttcan c310000.mttcan can0: Bitrate set
[ 3433.134405] mttcan c310000.mttcan can0: wait for bus off seq
[ 3433.146486] mttcan c310000.mttcan can0: Bit0 Error Detected
[ 3433.152251] mttcan c310000.mttcan can0: IR 0xa000000 PSR 0x70d
[ 3433.158320] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 3562.140557] mttcan c310000.mttcan can0: inside mttcan_close:  netif_stop_queue(dev);
[ 3562.140564] mttcan c310000.mttcan can0: inside mttcan_close: napi_disable(&priv->napi);
[ 3562.140567] mttcan c310000.mttcan can0: inside mttcan_close: mttcan_stop(priv);
[ 3562.140581] mttcan c310000.mttcan can0: inside mttcan_close: free_irq(dev->irq, dev);
[ 3562.140598] mttcan c310000.mttcan can0: inside mttcan_close: priv->ttcan->tx_object = 0;
[ 3562.140600] mttcan c310000.mttcan can0: inside mttcan_close: priv->hwts_rx_en = false;
[ 3576.107601] mttcan c310000.mttcan can0: Bitrate set
[ 3576.107672] mttcan_controller_config: ctrlmode 10
[ 3576.107685] mttcan c310000.mttcan can0: Bitrate set
[ 3576.107747] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

So not sure why it does not work for us…

Do you have AGX Orin devkit could apply the same patch and verify?

It seems you could send the packet after configuring can down and up.

Do you recover the CAN-H and CAN-L connection before run cangen at the last step? (i.e. do you follow Step 6 to recover CAN connection?)

Yes, we did use an AGX Orin devkit for the test.

It seems you could send the packet after configuring can down and up.

Do you recover the CAN-H and CAN-L connection before run cangen at the last step? (i.e. do you follow Step 6 to recover CAN connection?)

Yes, we did. Basically ran cangen can0, then shorted and waited until the error appeared. Then released the short and continued with the other steps.

Do you mean that you run Step 4 before Step 3?

Could you help to verify with the exact same steps as I shared?
We should get the same result and on the same stage…

Sorry for the late reply, I haven’t been able to work on this for a couple of days.

I think I tested multiple variations and it didn’t matter, it never recovered. I’ll be back in office next week though and will test it once again, making sure that I exactly follow your steps in the correct order. Will give you an update then!

We also encountered this problem, but we think it should be restored automatically,our version is R35.4.1

1 Like

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