* serial can or socket can ?
@ 2012-06-12 12:55 bruce bushby
2012-06-12 13:44 ` Oliver Hartkopp
0 siblings, 1 reply; 3+ messages in thread
From: bruce bushby @ 2012-06-12 12:55 UTC (permalink / raw)
To: linux-can
Hi
I wanted to confirm my understanding of "socketcan" in terms "slcan0" and "can0"
I've been playing with a Beaglebone board the a usb-can adaptor from
mictronics.de:
http://www.mictronics.de/projects/usb-can-bus/
Purchased from:
http://shop.greenstage.co.nz/product/usb-can-bus-interface
1. Is my understanding correct that "slcan" will ALWAYS be used when
connecting a USB based CANBUS adapter?
I am able to bringup slcan0 using the following commands:
# slcan_attach -o -s6 /dev/ttyUSB0
attached tty /dev/ttyUSB0 to netdevice slcan0
# slcand ttyUSB0
# ifconfig slcan0 up
# ifconfig slcan0
slcan0 Link encap:UNSPEC HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
#
2. AM335x has an internal D_CAN, but the Beaglebone is missing any CAN
transceiver...would the lack of the transceiver prevent the kernel
from creating the "can0" device?
# lsmod
Module Size Used by Not tainted
d_can 5470 0
can_raw 3679 0
can_dev 4414 1 d_can
can 16648 1 can_raw
slcan 3437 1
ftdi_sio 24056 1
usbserial 18026 3 ftdi_sio
# ip link set can0 up
ip: SIOCGIFFLAGS: No such device
# ifconfig can0
ifconfig: can0: error fetching interface information: Device not found
# ifconfig -a
eth0 Link encap:Ethernet HWaddr D4:94:A1:89:BC:FF
inet addr:192.100.1.13 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:70 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:21678 (21.1 KiB) TX bytes:1392 (1.3 KiB)
Interrupt:40
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:166 (166.0 B) TX bytes:166 (166.0 B)
slcan0 Link encap:UNSPEC HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
#
FYI: This is probably a better board if you want to play with CANBUS:
http://www.ti.com/tool/tmdxice3359
Cheers
Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: serial can or socket can ?
2012-06-12 12:55 serial can or socket can ? bruce bushby
@ 2012-06-12 13:44 ` Oliver Hartkopp
2012-06-12 13:53 ` Marc Kleine-Budde
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2012-06-12 13:44 UTC (permalink / raw)
To: bruce bushby; +Cc: linux-can
On 12.06.2012 14:55, bruce bushby wrote:
> Hi
>
> I wanted to confirm my understanding of "socketcan" in terms "slcan0" and "can0"
>
Ok, let's go ...
> I've been playing with a Beaglebone board the a usb-can adaptor from
> mictronics.de:
> http://www.mictronics.de/projects/usb-can-bus/
> Purchased from:
> http://shop.greenstage.co.nz/product/usb-can-bus-interface
>
> 1. Is my understanding correct that "slcan" will ALWAYS be used when
> connecting a USB based CANBUS adapter?
No.
The slcan driver provides a CAN network device for CAN interfaces that are
controlled by the ASCII protocol first brought up by LAWICEL (www.can232.com,
www.canusb.com). The slcan driver converts the ASCII frames to struct
can_frame which is used in the Linux CAN subsystem (aka SocketCAN).
You may have a CAN device supporting the SLCAN protocol on RS232, USB-serial
adapters, whatever.
See
http://lxr.linux.no/#linux+v3.4.2/drivers/net/can/Kconfig#L13
and
http://lxr.linux.no/#linux+v3.4.2/drivers/net/can/slcan.c#L99
There are CAN USB drivers in the tree, that do not use the SLCAN protocol:
http://lxr.linux.no/#linux+v3.4.2/drivers/net/can/usb/Kconfig
>
> I am able to bringup slcan0 using the following commands:
Use this
> # slcan_attach -o -s6 /dev/ttyUSB0
> attached tty /dev/ttyUSB0 to netdevice slcan0
OR this
> # slcand ttyUSB0
!
Running slcand and slcan_attach together doesn't make sense.
> # ifconfig slcan0 up
> # ifconfig slcan0
> slcan0 Link encap:UNSPEC HWaddr
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
> UP RUNNING NOARP MTU:16 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:10
> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>
> #
>
>
> 2. AM335x has an internal D_CAN, but the Beaglebone is missing any CAN
> transceiver...would the lack of the transceiver prevent the kernel
> from creating the "can0" device?
No. A missing CAN transceiver is not detected (so far).
I assume you need a platform driver specification for your board to find and
access the CAN controller. If you have it, the CAN controller can be accessed
and initialized => can0 appears.
>
>
> # lsmod
> Module Size Used by Not tainted
> d_can 5470 0
> can_raw 3679 0
> can_dev 4414 1 d_can
> can 16648 1 can_raw
> slcan 3437 1
> ftdi_sio 24056 1
> usbserial 18026 3 ftdi_sio
>
> # ip link set can0 up
> ip: SIOCGIFFLAGS: No such device
>
> # ifconfig can0
> ifconfig: can0: error fetching interface information: Device not found
As expected: Not platform definition => no hardware access => no device
>
> # ifconfig -a
> eth0 Link encap:Ethernet HWaddr D4:94:A1:89:BC:FF
> inet addr:192.100.1.13 Bcast:0.0.0.0 Mask:255.255.255.0
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:70 errors:0 dropped:0 overruns:0 frame:0
> TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:21678 (21.1 KiB) TX bytes:1392 (1.3 KiB)
> Interrupt:40
>
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> UP LOOPBACK RUNNING MTU:16436 Metric:1
> RX packets:3 errors:0 dropped:0 overruns:0 frame:0
> TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:166 (166.0 B) TX bytes:166 (166.0 B)
>
> slcan0 Link encap:UNSPEC HWaddr
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
> UP RUNNING NOARP MTU:16 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:10
> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>
> #
>
>
> FYI: This is probably a better board if you want to play with CANBUS:
> http://www.ti.com/tool/tmdxice3359
>
>
> Cheers
> Bruce
Regards,
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: serial can or socket can ?
2012-06-12 13:44 ` Oliver Hartkopp
@ 2012-06-12 13:53 ` Marc Kleine-Budde
0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2012-06-12 13:53 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: bruce bushby, linux-can
[-- Attachment #1: Type: text/plain, Size: 2717 bytes --]
On 06/12/2012 03:44 PM, Oliver Hartkopp wrote:
> On 12.06.2012 14:55, bruce bushby wrote:
>
>> Hi
>>
>> I wanted to confirm my understanding of "socketcan" in terms "slcan0" and "can0"
>>
>
>
> Ok, let's go ...
>
>> I've been playing with a Beaglebone board the a usb-can adaptor from
>> mictronics.de:
>> http://www.mictronics.de/projects/usb-can-bus/
>> Purchased from:
>> http://shop.greenstage.co.nz/product/usb-can-bus-interface
>>
>> 1. Is my understanding correct that "slcan" will ALWAYS be used when
>> connecting a USB based CANBUS adapter?
>
>
> No.
>
> The slcan driver provides a CAN network device for CAN interfaces that are
> controlled by the ASCII protocol first brought up by LAWICEL (www.can232.com,
> www.canusb.com). The slcan driver converts the ASCII frames to struct
> can_frame which is used in the Linux CAN subsystem (aka SocketCAN).
>
> You may have a CAN device supporting the SLCAN protocol on RS232, USB-serial
> adapters, whatever.
>
> See
>
> http://lxr.linux.no/#linux+v3.4.2/drivers/net/can/Kconfig#L13
>
> and
>
> http://lxr.linux.no/#linux+v3.4.2/drivers/net/can/slcan.c#L99
>
> There are CAN USB drivers in the tree, that do not use the SLCAN protocol:
>
> http://lxr.linux.no/#linux+v3.4.2/drivers/net/can/usb/Kconfig
>
>
>>
>> I am able to bringup slcan0 using the following commands:
>
>
> Use this
>
>> # slcan_attach -o -s6 /dev/ttyUSB0
>> attached tty /dev/ttyUSB0 to netdevice slcan0
>
>
> OR this
>
>> # slcand ttyUSB0
>
>
> !
>
> Running slcand and slcan_attach together doesn't make sense.
>
>
>> # ifconfig slcan0 up
>> # ifconfig slcan0
>> slcan0 Link encap:UNSPEC HWaddr
>> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>> UP RUNNING NOARP MTU:16 Metric:1
>> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>> collisions:0 txqueuelen:10
>> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>>
>> #
>>
>>
>> 2. AM335x has an internal D_CAN, but the Beaglebone is missing any CAN
>> transceiver...would the lack of the transceiver prevent the kernel
>> from creating the "can0" device?
As Oliver said, you need a platform device definition in your board file
and a kernel that supports the d_can hardware. You can use David
Miller's net-next/master tree.
regards, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-12 13:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 12:55 serial can or socket can ? bruce bushby
2012-06-12 13:44 ` Oliver Hartkopp
2012-06-12 13:53 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).