<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Subjektive Wahrnehmung &#187; Controller Area Network</title>
	<atom:link href="http://blog.gegg.us/category/controller-area-network/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gegg.us</link>
	<description>Ein Blog über Freie Software, (Netz-)politik und mehr</description>
	<lastBuildDate>Fri, 06 Aug 2010 18:50:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Best of breed CAN device driver hitting mainline Linux Kernel 2.6.31</title>
		<link>http://blog.gegg.us/2009/06/best-of-breed-can-device-driver-hitting-mainline-linux-kernel-2631/</link>
		<comments>http://blog.gegg.us/2009/06/best-of-breed-can-device-driver-hitting-mainline-linux-kernel-2631/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 18:33:37 +0000</pubDate>
		<dc:creator>giggls</dc:creator>
				<category><![CDATA[Controller Area Network]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.gegg.us/?p=104</guid>
		<description><![CDATA[Starting with the upcoming 2.6.31 Linux Kernel (already available as 2.6.31-rc1) a functional version of the socketcan device driver found its way into mainline. 
While socketcan itself has been in mainline for quite a while, there where no drivers for actual real-world hardware. This has now changed and I will therefore be able to run [...]]]></description>
			<content:encoded><![CDATA[<p>Starting with the upcoming 2.6.31 Linux Kernel (already available as 2.6.31-rc1) a functional version of the socketcan device driver found its way into mainline. </p>
<p>While socketcan itself has been in mainline for quite a while, there where no drivers for actual real-world hardware. This has now changed and I will therefore be able to run a Kernel which is one step closer to mainline.</p>
<p>Unfortunately however some kind of <a href="http://valerieaurora.org/union/">unioning filesystem</a> is still missing.</p>
<p>Anyway, back to <a href="http://en.wikipedia.or/wiki/CAN-bus">Controller–area network</a>!</p>
<p>Since I wrote my own CAN device driver as a character device a couple of years ago I started thinking about a CAN-bus driver beeing implemented as a Network device. I wrote my own driver in the first place, because I needed concurrent access which is (needless to say) also possible with socketcan.</p>
<p>Fortunately two guys at Volkswagen Research finally started doing exactly this. Thank you to the socketcan people for providing such a nice piece of software!</p>
<p>So here is a mini HOWTO for getting it up and running.</p>
<p><strong>What you need:</strong></p>
<ul>
<li>A GNU/Linux machine</li>
<li>A decent Kernel (2.6.31-rc1 or higher)</li>
<li>git and subversion</li>
<li>A supported CAN-bus card. I&#8217;m using one sold by <a href="http://www.ems-wuensche.de/">EMS Wünsche</a>, but a lot of other SJA1000 based cards may also work.</li>
<li>The simple userland utilities from svn://svn.berlios.de/socketcan/trunk/can-utils</li>
<li>A decent Version of <a href="http://www.linuxfoundation.org/en/Net:Iproute2">iproute2</a> (not yet available in current GNU/Linux distributions at the time of writing)</li>
</ul>
<p><strong>How to get it up and running:</strong></p>
<p>First of all compile and boot a Kernel where all CAN-related support is enabled either as a module or build into the Kernel.<br />
Afterwords check out the userland utilities from subversion (<code>svn checkout svn://svn.berlios.de/socketcan/trunk/can-utils</code>) and compile them by just typing <code>make</code>.<br />
Same goes for iproute2 (<code>git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git</code>); just type <code>make</code> as well. Copy all the resulting binaries to an appropriate place (e.g. /usr/local/bin). Do not use <code>make install</code> at least in iproute2 sourcetree, because this will replace your systems <code>ip</code> command.</p>
<p>Now all you need to do ist to enable you can0 interface by means of the following command:</p>
<p><code>ip link set can0 up txqueuelen 1000 type can bitrate 1000000</code></p>
<p>Use another value than 1000000 for different bitrates.</p>
<p>The txqueuelen might not be needed in your case if you don&#8217;t have peak traffic like I do.</p>
<p>OK, that`s it! You can now connect your bus to some device and use <code>candump</code> for watching your raw CAN pakets on the bus.</p>
<p>For integration into Debian GNU/Linux you may use something like the following in <code>/etc/network/interfaces</code> for automatically starting up your can0 device on system boot:</p>
<p><code><br />
--cut--<br />
auto can0<br />
iface can0 inet manual<br />
        # bitrate 1MBps<br />
        # increase TX queue length because of the pulsed nature of<br />
        # the traffic we generate<br />
        up /usr/local/bin/ip link set can0 up txqueuelen 1000 type can bitrate 1000000<br />
        down /sbin/ifconfig $IFACE down<br />
--cut--<br />
</code></p>
<p>See Documentation/networking/can.txt inside your Kernel tree for further documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gegg.us/2009/06/best-of-breed-can-device-driver-hitting-mainline-linux-kernel-2631/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
