TX2 CAN TX/RX issues on L4T 28.1

I believe there is a kernel level issue with the TX2 CAN.

Already I have referenced:
https://devtalk.nvidia.com/default/topic/1025010/jetson-tx2/how-to-use-can-on-jetson-tx2-/post/5213792/#5213792
https://devtalk.nvidia.com/default/topic/1027411/jetson-tx2/tx2-can-error-entered-bus-off-state/
https://devtalk.nvidia.com/default/topic/1006762/jetson-tx2/how-can-i-use-can-bus-in-tx2-/3
https://devtalk.nvidia.com/default/topic/1018790/does-tx2-support-can-fd-/
https://devtalk.nvidia.com/default/topic/1014440/jetson-tx2/can-bus-stability-issues/

I have read the documentation
https://docs.nvidia.com/drive/nvvib_docs/index.html#page/NVIDIA%2520DRIVE%2520Linux%2520SDK%2520Development%2520Guide%2FAppendix%2FAppxTegraCAN.html%23

As suggested my pinout is:

Port : J26
Pin No Details
1 ===== CAN wake

3 ===== CAN0 STAND BY
5 ===== CAN0 RX
7 ===== CAN0 TX
9 ===== CAN0 ERR

The transceiver board is:

The bus is properly terminated and able to transmit/receive using different tools.

tx2 stats:

nvidia@dingo:~$ cat /etc/nv_tegra_release
# R28 (release), REVISION: 1.0, GCID: 9379712, BOARD: t186ref, EABI: aarch64, DATE: Thu Jul 20 07:59:31 UTC 2017

ubuntu:

nvidia@dingo:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

lsmod:

nvidia@dingo:~$ lsmod
Module                  Size  Used by
can_raw                 9004  0
can                    46836  1 can_raw
fuse                   89008  2
bcmdhd               7625819  0
mttcan                 60222  0
can_dev                13063  1 mttcan
pci_tegra              74691  0
bluedroid_pm           13564  0

I have checked for loose connections and probed all terminals.

I did not recompile the kernel.

Script to start and output:

#!/bin/bash                                                                                                                                                                         
                                                                                                                                                                                    
echo "starting can"                                                                                                                                                                 
                                                                                                                                                                                    
modprobe can                                                                                                                                                                        
modprobe can_raw                                                                                                                                                                    
modprobe can_dev                                                                                                                                                                    
modprobe mttcan                                                                                                                                                                     
ip link set can0 type can bitrate 250000                                                                                                                                            
ip link set up can0                                                                                                                                                                 
                                                                                                                                                                                    
echo "stats"                                                                                                                                                                        
ip -details -statistics link show can0                                                                                                                                              
                                                                                                                                                                                    
echo "dmesg"                                                                                                                                                                     
dmesg | tail
stats
5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
          bitrate 250000 sample-point 0.875 
          tq 25 prop-seg 69 phase-seg1 70 phase-seg2 20 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 40000000                                                                                                                                                            
          re-started bus-errors arbit-lost error-warn error-pass bus-off                                                                                                            
          0          0          0          0          0          0                                                                                                                  
    RX: bytes  packets  errors  dropped overrun mcast                                                                                                                               
    0          0        0       0       0       0                                                                                                                                   
    TX: bytes  packets  errors  dropped carrier collsns                                                                                                                             
    0          0        0       0       0       0                                                                                                                                   
dmesg                                                                                                                                                                            
[   26.422017] tegradc 15210000.nvdisplay: hdmi: pclk:241699K, set prod-setting:prod_c_300M                                                                                         
[   26.506617] tegra_nvdisp_program_final_bw_settings: LA/PTSA failed w/ bw=1060400 KB/s,freq=20400000 Hz                                                                           
[  135.785551] can: controller area network core (rev 20120528 abi 9)                                                                                                               
[  135.791980] NET: Registered protocol family 29                                                                                                                                   
[  135.808234] can: raw protocol (rev 20120528)                                                                                                                                     
[  135.832065] mttcan c310000.mttcan can0: Bitrate set                                                                                                                              
[  135.842289] mttcan_controller_config: ctrlmode 0                                                                                                                                 
[  135.847209] mttcan c310000.mttcan can0: Bitrate set                                                                                                                              
[  135.862490] mttcan c310000.mttcan can0: entered error warning state                                                                                                              
[  135.869203] mttcan c310000.mttcan can0: entered error passive state

Ifconfig output

nvidia@dingo:~$ ifconfig can0
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          UP RUNNING NOARP  MTU:16  Metric:1
          RX packets:17197 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:136681 (136.6 KB)  TX bytes:0 (0.0 B)
          Interrupt:171

dmesg after a minute or so:

nvidia@dingo:~$ dmesg | tail
[  295.186925] mttcan c310000.mttcan can0: entered error passive state
[  295.287161] mttcan c310000.mttcan can0: entered error passive state
[  295.387338] mttcan c310000.mttcan can0: entered error passive state
[  295.488585] mttcan c310000.mttcan can0: entered error passive state
[  295.587601] mttcan c310000.mttcan can0: entered error passive state
[  295.687745] mttcan c310000.mttcan can0: entered error passive state
[  295.788855] mttcan c310000.mttcan can0: entered error passive state
[  295.888982] mttcan c310000.mttcan can0: entered error passive state
[  295.989376] mttcan c310000.mttcan can0: entered error passive state
[  296.087502] mttcan c310000.mttcan can0: entered error passive state

candump off can0 (works but with drops):

nvidia@dingo:~$ candump can0
  can0  0CF00400   [8]  FC 7D 7D 00 00 00 F0 7D
  can0  0CF00400   [8]  FC 7D 7D 00 00 00 F0 7D
  can0  0CF00300   [8]  D1 02 00 FF FF FF FF FF
  can0  0CF00400   [8]  FC 7D 7D 00 00 00 F0 7D
  can0  18FEF100   [8]  F3 00 00 40 00 00 00 30
  can0  0CFF1500   [8]  C0 C3 01 01 0D 00 01 FF
...

ip-stats after a few minutes:

nvidia@dingo:~$ ip -details -statistics link show can0
5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 110) restart-ms 0 
          bitrate 250000 sample-point 0.875 
          tq 25 prop-seg 69 phase-seg1 70 phase-seg2 20 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 40000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          1          2652       0         
    RX: bytes  packets  errors  dropped overrun mcast   
    349513     43976    1       0       1       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0

Where things get interesting, sending can messages:

nvidia@dingo:~$ cangen can0
(blank)

stats:
dmesg
[ 1222.923488] mttcan c310000.mttcan can0: entered error passive state
[ 1223.023951] mttcan c310000.mttcan can0: entered error passive state
[ 1223.031481] mttcan c310000.mttcan can0: entered error passive state
[ 1223.123990] mttcan c310000.mttcan can0: entered error passive state
[ 1223.224602] mttcan c310000.mttcan can0: entered error passive state
[ 1223.325039] mttcan c310000.mttcan can0: entered error passive state
[ 1223.424895] mttcan c310000.mttcan can0: entered error passive state
[ 1223.525103] mttcan c310000.mttcan can0: entered error passive state
[ 1223.625465] mttcan c310000.mttcan can0: entered error passive state
[ 1223.656552] mttcan c310000.mttcan can0: entered bus off state
 stats
5: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state BUS-OFF (berr-counter tx 248 rx 127) restart-ms 0 
          bitrate 250000 sample-point 0.875 
          tq 25 prop-seg 69 phase-seg1 70 phase-seg2 20 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 40000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          1          11211      0         
    RX: bytes  packets  errors  dropped overrun mcast   
    1466471    184532   8       0       8       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
ifconfig
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          UP NOARP  MTU:16  Metric:1
          RX packets:184532 errors:8 dropped:0 overruns:0 frame:8
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:1466471 (1.4 MB)  TX bytes:0 (0.0 B)
          Interrupt:171

Bus goes off and a restart is needed. When the “restart-ms” option is used, the kernel crashes and a physical reboot is needed.

When probing the TX of the Jetson, it goes from fluttering around the 3.3V signal to a constant 3.3V. CAN traffic continues as normal on the rest of the system.

Nothing ACKs the Jetson (even when the bus is connected to only a single ID.

Is there any new updates to solving this issue?

+1 we’re also seeing this same issue. Looks like the forums have lots of others who have also seen it.

Nvidia - any help? Seems like CAN on the TX2 has some serious issues, will these be fixed any time soon?

We’re also about same issue.
Is there any update from NVIDIA?

Hi All,
I have seen the same issue on jetson-tx2, am looking at it. Will update the results and fixes for this soon.

Hi philrep,

Please share the dtb and pinmux you used to flash. It will be helpful for me to check your issue.

Thanks,
Shubhi

Hello,
we are having the same problem on the R28.2.1 but never receive valid data per candump but directly entering the error state. Using a MCP2515 works fine.

Tried with the following transceivers:

  • 74AVC4TD245BQ
  • TJA1050

dtb

mttcan@c310000 {
        status = "okay";
        gpio_can_stb = <&tegra_aon_gpio TEGRA_AON_GPIO(AA, 0) GPIO_ACTIVE_HIGH>;
        gpio_can_en = <&tegra_aon_gpio TEGRA_AON_GPIO(AA, 1) GPIO_ACTIVE_HIGH>;
        mram-params = <0 16 16 8 8 8 16 16 16>;
        tx-config = <8 8 0 64>;
        rx-config = <64 64 64>;
    };

ip link set can0 up type can bitrate 250000 berr-reporting on

MTTCAN receiving frame fails (measured bit timing: 20.8kHz)

~# ip -statistics -details link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-PASSIVE (berr-counter tx 0 rx 127) restart-ms 100 
          bitrate 250000 sample-point 0.875 
          tq 25 prop-seg 69 phase-seg1 70 phase-seg2 20 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 40000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          1          1          0         numtxqueues 1 numrxqueues 1 
    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

MCP2515 receiving frame ok (measured bit timing: 250kHz)

~# ip -statistics -details link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE restart-ms 100 
          bitrate 250000 sample-point 0.850 
          tq 200 prop-seg 8 phase-seg1 8 phase-seg2 3 sjw 1
          mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
          clock 10000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          0          0          0         numtxqueues 1 numrxqueues 1 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    1          1        0       0       0       0

Hi Dwarf,
Can ypu please check your connections between TJA1050 and J26 on jetson-tx2. It seems like problem with transceiver. I tried the same, it is working for me. Please check and let me know.

Thanks & Regards,
Shubhi

Bus goes off and a restart is needed. When the “restart-ms” option is used, the kernel crashes and a physical reboot is needed.

When probing the TX of the Jetson, it goes from fluttering around the 3.3V signal to a constant 3.3V. CAN traffic continues as normal on the rest of the system.

Nothing ACKs the Jetson (even when the bus is connected to only a single ID.

Is there any new updates to solving this issue?
Is this problem update?
What is the updated version?

Hi,

Can you please check on R32.2 version? CAN communication works fine for me with TJA1050 transceiver. If you still face the issue, then please shares your steps you have used, it will help me to reproduce the issue further.
Also, I would like to know what all configurations you had to do to successfully receive frame using MCP2515.
Did you connect MCP with tegra? If yes, can you please share your steps.

Thanks & Regards,
Shubhi Garg