Oops when writing mttcan0

[ 1437.665386] mttcan c310000.mttcan can0: entered error passive state
[ 1437.694595] mttcan c310000.mttcan can0: entered error passive state
[ 1437.701277] mttcan c310000.mttcan can0: mttcan_poll_ir: some msgs lost on in Q0
[ 1437.825568] mttcan c310000.mttcan can0: bus-off
[ 1437.830346] mttcan c310000.mttcan can0: entered bus off state
[ 1437.927437] mttcan c310000.mttcan can0: restarted
[ 1437.932714] mttcan c320000.mttcan can1: mttcan_poll_ir: some msgs lost on in Q0
[ 1437.941706] mttcan_controller_config: ctrlmode 0
[ 1437.948384] mttcan c310000.mttcan can0: Bitrate set
[ 1437.953834] mttcan c310000.mttcan can0: bus-off
[ 1437.958716] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 1437.982570] mttcan c310000.mttcan can0: No Tx space left
[ 1437.990457] mttcan c310000.mttcan can0: No Tx space left
[ 1437.998511] mttcan c310000.mttcan can0: No Tx space left
[ 1438.006732] mttcan c310000.mttcan can0: No Tx space left
[ 1438.014495] mttcan c310000.mttcan can0: No Tx space left
[ 1438.022478] mttcan c310000.mttcan can0: No Tx space left
[ 1438.031324] mttcan c310000.mttcan can0: No Tx space left
[ 1438.039142] mttcan c310000.mttcan can0: No Tx space left
[ 1438.059567] ------------[ cut here ]------------
[ 1438.064294] Kernel BUG at ffffffc0005f2d54 [verbose debug info unavailable]
[ 1438.071349] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[ 1438.076912] Modules linked in: fuse bcmdhd pci_tegra bluedroid_pm
[ 1438.083427] CPU: 0 PID: 520 Comm: kworker/0:2 Not tainted 4.4.38 #10
[ 1438.089834] Hardware name: quill (DT)
[ 1438.093693] Workqueue: events can_restart_work
[ 1438.098236] task: ffffffc1e4ff6400 ti: ffffffc1e096c000 task.ti: ffffffc1e096c000
[ 1438.105778] PC is at can_restart+0xd4/0xd8
[ 1438.109934] LR is at can_restart_work+0x10/0x18
[ 1438.114511] pc : [] lr : [] pstate: 60000045
[ 1438.121952] sp : ffffffc1e096fd30
[ 1438.125308] x29: ffffffc1e096fd30 x28: 0000000000000000
[ 1438.130763] x27: 0000000000000000 x26: ffffffc00136da70
[ 1438.136217] x25: 0000000000000000 x24: 0000000000000000
[ 1438.141673] x23: ffffffc1f5cfe400 x22: ffffffc1e2ce4b30
[ 1438.147122] x21: ffffffc1f5cf8c00 x20: ffffffc1ec32f888
[ 1438.152574] x19: ffffffc1ec32f000 x18: 0000000000000a03
[ 1438.158021] x17: ffffffc000b1fa60 x16: ffffffc000b1fa60
[ 1438.163474] x15: ffffffc000b1fa60 x14: ffffffc000b1fa60
[ 1438.168924] x13: 0000000000000001 x12: 0000000000000000
[ 1438.174377] x11: 00000000000b21c5 x10: 00000000000008a0
[ 1438.179822] x9 : ffffffc1e096fd20 x8 : ffffffc1e4ff6d00
[ 1438.185268] x7 : 0000000000000000 x6 : ffffffc1e2c8a210
[ 1438.190720] x5 : 0000000000000000 x4 : ffffffc1f5cf9000
[ 1438.196169] x3 : ffffffc1f5cf8c00 x2 : ffffffc1f5cfe405
[ 1438.201612] x1 : 0000000000000003 x0 : ffffffc1ec32f000
[ 1438.207058]
[ 1438.208599] Process kworker/0:2 (pid: 520, stack limit = 0xffffffc1e096c020)
[ 1438.215701] Call trace:
[ 1438.218200] [] can_restart+0xd4/0xd8
[ 1438.223392] [] can_restart_work+0x10/0x18
[ 1438.229095] [] process_one_work+0x158/0x434
[ 1438.234902] [] worker_thread+0x134/0x40c
[ 1438.240462] [] kthread+0xe0/0xf4
[ 1438.245351] [] ret_from_fork+0x10/0x40
[ 1438.250720] —[ end trace 5680fce809ccd7c9 ]—
[ 1438.262342] Kernel panic - not syncing: Fatal exception
[ 1438.267666] CPU5: stopping
[ 1438.270504] CPU: 5 PID: 0 Comm: swapper/5 Tainted: G D 4.4.38 #10
[ 1438.277775] Hardware name: quill (DT)
[ 1438.281497] Call trace:
[ 1438.284056] [] dump_backtrace+0x0/0x100
[ 1438.289511] [] show_stack+0x14/0x1c
[ 1438.294667] [] dump_stack+0x98/0xbc
[ 1438.299794] [] handle_IPI+0x300/0x30c
[ 1438.305077] [] gic_handle_irq+0x9c/0xb4
[ 1438.310530] [] el1_irq+0x80/0xf8
[ 1438.315431] [] cpuidle_enter+0x18/0x20
[ 1438.320841] [] call_cpuidle+0x28/0x50
[ 1438.326114] [] cpu_startup_entry+0x178/0x33c
[ 1438.331995] [] secondary_start_kernel+0x12c/0x164
[ 1438.338321] [<000000008008192c>] 0x8008192c
[ 1438.342551] CPU3: stopping
[ 1438.345320] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G D 4.4.38 #10
[ 1438.352587] Hardware name: quill (DT)
[ 1438.356292] Call trace:
[ 1438.358799] [] dump_backtrace+0x0/0x100
[ 1438.364243] [] show_stack+0x14/0x1c
[ 1438.369339] [] dump_stack+0x98/0xbc
[ 1438.374434] [] handle_IPI+0x300/0x30c
[ 1438.379702] [] gic_handle_irq+0x9c/0xb4
[ 1438.385150] [] el1_irq+0x80/0xf8
[ 1438.389988] [] cpuidle_enter+0x18/0x20
[ 1438.395348] [] call_cpuidle+0x28/0x50
[ 1438.400621] [] cpu_startup_entry+0x178/0x33c
[ 1438.406503] [] secondary_start_kernel+0x12c/0x164
[ 1438.412814] [<000000008008192c>] 0x8008192c
[ 1438.417042] CPU4: stopping
[ 1438.419809] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G D 4.4.38 #10
[ 1438.427076] Hardware name: quill (DT)
[ 1438.430782] Call trace:
[ 1438.433289] [] dump_backtrace+0x0/0x100
[ 1438.438738] [] show_stack+0x14/0x1c
[ 1438.443834] [] dump_stack+0x98/0xbc
[ 1438.448930] [] handle_IPI+0x300/0x30c
[ 1438.454199] [] gic_handle_irq+0x9c/0xb4
[ 1438.459645] [] el1_irq+0x80/0xf8
[ 1438.464490] [] cpuidle_enter+0x18/0x20
[ 1438.469850] [] call_cpuidle+0x28/0x50
[ 1438.475123] [] cpu_startup_entry+0x178/0x33c
[ 1438.481003] [] secondary_start_kernel+0x12c/0x164
[ 1438.487317] [<000000008008192c>] 0x8008192c
[ 1438.512144] Rebooting in 5 seconds…

