0

I am trying to get SocketCAN interface working. I've added the slcan0 adapter and trying to run candump slcan0 at a bit rate I am sure the CAN devices is running at. I dont see any data being printed in the terminal while I am sure CAN device is sending data at 200Hz.

I am using Lawicel CANUSB device and following these steps: http://pascal-walter.blogspot.com/2015/08/installing-lawicel-canusb-on-linux.html

When i am printing system log after binding the interface, I get following information:

May 26 10:11:33 username gnome-software[3664]: Failed to load snap icon: local snap has no icon
May 26 10:11:34 username gnome-software[3664]: message repeated 4 times: [ Failed to load snap icon: local snap has no icon]
May 26 10:15:43 username systemd[1]: Started Session 3 of user aceinna.
May 26 10:15:57 username slcand[3923]: starting on TTY device /dev/ttyUSB0
May 26 10:15:57 username slcand[3923]: attached TTY /dev/ttyUSB0 to netdevice slcan0
May 26 10:15:57 username slcand[3923]: netdevice O#015 renamed to slcan0
May 26 10:15:57 username NetworkManager[1543]: <info>  [1590513357.4839] manager: (slcan0): new Generic device (/org/freedesktop/NetworkManager/Devices/4)
May 26 10:15:57 username systemd-udevd[3925]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
May 26 10:15:57 username NetworkManager[1543]: <info>  [1590513357.4957] devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
May 26 10:15:57 username NetworkManager[1543]: <info>  [1590513357.4958] device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.
May 26 10:16:23 username wpa_supplicant[1539]: wlp59s0: WPA: Group rekeying completed with bc:ee:7b:57:ed:fc [GTK=CCMP]
May 26 10:16:23 username wpa_supplicant[1539]: wlp59s0: WPA: Group rekeying completed with bc:ee:7b:57:ed:fc [GTK=CCMP]
May 26 10:17:01 username CRON[3944]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

The problem is, "no ifupdown configuration found"

How do I configure ifupdown configuration for CAN interface?

One of the thing i tried was adding following lines to /etc/network/interfaces

auto can0
iface can0 inet manual
        #pre-up ip link set $IFACE type can bitrate 125000 listen-only off
        pre-up /sbin/ip link set $IFACE type can bitrate 250000 triple-sampling on
        up /sbin/ifconfig $IFACE up
        down /sbin/ifconfig $IFACE down

Note: I tried using can0 as adapter name when binding the interface to match with interface name in /etc/network/interfaces.

I also updated ifupdown package using

apt-get ifupdown

Can some one point out to right direction, what should I be looking at?

Thanks in advance.

Rishit
  • 1

1 Answers1

0

I was originally trying to connect my CAN Transceiver to Linux and print CAN packets using candump.

I ran into this error message when after i did bind my CAN interface to slcan using sudo slcand -o -c -f -sX /dev/ttyUSBX slcan0

This error was in syslog file, use following command sudo tail -n 10 -f /var/log/syslog

As it turns out, when i set the SocketCAN interface to UP in the next step this issue is resolved sudo ip link set up slcan0

I thought No ifupdown config found error wasn't letting candump print CAN messages. I was wrong. The problem was CAN termination resistor. My CAN netowrk dint have termination resistors. As soon as I enable the Termination resisrot in my CAN device I was able to see data using candump

Documenting this here in case someone in future stumble upon this problem.

Rishit
  • 1