CAN problem on custom TX2-4GB board

Hi,

On my custom tx2-4gb board, I used the command to enable can0 & can1 like tx2:
#! /bin/bash

sudo modprobe can
sudo modprobe can-raw
sudo modprobe mttcan

sudo ip link set can0 type can bitrate 500000 #loopback on
sudo ip link set up can0
sudo ip link set can1 type can bitrate 500000 #loopback on
sudo ip link set up can1
But as the result:
Cannot find device "can0"
Cannot find device "can0"
Cannot find device "can1"
Cannot find device "can1"

Does the can ports of tx2-4gb need to be enabled like Xavier https://devtalk.nvidia.com/default/topic/1042493/jetson-agx-xavier/enable-can-on-xavier?

Any ideas?Thanks in advance!

Hi,

Can you increase kernel loglevel and then try above commands? I need outputs when you use modprobe.
$dmesg -n 7 # To increase loglevel
You do not need to enable it like Xavier but still please provide values in registers:
0x0c303008
0x0c303010
0x0c303018
0x0c303020

Also please give the output of following node:
cat /proc/device-tree/mttcan@c310000/status
cat /proc/device-tree/mttcan@c320000/status

Thanks,
Shubhi

Hi, Shubhi

Thank you!

I've found my mistake that caused the problem of can_ports: I had just changed "CONFIG_CAN=m" to "CONFIG_CAN=m", then I thought the can driver would be static installed. However, It didn't work even if I used mobprobe again.
When I returned to the configuration before modification, the can_prots could be set up by mobprobe.

Hi,

Good to hear that problem is solved.

Regards,
Shubhi

My Xavier board is not recognizing the CAN1 port. (CAN0 works fine).

I am getting the following outputs to the command:

sudo ip link set up can1
Cannot find device “can1”

Following the suggestion above, I get:

cat /proc/device-tree/mttcan@c310000/status

okay
cat /proc/device-tree/mttcan@c320000/status
disabled

Do you have any suggestions of how to enable CAN1, please?

Hi camasmie,
You need to update status in mttcan@c320000 node of kernel device-tree present in BSP.
Use dtc command to modify and compile device tree.
Flash device with updated dtb.
Let me know if you face any issues.

Thanks,
Shubhi

Hi Shubhi, Thanks for the initial information.

Would you please, give me some more details, as follows:

  • where is the device-tree file located?
  • what is the proper way to recompile it with dtc?
  • what is the right procedure to flash the device?

By the way, I am using an Xavier board.

Thank you!

Hi poincare23,

Please refer to https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fintroduction.html%23

Ok, thanks