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