Reputation: 529
I am trying to understand CAN bus arbitration method using the following example but i am not understanding why the bus level is 0(zero) somewhere and 1 elsewhere.Here s1,s2,s3 are three nodes with three different identifiers and logic zero means dominant level and logic 1 means recessive level.Can anybody help me to understand the following example ?
s1 1 0 0 0 1 0 0 0 0 1 1
s2 0 0 1 1 1 0 0 1 0 1 1
s3 0 0 1 1 1 0 1 0 0 1 0
bus level 0 0 1 1 1 0 0 1 0 1 1
Upvotes: 0
Views: 2194
Reputation: 512
The bus level is 1, or 0 means a digital representation of bit 1, or bit 0 was set on the physical layer of CAN communication. To represent the 2 bits in differential signalling, a CAN nodes transceiver sets the electric level of CAN_H and CAN_L as in the following depiction. This way will send either bit=1, or bit=0 on the channel (the twisted pair cables of CAN_H and CAN_L resp. will form a single CAN channel).
First, you should understand the notion of common physical channel communication. Every node in a CAN channel has to modulate the same connection (the same electric level) they share.
Its like a family of 4 people, and 1 single TV, where everyone has a personal remote. If everyone in the family wants to see Channel 1, they all push the button Channel 1, and everybody is happy . Same if everybody pushes the remote to for the Channel 2, everybody is happy, everyone watches what they wished for, the TV will not have to change channels.
The problem arises, when someone wants the other channel in the same time. Here they need an arbitration, which Channel will remain on TV.
And the custom rule they all agree with, is that Channel 1 is dominant, and Channel 2 is recessive. Meaning, if at least one family member wants Channel 1, the TV will stay on Channel 1, no matter how many family members want Channel 2.
This is the a Arbitration rule of the CAN channel also. If one of the nodes want to represent bit=1 on the channel, but they read back a bit=0 afterwards, they know there is another node already sending something also. In this case, which wants to send bit=1, looses the arbitration, and stops the sending of its message altogether, waiting the current message (which won) to be sent, and they will start the whole message all over from the start.
This happens only in the Arbitration field i.e. ID field of messages, and only in the case when 2 or more nodes want to send a message in the same time.
In other cases, when a node wants to send a message while another is already in the middle of the sending, it will know he is already late, and has to wait the Bus Idle phase after the current ongoing message was successfully sent, to send its own message.
Btw, your example is not correct, since the nodes will stop sending the ID immediately if they lost arbitration, like s1 in the first column,s3 in the 7th column . The correct abitration should look like this:
s1 1 - - - - - - - - - -
s2 0 0 1 1 1 0 0 1 0 1 1
s3 0 0 1 1 1 0 1 - - - -
bus level 0 0 1 1 1 0 0 1 0 1 1
Upvotes: 1
Reputation: 31
In the table, Sender 1 looses arbitration at the start on bit 10, sender 3 looses arbitration at bit 4, which leaves sender 2 with the higher priority and it gets to transmit its data onto the bus.
Another way to think of arbitration is which ID is lower in value:
S1 - 0x443 - 1091
S2 - 0x1CB - 459 <- lowest value wins arbitration
S3 - 0x1D2 - 466
Upvotes: 3