linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Evans <tom_usenet@optusnet.com.au>
To: henrique ricardo figueira <henrislip@gmail.com>
Cc: linux-can@vger.kernel.org
Subject: Re: Questions about using multiple sockets
Date: Sat, 5 Sep 2020 16:47:19 +1000	[thread overview]
Message-ID: <1116be40-25c4-002e-8455-5d5f86ac6e03@optusnet.com.au> (raw)
In-Reply-To: <20200903054724.x6giher7ldmuvbac@pengutronix.de>

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.

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

  reply	other threads:[~2020-09-05  6:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAD1tVCN7-T=FHNQEz3Bp-0Kt3H6M1RokyUuw=e9sTLdXNWB=DQ@mail.gmail.com>
2020-09-03  5:47 ` Questions about using multiple sockets Oleksij Rempel
2020-09-05  6:47   ` Tom Evans [this message]
2020-09-07  6:55     ` Oliver Hartkopp
2020-09-07 12:33       ` Kurt Van Dijck
2020-09-07 13:07         ` Tom Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1116be40-25c4-002e-8455-5d5f86ac6e03@optusnet.com.au \
    --to=tom_usenet@optusnet.com.au \
    --cc=henrislip@gmail.com \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).