Can enabled at startup

hello everyone,

Any idea if can enable Can on my AGX-orin 64Gb at startup?

My jetson will embed and used for streaming video and CanBus control.

The Can work great but I need to activate it every time,and once in production, the jetson could not be accessed by any person (no KB, no mouse, no screen).

I have try to create a script like below and put it in startup application but modprobe mttcan need to be sudo.

#!/bin/bash

#Kernel Can
modprobe can
modprobe can_raw
modprobe mttcan

#Set Can up
ip link set can0 up type can bitrate 250000 dbitrate 1000000 berr-reporting on fd on

#Enable position control CAN command to motor
cansend can0 06000001#230D200100000000

#Run python TCP socket for position order from C# PC client
python3 Desktop/test-can.py

I have found this : How to enable automatically can bus on startup - #3 by JerryChang

But not really helping.

I have try crontab, my script in init.d but without any success. (Ubuntu beginner)

Thanks in advance.

Hi Ludo64,

Please add your desired kernel modules in /etc/modules-load.d/modules.conf .
and also remove /etc/modprobe.d/denylist-mttcan.conf from your board.

Thanks for your answer, this work well. Can is enabled on startup, sorry to bother you more, can you help me with this command:

Need to be sudo too, on startup my Can is enable but down.

Thank’s in advance.

I have solve my problem with :

sudo visudo

AND

$USER ALL=(ALL) NOPASSWD: ALL

Lot of Linux users got a heart attack seeing this, but this is perfect for my case.

@KevinFFF Thank a lot for your help. and wish you a wonderful day.

1 Like

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