Python and RPi n00b here. Trying to get CANopen working on my RPI, and think I'm 8/10s of the way to communicating.
Target device is an RPi 3+ with fairly pedestrian install of Raspbian Buster and 5.4.51-v7+ linux kernel, attached to Kvaser Leaf USB CANopen adapter. CANopen adapter hardware is known to be good, works well with Windows software.
Relevant info:
-Installed can-utils
-Installed python-can 4.0.0
-Appear to have installed Kvaser drivers successfully (finally got make to complete without errors)
-vcan appears to work fine - have successfully transmitted and received test packets with this handy virtual can adapter using can-utils
I can set up the can socket initially:
sudo modprobe can
but when I try to initialize actual hardware, it fails and gets the following error:
sudo ip link add dev can0 type can
RTNETLINK answers:Operation not supported
Obviously I'm missing something, but cannot figure out what. I notice that others have had similar issues (though different hardware). Please advise of solutions and TIA.
You'll need to uninstall CANlib and then reboot for socketcan to work.
Follow this procedure:
Download the linuxcan tarball again if you no longer have it: http://www.kvaser.com/downloads Extract linuxcan: tar -xf linuxcan.tar.gz Inside of the linuxcan directory, run make to build everything which is required before you can uninstall Now uninstall CANlib with sudo make uninstall You should see something like the following:
Now you can reboot and the ip link commands should work.