Electronic – CAN- “Messages have ID’s not nodes”

canmicrocontroller

I heard many people say that CAN message have ID's and not nodes.
I think this could be due to the fact that, irrespective of assigning a unique ID for each node, all nodes receive the messages. Also, in the event of any retransmission of a message, duplicate messages can be discarded when messages are assigned ID's when sending to each node.

But what if a system has 3 masters talking to many slave and all the 3 masters execute the same code(like in a 2 out of 3 voting system).
In such an architecture, it makes sense of assigning each node a unique ID so that the slave knows which master sent it data and reply back to each master uniquely.
Also, i cant think of a situation where a node may receive a duplicate message because retransmission occurs only in the event of error detection and when an error is signalled by a node, every node that received the data destroys the received data.

I'm confused now because i plan on assigning unique Id's to each node and the masters shall send message to each node based on its node ID(But the vast majority of CAN experts out there disagree with me).
Assigning each message a unique ID would mean that,if Master A sends 500 messages,500 unique Id's out of 2048 possible ID's(11 bit identifier) must be used by Master A. Remaining 500 by Master B,and remaining 500 by Master C.
Any insights on which would be a good approach would be greatly appreciated.

Also, any situation as to when a duplicate message can arrive at a node that already received the message would be of great help as that would be a solid explanation as to why each message must be given a unique ID and not a node.
This will help me understand that if Master A always sends the same identifier,the receiver will have no way of differentiating if its a duplicate message or not.

Best Answer

I think you're misunderstanding this:

I heard many people say that CAN message have IDs and not nodes.

This doesn't mean that every message sent on the bus should have a unique ID, or that you should never be able to identify which node sent the message. It means that IDs are best used to indicate what kind of data is being sent, not where the data is going. For example, if you have a temperature sensor broadcasting data, you can assign an ID number to mean "temperature data from sensor #1". Then any node that cares about temperature data can receive it. Many (most?) CAN controllers can easily send and receive multiple IDs, so it often doesn't make sense to say that a node has only one ID.

In your case, you could make IDs for "command from master 1 to slave 5", "command from master 2 to slave 8", "response to master 3 from slave 7", etc. I don't know enough about your system to say whether that's the best way to do it.

I don't understand why slaves need to respond to each master separately. If this is a majority-vote system, shouldn't one slave response be enough? You could have separate message IDs for errors.

Remember that all nodes receive all messages. It's up to the node whether it stores the message or not.