Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN protocol basics

Hi all,

Since i am new to CAN protocol i have the following doubts during my study, could anyone help me to understand the queries.

1. Why dominant bit has high priority in CAN protocol?

2. Is it possible to assign same CAN ID for two messages? If yes, then how does the arbitration handle for this?

3. If data and remote frame with same message ID and start transmit at same time which frame(data or remote) win the bus?

4. The nodes connected in the bus have different baud rates, how does the synchronization happened?

5. How can calculate the time taken to transmit a CAN message with  11 bit identifier at 512 kbps?

6. How does the uC get to know whether the received bit is dominant or recessive?

 

Thanks in advance

0 Kudos
Message 1 of 4
(3,673 Views)

Hi,

 

I will do my best to explain CAN communications.  Others may be able to do much better than me...

 

As with all digital communication, CAN messaging is a series of 1 or 0 values transmitted in sequence on wires.  The 1 value (dominant) has a high voltage on the wire, while 0 (recessive) has a low voltage. 

 

If two signals appear at the same time, as soon as one tries to send a 0 (low voltage) while the other is sending 1 (high voltage) the 1 value will "win".  The signal that wanted 0 will be stopped.  This is arbitration. 

 

Each message should really have a unique ID.  If two nodes are trying to send the same message there will be confusion.  Receiving nodes will not necessarily know which "version" of the message they have just received. 

 

If you do have two nodes sending the same message, and they actually start at the same instant, then as described above, as soon as one has a 0 when the other has a 1, the message with 0 will stop being transmitted. 

 

You cannot use different baud rates in one network. 

 

A complete 11-bit ID 64-bit data CAN message will comprise up to 108 bits of data.  Without any bit-stuffing this would theoretically take 0.21ms to be transmitted (210 microseconds). 

 

Bit-stuffing is a technique to aid synchronisation if too many of one value bit appear together in a message.  After 5 consecutive bits of the same value an addition "stuff" bit of the opposite polarity is added. 

 

So if your 108-bit message has a high density of 1 or 0 values together, it could be "stuffed" by up to 20 additional bits (but not very likely!)  The transmission length would then be 128 bits, taking 0.25ms to be transmitted. 

 

More information on the basics of CAN bus will be found in Wikipedia: https://en.wikipedia.org/wiki/CAN_bus

0 Kudos
Message 2 of 4
(3,594 Views)

I'm not done on my CAN blog series, but I've started a series (now 5 parts in) that cover some of the basics of CAN from hardware, CAN payloads, signals and frames (which covers muxed signals which use the same ID for two different payloads) as well as NI and non NI CAN APIs. Here is the first part.

0 Kudos
Message 3 of 4
(3,591 Views)

Greetings PRK,

 

There are several layers that now exist in CAN.  Do you happen to know which level you are interested in here?  It would seem like you would want information on the basics like primitive messaging and packaging along with how to address instruments and locations within those.

 

An easy way to look at the dominant and recessive is that when the dominant line is pulled low, all devices are being told to listen to the upcoming message on the line.  If all devices work properly, they will all wait for the controller to send out a command or request.  Once the controller is done, if it sent out a request, then the instrument that was addressed in its CRO_ID will respond onto the bus until its messaging is complete or the controller again takes control of the dominant line.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 4 of 4
(3,582 Views)