Opening Can ports on Jetson TX2 Startup

Hey all,

I’m getting started to using the Jetson TX2 as a platform to run an autonomous robot with communication through a CAN network. I found some resources that gave me commands to use to open can ports can0 and can1 through the command line. I would like to configure my Jetson so that it opens the can ports on startup. From what I understand this is done through the /etc/modules file.
I am sure this is the wrong way to go about it, but when I enter the same commands that I used to open the can ports through the command window:

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 500000
sudo ip link set up can0

it does not seem to be opening on start up.
If there is any advice for another place to put these commands so they run on startup or different commands to use I would be incredibly greatful.

Hello @skippy57344

Can you try these commands (without sudo) in /etc/systemd/

The can0 and can1 ports seem to be opening now!
When I use the:

ifconfig -a
command, I see can ports can0 and can1 show up which I think means that on startup they are now opening.

Is the problem solved?

yes, it appears so. I have yet to hook up any sensors to the CAN ports but it looks like the ports are opening on startup.