how can I use CAN bus in TX2?

If you are tapping into an existing CAN buss, then yes, you only need one CAN transciever.
I don’t understand what you mean by a “register.” Do you mean the termination resistor?
If you’re tapping into the middle of the buss, then you may not need termination resistors. (But you may need device resistors for fault tolerant configuration.)
If you tap into the end of the bus, and the cable isn’t already terminated, then you may need termination resistors.

I read through the link once more and now i got I don’t need the registers because I am going to tap into the existing CAN bus.
And SN65HVD257 this chip is really hard to find and it is really easy to find the SN65HVD230 which seems like a older version of the SN65HVD257. Is it okay to use SN65HVD230 with the 500k rate?
And do I need to install any driver to use in TX2?

Hi gyuhyong,

The SN65HVD257 is available on TI’s online store (, but there are probably other parts you can use successfully. I unfortunately won’t be able to make any recommendations for other parts.

You won’t need any Linux driver for the transceiver.


Chris Richardson

Thank you so much for you help

Thank you for your information, I finally test the 2 can bus rightly.

After compile the kernel with the CONFIG_MTTCAN = y, and replace the new dtb and image.

I used 2 LTM2889 IOS CAN transceivers from Linear, and just connect RX TX VCC GND the 4 pins.
and I connect CANH CANL together of the 2 transceivers and a 120Ω resistance.

Then install the can-utils tools.

To test the can bus:
In one terminel, I run:
sudo ip link set can0 type can bitrate 500000
sudo ip link set up can0
candump can0

In second terminel, I run:
sudo ip link set can1 type can bitrate 500000
sudo ip link set up can1
cansend can1 1F334455#1122334455667788

and can0’s terminel will receive the message from can1.

in /kernel/kernel4.4/arch/arm64/configs/tegra18_defconfig
, After compile the kernel with the mttcan = y, and replace the new dtb and image. but in TX2 ,‘ifconfig -a’ i cannot see can0 and can1.
when i make modules , i dou’t find any information about can, in TX2 , i cannot find can0 and can1 in /dev path. but in /sys/bus/platform/devices, i find mttcan. please who tell me some information in detail.

I’m running a kernel with CONFIG_MTTCAN enabled and I can see can, can-dev, and can-raw modules.

[    0.000000] Linux version 4.4.15-arlobot-can-v0.1 (root@tegra-ubuntu) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) ) #1 SMP PREEMPT Wed May 17 22:58:53 UTC 2017
[    3.387178] FAN: can't find tach_gpio
[    3.539760] usb usb1: Manufacturer: Linux 4.4.15-arlobot-can-v0.1 xhci-hcd
[    3.557318] usb usb2: Manufacturer: Linux 4.4.15-arlobot-can-v0.1 xhci-hcd
[   13.207450] tegra_net_perf_init: cannot get wifi sclk
[   13.299127] net can0: mttcan device registered (regs=ffffff8006f7e000, irq=418)
[   13.301011] net can1: mttcan device registered (regs=ffffff8007fbe000, irq=419)
[ 2135.132869] can: controller area network core (rev 20120528 abi 9)
[ 2135.148792] can: raw protocol (rev 20120528)
[ 2184.831217] mttcan c310000.mttcan can0: Bitrate set
[ 2184.836334] mttcan_controller_config: ctrlmode 1
[ 2184.841103] mttcan c310000.mttcan can0: Bitrate set
[ 2184.846234] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

I can see can devices using ifconfig:

nvidia@tegra-ubuntu:~$ ifconfig can
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:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:24 (24.0 B)  TX bytes:24 (24.0 B)

These are the current settings of can0:

nvidia@tegra-ubuntu:~$ ip -s -d link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can <LOOPBACK> state ERROR-WARNING (berr-counter tx 0 rx 0) restart-ms 0 
	  bitrate 125000 sample-point 0.875 
	  tq 50 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   
    24         6        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    24         6        0       0       0       0

The packet shown are from cansend.

I have a waveshare transceiver attached to can0 and connected to a known working CAN bus. However, I see only errors on the TX2 CAN side and candump does not display any packets

I’m not doing any explicit timing setting, e.g. tseg, brp. Do I need to set these or are they auto-detected?

一、Add this config
I enable the below config to get drive enabled:
In this file (sources/kernel/kernel4.4/arch/arm64/configs/tegra18_defconfig
) and
) .
二、rebuilding kernel

export CROSS_COMPILE=/opt/crosstool/gcc-4.8.5-aarch64/install/bin/aarch64-unknown-linux-gnu-
export CROSS32CC=/opt/srosstool/armhf/install/bin/arm-unknown-linux-gnueabi-gcc
export ARCH=arm64

export TEGRA_KERNEL_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/images
export TEGRA_MODULES_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/modules

make -C kernel/kernel-4.4/ mrproper

make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT tegra18_defconfig
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT menuconfig

make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT dtbs
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

