Page 1 of 1

Ubuntu 14.04 PCAN Problems

Posted: Wed 14. Jan 2015, 11:40
by tesche
Hi,

I have a (X)Ubuntu 14.04 system that uses a manually installed PCAN driver in CHARDEV mode. Each kernel update forces me to recompile the driver so that the new kernel recognizes its version number and loads the module, which is a bit annoying. I'm therefore thinking about converting the software to SocketCAN usage and use the NETDEV driver that comes with Ubuntu.

I've "make uninstall"ed the old driver and now the driver that comes with Ubuntu is loaded on system boot and I see there is an (inactive) can0 interface. Now I have some questions:

1) I do not see a /proc/pcan device can therefore not see information about the driver. I did get a /proc/pcan decice once when I manually installed a driver, but there does not appear to be one when using the driver that comes with Ubuntu. Is that normal? Some kind of configuration issue in the kernel used by Ubuntu perhaps? Or is it a sign of some other problem?

2) I can change the baudrate with "ip link set can0 type can bitrate 250000", however, I'd prefer to do that from inside my program. I've seen there are code samples on the web that suggest

ifr.ifr_ifru.ifru_ivalue = 1000000;
ret = ioctl(s, SIOCSCANBAUDRATE, &ifr);

but my Ubuntu does not appear to have SIOCSCANBAUDRATE (I've "grep"ed the headers). At the same time I cannot use any tricks using the /dev/pcan device becauses they do not exist in Ubuntu's NETDEV driver. So how can I change the baudrate without invoking the "ip" command?

cheers,
Torsten

Re: Ubuntu 14.04 PCAN Problems

Posted: Wed 14. Jan 2015, 15:31
by M.Maidhof
Hi,

here are the answers to your questions:

1. it is normal, cat /proc/pcan is only provided by the peak-linux-driver. See ifconfig canx for details about your netdev interface.

2. please contact the SocketCAN user group for help. AFAIK the configuration change is only possible with those ip link commands. Only with the peak-linux-driver SocketCAN driver, the corresponding chardev interface could be used to change the baudrate with a echo command.

regards

Michael

Re: Ubuntu 14.04 PCAN Problems

Posted: Wed 14. Jan 2015, 20:08
by O.Hartkopp
M.Maidhof wrote: 2. please contact the SocketCAN user group for help. AFAIK the configuration change is only possible with those ip link commands.
That's correct.

If you want to control these settings form an application you can use the libsocketcan from Pengutronix.
See discussion at http://marc.info/?l=linux-can&m=140494956215084&w=2

Regards,
Oliver

Re: Ubuntu 14.04 PCAN Problems

Posted: Thu 15. Jan 2015, 09:35
by PEAK-Support
Readme file for the Controller Area Network Protocol Family (aka SocketCAN) could be found here