Electronic – How to check the CAN bus is free or not

can

I read a lot of stuff regarding CAN bus arbitration, but it didn't answer my questions.

If one node is already transmitting the data on the bus and in between another node wants to initiate the data transfer, how will that "another node" get to know that the bus is busy?

All the documents (which I read) take condition that both nodes are starting transmission simultaneously and then one with first dominant bit will get the bus but nobody explained the condition which I want to know.

Best Answer

The short answer is that the node must monitor the CAN lines to be idle for a certain time before it attempts to transmit. So if another node is transmitting, it must keep quiet till the other node is done.

A CAN bus is based in differential signalling. The two lines, CAN-High (CAN+) and CAN-Low (CAN-), are both at the same potential when the bus is idle. To send bits, a CAN transmitter puts a differential voltage on the lines of about 2 volts.

A CAN transmitter first sees if the bus is idle and if it is, starts to transmit. How the arbitration works is that a transmitter monitors the bus as it's transmitting. Transmission is done as above by either keeping the two lines at the same potential or at a differential potential. So if the transmitter transmits a bit by keeping the lines at the same potential (sic), but it sees that the two transmit lines have a differential potential, that means that some other node is transmitting and the first transmitter has lost the arbitration. It must then stop transmitting.

When a node first starts transmitting, the bits transmitted are the same until the address of the transmitting node which are obviously different. If two nodes start transmitting together, they will transmit together in sync till the address part is reached. When the address differs, a node will notice a potential difference on the lines even when it is not putting one on the lines. Then it knows it has lost and has to try again. The winning node continues transmitting without knowing that some other node was trying as well. Of course, this logic extends to more than two nodes also.

I hope this helps.