TX2 controller area network (CAN bus) configuration

  • 1 BSP environment:
    TX2 jetpack 4.6 L4T R32.6.1 kernel 4.9 aarch64
    TX2 (p3310)
  • 2 Problem:
    according to this topic, can module can be insmoded. how to change menuconfig items to build can into kernel. it seems that there are many coupling itmes, which ones should be changed?

hello Henry.Lou,

please access Jetson Linux | NVIDIA Developer and download [L4T Driver Package (BSP) Sources].
you should modify tegra_defconfig to change the CONFIG_MTTCAN, and rebuild the kernel image.
thanks

Hi @JerryChang
there are two can modules(can0 can1) on TX2. We used usb-can tool to test can bus. now, can1 works well, but can0 does not work.

3: 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 500000 sample-point 0.875 
	  tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 sjw 1
	  mttcan: tseg1 2..255 tseg2 0..127 sjw 1..127 brp 1..511 brp-inc 1
	  dbitrate 500000 dsample-point 0.875 
	  dtq 125 dprop-seg 6 dphase-seg1 7 dphase-seg2 2 dsjw 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          62481      0          1          1          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
    RX: bytes  packets  errors  dropped overrun mcast   
    499864     62483    62481   0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0 

and the console get the error message:

[261281.003398] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.009428] mttcan_poll_ir: 9 callbacks suppressed
[261281.014430] mttcan c310000.mttcan can0: IR 0x8010000 PSR 0x76d
[261281.028790] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.034565] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.040896] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.046711] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.052783] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.058485] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.064451] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.070126] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.076087] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.081766] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.087711] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.093380] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.099433] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.105275] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.111420] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.117224] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.123185] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.128857] mttcan c310000.mttcan can0: IR 0x8000000 PSR 0x775
[261281.134796] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.140480] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.146286] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.152386] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.158287] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.164157] mttcan c310000.mttcan can0: Bit0 Error Detected
[261281.169891] mttcan c310000.mttcan can0: Bit0 Error Detected

hello Henry.Lou,

please review your CAN network setup, and please narrow down this to confirm it’s not hardware related.
thanks

Hi @JerryChang
We are so confused that, can0 and can1 network setup together, and hardwares layout are also the same.

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

Hi @JerryChang
Yes, we test the hardware by oscilloscope, and it turns out hardware does not work. We change to a new board and can0 works now.
But, the questions are how to config can0 and can1 when device bring up. Is there any systemd scripts to modify?

hello Henry.Lou,

please check /etc/systemd/system/*.service, there shows all the services that’ll execute after system boot-up.
please have a try to modify the script file, /etc/systemd/nv.sh to include your init commands.
thanks

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