Hi It looks like a configuration conflict to can node.

Please make sure to follow the below steps while configuring the nodes.

Required modules
modprobe can
modprobe can_raw
modprobe mttcan (dependent module is can_dev: can driver with netlink support)

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

To check interface statistics
ip -details -statistics link show can0
ip -details -statistics link show can1

Hope this helps.

Thanks & Regards,
Sandipan

I have built CAN driver into kernel

My CAN setting is:

ip link set can0 type can restart-ms 10
ip link set can0 up type can bitrate 1000000
ip link set can1 type can restart-ms 10
ip link set can1 up type can bitrate 1000000

CAN device details and statistics:

root@tegra-ubuntu:~# ip -details -statistic link show can0
5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-PASSIVE (berr-counter tx 0 rx 127) restart-ms 10 
          bitrate 1000000 sample-point 0.750 
          tq 25 prop-seg 14 phase-seg1 15 phase-seg2 10 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
          1          0          0          20608      11749      0         
    RX: bytes  packets  errors  dropped overrun mcast   
    97060757   13154637 33766   0       33766   0       
    TX: bytes  packets  errors  dropped carrier collsns 
    72         9        0       19828760 0       0

If the communication is still not done, can you check with the transceiver interfacing side.

Sometime it happens with the problem associated with loose setup of CAN transceiver.

Thanks & Regards,
Sandipan