From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oliver Hartkopp Subject: Re: SocketCAN support for a Serial-CAN controller Date: Sat, 23 Apr 2016 15:54:37 +0200 Message-ID: <571B7E9D.7090308@hartkopp.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.160]:65512 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbcDWNyr (ORCPT ); Sat, 23 Apr 2016 09:54:47 -0400 In-Reply-To: Sender: linux-can-owner@vger.kernel.org List-ID: To: Rein Appeldoorn , linux-can@vger.kernel.org Hello Rein, On 04/22/2016 01:17 PM, Rein Appeldoorn wrote: > Up until now, I've been working with SocketCAN via CANUSB adapters > from Lawycel (http://www.can232.com/?page_id=16). However, now we > received a new platform with another serial-can controller from > axiomtek (http://www.axiomtek.com/Default.aspx?MenuId=Products&FunctionId=ProductView&ItemId=8270). > > I am able to communicate with the CAN controller via serial and > receive CAN frames. However, using slcand to create a socketcan > interface does not work. As I see here > https://github.com/linux-can/can-utils/blob/master/slcand.c , the > slcand program sends specific commands to the serial bus and then > creates a bridge between the socket and serial. However, the commands > are different for my CAN controller. Yes. That's pretty bad to reinvent the wheel by creating 'just another' CAN ASCII protocol :-( > Can somebody give me some pointers how to get SocketCAN to work with > an arbitrary serial-can controller? The slcan driver supports the standard SLCAN protocols as you know from Lawicel: https://github.com/linux-can/can-misc/blob/master/docs/SLCAN-API.pdf > I'm am very new to these low level Linux things so I really would > appreciate your help / corrections. Thanks in advance, You would need to extend the slcan.c driver and the slcan tools from the can-utils to cope with the Axiomtek protocol. Alternatively you can write a user space application that talks to the Axiomtek device and send the CAN frames to a virtual CAN (e.g. vcan0) so that you can use the can-utils on top of that virtual CAN. Just a different idea: As you obviously have a full-size mini PCI-Express module - why don't you use a proper CAN PCIe interface with a PCI-connected SJA1000 controller which is already supported by Linux? All this serial line encapsulation stuff does not support the really good (configuration) things and error handling from SocketCAN. Regards, Oliver ps. Maybe Axiomtek can also provide a SLCAN compatible firmware ...