######apply the below file replace origin file#########

sudo cp images/arch/arm64/boot/Image /home/…/Linux_for_tegra_tx2/rootfs/boot/
sudo cp images/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb /home/…/Linux_for_tegra_tx2/rootfs/boot/
sudo cp lib/* /home/…/Linux_for_tegra_tx2/rootfs/lib/

三、flash filesystem

cd …/64_TX2/Linux_for_Tegra_64_tx2/
sudo ./ jetson-tx2 mmcblk0p1

why i don’t see can0 and can1 by runing “ifconfig -a”
please can you tell where is wrong???


Once you have the board running, the following commands will bring up the cam0 interface, with support for the raw CAN. You may need additional modules depending on what you are trying to do.

sudo modprobe can
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 1000000
sudo ip link set up can0



Hi ??
As I know you should copy the new image/dtb to …/Linux_for_tegra_tx2/kernel/ instead of …/Linux_for_tegra_tx2/rootfs/boot/.

to tegra18_defconfig

thankyou everyone’suggest. i operate your suggest.
in the terminal , i execute the command 'dmesg
', report an error
“[ 99.095649] can :version magic '4.4.15-tegra SMP preempt mod_unload aarch64’should be ‘4.4.15 SMP preempt mod_unload aarch64’”
should i resolve this question??
and i execute the command ‘ifconfig -a’
, i cannot see any information about ‘can’.
in addition , i execute the command
sudo modprobe can
, prompt error
modprobe:ERROR:could not insert ‘can’:Exec format error

and the command
‘sudo modprobe mttcan’
prompt error
modprobe: FATAL:module mttcan not found in directory /lib/modules/4.4.15

should i resolve this question??

thankyou ZP ! it’s useful!

It looks like your kernel and your module were configured with slightly different kernel versions.
They need to match for the kernel to be happy.

Yes,need to modify the Makefile, add

then the kernel verson will be same as the NV’s.

Could some one write up a slightly more detailed version of how to rebuild the kernel with can enabled?

I tried many times, in the end I was never successful. I tried with, with no success. Also my tegra18_defconfig doesn’t contain the CONFIG_MTTCAN flag, while there are CONFIG_CAN, CONFIG_SLCAN flags. I tried adding the MTTCAN flag with no success.

Thanks for the help!

These are the steps can be followed to enable and check CAN on TX2.

  1. Enable kernel support for mttcan(Other required modules are already supported)
    CONFIG_MTTCAN = m (Here mttcan is compiled as a module)

  2. Insert CAN BUS subsystem support module.
    modprobe can

  3. Insert Raw CAN protocol module (CAN-ID filtering)
    modprobe can_raw

  4. Real CAN interface support (for our case, it is: mttcan)
    modprobe mttcan (dependent module is can_dev: can driver with netlink support)

  5. CAN interface settings for both the controllers
    ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
    ip link set up can0
    ip link set can1 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
    ip link set up can1

    CAN interfaces are up now. Use ifconfig to list all the interfaces which are up.

  6. Installation of user app to check CAN communication
    sudo apt-get install can-utils

  7. Commands to run to check CAN packet send/receive
    broadcasting a can data packet:
    cansend <can_interface> <can_frame>
    e.g. cansend can0 123#abcdabcd

    Receiving a can data packet:
    candump can_interface
    e.g. candump can1

    Different tools (i.e. cangen, cangw etc) can be used for various filtering options.

  8. To check the interface statistics
    ip -details -statistics link show can0
    ip -details -statistics link show can1

Thanks & Regards,

Hi Spatra,

Thank you so much for the nice instructions. I followed it step by step, however I can not get your CAN test result. May i ask few questions?

  • Did you connect any CAN transceivers in your test setup? Is SN65HVD230 a working choice?
  • When I setup both CANs as you did, both CANs go to ERROR-WARNING state. After I send a message from can0, can0 goes to BUS-OFF state and can1 goes to ERROR-PASSIVE state. Do you know what is wrong?

I look forward to hearing from you soon. Thanks in advance.


Does anyone tried CAN transceiver SN65HVD230 with TX2 and succeed with speed 500kbps?

Thanks a lot,

Hi Abby,

Thank you for the question.

Please note that, CAN node consists of a CAN controller and a CAN transceiver.
Hence, you’ll need to have a CAN transceiver with TX2 to make the setup behave as a proper CAN node/network.
Without the Transceiver, only BUS functionality can be used but not as CAN network communication.

Regarding Transceiver: Yes, SN65HVD230 is a good option to choose as a CAN transceiver with TX2. Its verified.

Also do note that for easy setup and testing basic feature you can use cansend and candump utilities.
Cangen can also be used for more detailed usage like packet filtering and CAN packet generation etc.
These commands can be found under can-utils package.

To your Second comment:
Yes, we are using 500 kbps speed and it works fine.
If are you getting any error at this speed, please share the error logs.

Hope this helps!

Thanks & Regards,