CAN permanent on

Topics about the Hardware of Revolution Pi
Post Reply
BenjaminKlostermann
Posts: 2
Joined: 30 Jun 2025, 16:48

CAN permanent on

Post by BenjaminKlostermann »

I use the internal CAN from the revpi 5s and I did set the vorrect configuration via the commands:

sudo ip link set can0 up type can bitrate 250000
and:
sudo ip link set dev can0 type can termination 120

communication is working and everything is fine but after restarting the revpi everything is reset, how should I set these parameters permanently?
User avatar
nicolaiB
KUNBUS
Posts: 1023
Joined: 21 Jun 2018, 10:33
Location: Berlin
Contact:

Re: CAN permanent on

Post by nicolaiB »

Hi,

you can configure the CAN interface for example with an entry in /etc/network/interfaces.

Example:

Code: Select all

auto can0
iface can0 inet manual
    pre-up /sbin/ip link set can0 type can bitrate 250000 termination 120
    up /sbin/ip link set can0 up
    down /sbin/ip link set can0 down
BenjaminKlostermann
Posts: 2
Joined: 30 Jun 2025, 16:48

Re: CAN permanent on

Post by BenjaminKlostermann »

Thanks for responding, yeah that is what I also thought, but because we have to modifiy the rate and termination dynamically we choose a different way because for the described way we would need sudo for any changes on the bitrate/termination.
We made some entries in the sudoers file so we can run these specific commands without sudo - so now we can activate different bitrates and terminations by a non privileged python script with subprocess.run ;)
Post Reply