Difference between revisions of "J1939"
(fix url) |
(→Build: update examples to github sources) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Networking]] | ||
+ | = SAE J1939 in Linux = | ||
+ | == overview == | ||
+ | See also on [http://en.wikipedia.org/wiki/J1939 Wikipedia]. | ||
− | + | SAE J1939 defines a higher layer protocol on CAN. It implements a more | |
+ | sophisticated addressing scheme and extends the maximum packet size above | ||
+ | 8 bytes. Several derived specifications exists, which differ from the | ||
+ | original j1939 on the application level, like MilCAN, NMEA2000 and | ||
+ | especially ISO-11783 (ISOBUS). This last one specifies the so-called ETP | ||
+ | (Extended Transport Protocol) which is has been included in this | ||
+ | implementation. This inclusion results in a maximum packet size of | ||
+ | ((2^24)-1)*7 bytes | ||
− | == SAE J1939 | + | === Specifications === |
+ | * SAE J1939-21 : data link layer | ||
+ | * SAE J1939-81 : network management | ||
+ | * ISO 11783-6 : Virtual Terminal (Extended Transport Protocol) | ||
+ | |||
+ | == Sources == | ||
Support for SAE J1939 in Linux consists of 3 parts: | Support for SAE J1939 in Linux consists of 3 parts: | ||
− | * [http:// | + | * [http://github.com/kurt-vd/linux j1939 linux kernel] |
− | * [http:// | + | * [http://github.com/kurt-vd/can-utils j1939 can-utils] |
− | * [http:// | + | * [http://github.com/kurt-vd/iproute2 j1939 iproute2] |
You probably want all 3 components to get a J1939 linux node working. | You probably want all 3 components to get a J1939 linux node working. | ||
+ | The J1939 specific code resides in dedicated branches. | ||
The final goal is to have these source trees mainlined. | The final goal is to have these source trees mainlined. | ||
+ | |||
+ | == Build == | ||
+ | === Build the kernel (necessary) === | ||
+ | |||
+ | $ git clone <yourfavoritelinuxkernel> linux | ||
+ | $ cd linux | ||
+ | $ git remote add j1939 git://github.com/kurt-vd/linux | ||
+ | $ git remote update j1939 | ||
+ | $ git merge j1939/j1939-vX.X | ||
+ | $ make etc. | ||
+ | |||
+ | With j1939-vX.X the branch that matches the closest, but not higher, with your linux version. | ||
+ | |||
+ | === Build can-j1939-utils (recommended) === | ||
+ | |||
+ | $ git clone git://github.com/kurt-vd/can-utils | ||
+ | $ cd can-utils | ||
+ | $ make etc. | ||
+ | |||
+ | Or you may merge the j1939 changes into any other can-utils version. | ||
+ | This should be fairly simple. | ||
+ | |||
+ | If the branch of linux-can-j1939 that you merged into your kernel was for version 3.7 or higher, use the j1939-v6 branch of can-j1939-utils. | ||
+ | |||
+ | === Build iproute2-j1939 (recommended) === | ||
+ | |||
+ | $ git clone git://github.com/kurt-vd/iproute2 | ||
+ | $ cd iproute2 | ||
+ | $ git checkout j1939-vX.X | ||
+ | $ make etc. | ||
+ | |||
+ | With j1939-vX.X the branch that matches the closest, but not higher, with your linux version. | ||
+ | |||
+ | Or you may merge the j1939 changes into any other iproute2 version. | ||
+ | This may be a little more complicated. | ||
+ | |||
+ | === Getting Started with J1939 === | ||
+ | |||
+ | First get a can0 bus on your system. | ||
+ | |||
+ | $ modprobe vcan | ||
+ | $ ip link add can0 type vcan | ||
+ | $ ip link set can0 up | ||
+ | |||
+ | Now start j1939. | ||
+ | |||
+ | $ modprobe can-j1939 | ||
+ | $ ip link set can0 j1939 on | ||
+ | |||
+ | Now you should be able to use can0 as a j1939 CAN device. |
Revision as of 03:17, 21 April 2015
Contents
SAE J1939 in Linux
overview
See also on Wikipedia.
SAE J1939 defines a higher layer protocol on CAN. It implements a more sophisticated addressing scheme and extends the maximum packet size above 8 bytes. Several derived specifications exists, which differ from the original j1939 on the application level, like MilCAN, NMEA2000 and especially ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended Transport Protocol) which is has been included in this implementation. This inclusion results in a maximum packet size of ((2^24)-1)*7 bytes
Specifications
- SAE J1939-21 : data link layer
- SAE J1939-81 : network management
- ISO 11783-6 : Virtual Terminal (Extended Transport Protocol)
Sources
Support for SAE J1939 in Linux consists of 3 parts:
You probably want all 3 components to get a J1939 linux node working. The J1939 specific code resides in dedicated branches.
The final goal is to have these source trees mainlined.
Build
Build the kernel (necessary)
$ git clone <yourfavoritelinuxkernel> linux $ cd linux $ git remote add j1939 git://github.com/kurt-vd/linux $ git remote update j1939 $ git merge j1939/j1939-vX.X $ make etc.
With j1939-vX.X the branch that matches the closest, but not higher, with your linux version.
Build can-j1939-utils (recommended)
$ git clone git://github.com/kurt-vd/can-utils $ cd can-utils $ make etc.
Or you may merge the j1939 changes into any other can-utils version. This should be fairly simple.
If the branch of linux-can-j1939 that you merged into your kernel was for version 3.7 or higher, use the j1939-v6 branch of can-j1939-utils.
Build iproute2-j1939 (recommended)
$ git clone git://github.com/kurt-vd/iproute2 $ cd iproute2 $ git checkout j1939-vX.X $ make etc.
With j1939-vX.X the branch that matches the closest, but not higher, with your linux version.
Or you may merge the j1939 changes into any other iproute2 version. This may be a little more complicated.
Getting Started with J1939
First get a can0 bus on your system.
$ modprobe vcan $ ip link add can0 type vcan $ ip link set can0 up
Now start j1939.
$ modprobe can-j1939 $ ip link set can0 j1939 on
Now you should be able to use can0 as a j1939 CAN device.