TX2 CAN Error - Entered bus off state

I am having trouble getting CAN to work on TX2 - jetpack 3.1. I get the same error whether a transceiver is connected or not. Have tried it on two different TX2’s. Feels like a stupid/simple mistake… but I just can’t see it…

Here is the code I am running and the errors I am getting:

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan 
sudo ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
sudo ip link set up can0

//CHECK INTERFACE BEFORE SENDING. ALL GOOD.
ifconfig

can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          UP <b>RUNNING</b> NOARP  MTU:72  Metric:1
          RX packets:0 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:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:171

//SEND FRAME (Nothing is received in candump).
cansend can0 123#R

//CHECK INTERFACE AGAIN - IT STOPPED RUNNING
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:72  Metric:1
          RX packets:5 errors:2 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:40 (40.0 B)  TX bytes:0 (0.0 B)
          Interrupt:171

dmesg

[  809.714212] can: controller area network core (rev 20120528 abi 9)
[  809.720519] NET: Registered protocol family 29
[  812.756051] can: raw protocol (rev 20120528)
[  817.946244] CAN device driver interface
[  817.966537] 	 Message RAM Configuration
               	| base addr   |0x0c312000|
               	| sidfc_flssa |0x00000000|
               	| xidfc_flesa |0x00000040|
               	| rxf0c_f0sa  |0x000000c0|
               	| rxf1c_f1sa  |0x00000300|
               	| rxbc_rbsa   |0x00000540|
               	| txefc_efsa  |0x00000780|
               	| txbc_tbsa   |0x00000800|
               	| tmc_tmsa    |0x00000c80|
[  818.004910] Release 3.2.0 from 19.12.2014
[  818.009401] net can0: mttcan device registered (regs=ffffff8000016000, irq=427)
[  818.019587] 	 Message RAM Configuration
               	| base addr   |0x0c322000|
               	| sidfc_flssa |0x00000000|
               	| xidfc_flesa |0x00000040|
               	| rxf0c_f0sa  |0x000000c0|
               	| rxf1c_f1sa  |0x00000300|
               	| rxbc_rbsa   |0x00000540|
               	| txefc_efsa  |0x00000780|
               	| txbc_tbsa   |0x00000800|
               	| tmc_tmsa    |0x00000c80|
[  818.057961] Release 3.2.0 from 19.12.2014
[  818.062292] net can1: mttcan device registered (regs=ffffff800001e000, irq=428)
[  834.783387] mttcan c310000.mttcan can0: Bitrate set
[  846.624545] mttcan_controller_config: ctrlmode 30
[  846.629319] mttcan c310000.mttcan can0: Bitrate set
[  875.326392] mttcan c310000.mttcan can0: Bit0 Error Detected
[  875.331985] mttcan c310000.mttcan can0: IR 0x8010000 PSR 0x71d
[  875.337861] mttcan c310000.mttcan can0: entered error warning state
[  875.344144] mttcan c310000.mttcan can0: entered error passive state
[  875.350430] mttcan c310000.mttcan can0: entered bus off state
[  875.356188] mttcan c310000.mttcan can0: Bit0 Error Detected
[  875.361768] mttcan c310000.mttcan can0: IR 0xb800000 PSR 0x7e5

lsmod

Module                  Size  Used by
mttcan                 60222  0
can_dev                13063  1 mttcan
can_raw                 9004  2
can                    46836  1 can_raw
fuse                   89008  2
bcmdhd               7625819  0
pci_tegra              74691  0
bluedroid_pm           13564  0

Update: After various restarts and more attempts it now seems to work fine.

Hi. I have the same questions . How do you solve it ?
My kernel if the newest . 4.4.48.
Once I send msgs it immediately go into BUS-OFF state.
And also I have the issue that I repeat receive the first can packet when I run candump .no matter that whether I have send it? Why?

Hi

  1. Make sure you have a Canbus device on the bus that will actually ACK the messages that are posted on the BUS. The send queue will fill up and you will not be able to send messages if they are not acked.
  2. Also make sure you’re using the correct bitrate (that your devices are using). An incorrect setting here will cause the bus to go down.
  3. Use a good CAN transceiver. We have had various instability problems with SN65HVD230. I reccomend TJA1051 instead: https://www.ebay.com/itm/CJMCU-1051-TJA1051-High-speed-Low-Power-CAN-Transceiver-For-Arduino/401407223937
  4. Setting the restart-ms parameter when you set up the can interface will also making it more robust and let it overcome disconnects etc. But this might also lead to the entire Jetson TX2 freezing up totally if packages are not ack’ed.
  5. Lastly - if you have reached BUS-OFF state - restart your Jetson to wake it up again :)

Great! Thanks for sharing!

Hi,njal.I am also working on tx2 can communication.And maybe I have meet the same problem with you.I could receive can message from another device which is named kvaser,but I can’t send a message from tx2 nor did tx2 receive the message from another can channel.Could you post the code you used to test tx2 can communication here.I test can bus with official method,but did not work.

Hi,

I seem to be having the same problem as njal did and was wondering if you discovered a more tangible solution.

Thanks