Re: Questions about using multiple sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 05.09.20 08:47, Tom Evans wrote:
On 3/9/20 3:47 pm, Oleksij Rempel wrote:
Hi Henrique,

On Wed, Sep 02, 2020 at 03:15:13PM -0300, henrique ricardo figueira wrote:
Hi, I would like to know if it is possible for me to use multiple sockets with different protocols, a CAN_RAW socket and another CAN_J1939. Because I
need to receive messages from an ECU that does not follow J1939.

Yes, you can combine it as you wish. You can even use CAN_RAW to
communicate with CAN_J1939 on same or remote machine.

Yes, as long as you open the sockets on DIFFERENT CAN Buses. One for the J1939 and a different bus for the ECU.

On the same bus?

CAN buses are usually "All J1939" or "All Something Else". The J1939 protocol uses all of the CAN ID field to mean a whole range of different things that are important to the protocol.

Hi Tom,

AFAICS the question was not whether you run J1939 protocol on a specific bus or not.

To me the question was if a programmer can open multiple sockets from (potentially) different applications on a single CAN interface (on Linux).

And yes, you can do so - as we have a multi-user system on Linux and the 'SocketCAN' approach is designed for it.

E.g. You can open different J1939 sockets for J1939 protocol traffic and - in parallel - you can open different CAN_RAW sockets, e.g. to read and store the CAN traffic with candump.

At the end you are completely right that any traffic *sent* to a J1939 CAN interface must not interfere with the J1939 protocol expected by the ECUs on this bus.

The reception of 'messages from an ECU that does not follow J1939' via CAN_RAW sockets, as asked by Henrique, should therefore be no problem.

The 'problem' seems to be already introduced by that specific ECU ;-)

Best,
Oliver


I'd suggest you look at the Wilipedia "SAE J1939" web page, and open the "Introduction to J1939 (Vector Informatik)" link. It shows you how J1939 uses the CAN bus addresses.

It would be difficult to guarantee that the messages from the ECU won't upset one or more devices on the CAN bus.

Do you have full control of the ECU? Can you reprogram it to change the CAN IDs of all the messages it sends, or was that decided by someone else? If you can't change them then it is unlikely you could make it "compatible".

Then ask Google. This one says:

     If you are a CAN bus system design veteran (and only then),
     it is theoretically possible to combine them. It is a really
     bad idea but it can be done.

https://electronics.stackexchange.com/questions/467932/is-it-possible-to-use-j1939-and-canopen-on-the-same-bus

This one says "yes, but you have to do all of this...":

http://www.microcontrol.net/download/mmc_2013_koppe_2.pdf

The above also suggests that you should use a GATEWAY device between the two CAN buses. Or in your case, two buses on the computer.

I would say "yes, try this in an educational or hobby setup, but don't do it in a real vehicle".

Tom



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux