Skip to contentSkip to conversation

J1939

DISCUSSION David H. Lynch Jr. 2 participants 3 messages Nov 14, 2013 – Nov 20, 2013 1 message not in the archive CAN network drivers

lore
Share & tools
lore
#0 lore raw

I recently noticed that J1939 support has been incorporated into the Linux Kernel CAN stack.

I would be happy to help with testing that with some pointers.

Any simple examples of sending/receiving specific PGN's ?

#1 lore raw

Hi David,

Quoted 2 lines · David H. Lynch Jr.

I recently noticed that J1939 support has been incorporated into the Linux Kernel CAN stack.

Well, the j1939 stack is not yet incorporated in mainline Linux. It's API, which adheres to BSD socket semantics than raw CAN due to the addressing concept, causes some resistance.

You are of course welcome to share your opinions about that matter.

Once the API is agreed, mainline should be easy.

Quoted 2 lines

I would be happy to help with testing that with some pointers.

Great. I have performed only manual tests in the past to get the stack right.
Some sort of automated test may be usefull to avoid problems over time with refactoring or changing kernel infrastructures.

A sample of the code got certified in an ISOBUS product. At that time, the code proved to be functional, both for the normal use case as for a lot of erroneous situations.

Quoted 2 lines

Any simple examples of sending/receiving specific PGN's ?

You can read Documentation/networking/j1939.txt.
The can-utils-j1939 package have some tools, but those do not expose the easiest examples.

I will add some easier examples that are a bit closer to real-life programs.

Kind regards,
Kurt

#3 lore raw
In reply to a message not in the archive

Hi David,

Quoted 11 lines · David H. Lynch Jr.

Hi Kurt;

I mostly do board bringup work as a consultant. So I can handle merging a
driver into the kernel or using one of the testing kernel trees.

Many of my clients use CAN/J1939/NMEA2000/CANOpen, to this point I have
always had to deal with these in userspace.
A standard stack that was in the kernel is very appealing.

I have already pulled the 3 git repositories related to J1939. But my
quick skim did not get me far.

Well, I suppose you got linux-can-j1939, can-j1939-utils & iproute2-j1939? Please mind you want to select a proper branch of linux-can-j1939.

Did you manage to compile them?
The reason I ask this is that most questions I get wrt. j1939 is getting it merged & compiled.
In the meanwhile, I updated the j1939 page on www.elinux.org with basic instructions how to build.

Quoted 7 lines

While I am primarily interested in sending/receiving J1939 messages at the
socket level, even being able to use cansend to say send a J1939 engine speed would be really useful.

i can already do that as the J1939 engine speed message fits in an ordinary
CAN message - but all messages don't.

You're at the right address. The things you describe are exactly what I implemented.

Quoted 4 lines

Anyway if it is of value to you to have some one else using and testing
this and providing feedback, to the extent that I can incorporate it into my existing work I would be happy to do so.

The GPL license allows you to reuse the components in your work. Any real-world comments on the stack should be usefull. In the past 2 years, some usefull improvements were made this way.

Quoted 4 lines

When I get a bit more time to look through the code and Docs I will - the
answers I am looking for are certainly there, I was just hoping to be able to get to testing some things quickly.

I composed a simple kickstart guide to j1939 on linux for new collegues. It may be of good use for you and others too.
I'm just looking for a place to share the thing.
Can elinux.org use markdown syntax?

Kurt

Quoted 46 lines · Kurt Van Dijck

Hi David,

On Wed, Nov 13, 2013 at 07:26:28PM -0500, David H. Lynch Jr. wrote:
> I recently noticed that J1939 support has been incorporated into the > Linux Kernel CAN stack.

Well, the j1939 stack is not yet incorporated in mainline Linux. It's API, which adheres to BSD socket semantics than raw CAN due to the addressing concept, causes some resistance.

You are of course welcome to share your opinions about that matter.

Once the API is agreed, mainline should be easy.

>
> I would be happy to help with testing that with some pointers.

Great. I have performed only manual tests in the past to get the stack right.
Some sort of automated test may be usefull to avoid problems over time with refactoring or changing kernel infrastructures.

A sample of the code got certified in an ISOBUS product. At that time, the code proved to be functional, both for the normal use case as for a lot of erroneous situations.

>
> Any simple examples of sending/receiving specific PGN's ?

You can read Documentation/networking/j1939.txt.
The can-utils-j1939 package have some tools, but those do not expose the easiest examples.

I will add some easier examples that are a bit closer to real-life programs.

Kind regards,
Kurt

Signature · 5 lines
Kurt Van Dijck
GRAMMER EiA ELECTRONICS
http://www.eia.be
[email protected]
+32-38708534