1

If a device with two CAN ports have the same CAN-id, will this cause trouble?

The networks are separated for some reason, but the "master" should be the same for both networks.

Edit: Below the network topology.

 ("master") CAN-BUS 0 +----------+ +----------+ |------->| CAN-ID 2 | | |<------| +----------+ | CAN-ID 1 | | |<------| +----------+ +----------+ |------->| CAN-ID 3 | CAN-BUS 1 +----------+ 

As what I now understand is that the CAN-id is set in software. If I play around with ifconfig you can not set the CAN-id. Instead, this is set when I want to generate CAN traffic through cangen:

CANID=1 ip link set can0 type can bitrate 125000 ip link set up can0 cangen can0 -I $CANID -L 8 -v 

1 Answer 1

2

Yes, it will.

CAN has almost the same architecture as Ethernet. CAN IDs play almost the same role as MAC addresses in Ethernet. So as long as the two network segments remain separate, you can have same ID on two different devices. If these segments join back into one network - you will have collisions and both devices become unusable for proper communication.

I am not sure what do you mean by "same master in both networks", since CAN is designed to be closer to p2p protocols and does not really have master-slave relationship between hosts.

If you mean to keep message priority for 'masters' after joining network segments - you can just make a gap in the IDs and assign both 'masters' something small, while 'slaves' would have IDs higher than both masters.

Edit: I never worked (or saw) such multi-port CAN devices. But from a pure theoretical point of view - as long as device itself allows same IDs on its ports - it will probably work. As long as ID is unique inside the bus - the host will be able to communicate.

There are 'special case' devices which are 'CAN gateway'. They join two CAN buses into one. But the gateway is usually not referred as 'master', so I am not sure this is what you have in mind.

Once you connect to buses with a gateway - you have just one bus and all devices from both segments can communicate with each other. The gateway is just a signal repeater. BTW if your bus is physically long enough - you can intentionally put a gateway in the middle to ensure signal strength.
CAN-CAN gateways are configured by a specialized software, which is distributed together with the gateway device (or downloaded from the production company). So the question of IDs on its ports is answered automatically, when you run the tool :)

Another multi-port devices I worked with is a CAN-Ethernet gateway. But in this case, the device has just one CAN port and it acts as a normal CAN device with a normal ID (and normal MAC address on the Ethernet side).

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.