This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

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

  • Hi Prakash,

    Here are some useful overviews of the CAN physical layer and protocol that you can reference:

    www.ti.com/.../sloa101a.pdf
    www.kvaser.com/.../

    To answer your questions:

    1. Dominant bits are said to have priority because they are strongly driven by a CAN transceivers, whereas the recessive bits are not driven. This means that whenever any transceiver is dominant, the entire CAN bus is dominant. The CAN bus is only recessive if all CAN transceivers are recessive.

    2. No, arbitration requires that each node sending a message have an unique identifier field.

    3. The RTR bit following the identifier is recessive for a remote frame and dominant for a data frame, and so in this case the data frame would win arbitration.

    4. Each node on the bus should be configured to have the same baud rate. (There may be separate baud rates for the arbitration portion and data portion if the CAN FD protocol is used, but still in this case the baud rate configurations need to remain compatible from node to node).

    5. The time required for each bit is the reciprocal of the baud rate. The total time of a message would then be the number of bits transmitted times the time per bit plus any propagation delays that occur in the network (e.g., due to transceiver delays, cabling, etc.).

    6. The CAN transceiver (PHY) serves to translate the dominant/recessive bus states to high/low logic states that can be detected by an MCU. Dominant bits are represented by a logic low and recessive bits are represented by a logic high.

    Best regards,
    Max
  • Hi Max,

    Thanks for your reply. Could you please explain little bit more about the timing calculation of CAN.

    Max Robertson said:
    5. The time required for each bit is the reciprocal of the baud rate. The total time of a message would then be the number of bits transmitted times the time per bit plus any propagation delays that occur in the network (e.g., due to transceiver delays, cabling, etc.).

    IF you consider for example UART protocol the time taken to transmit a single byte includes the start and stop bit timings also. In the same CAN has more number of bits, so for the case of 11 bit identifier and 29 bit identifier the time taken to transmit a message at 512kbps will be differed. If you knew any page which explains more about the CAN protocol timing, please let me know.

  • Prakash,

    Yes, you are right - the CAN protocol introduces additional overhead bits (like the identifier field) within its frame structure, and this makes the time required for a full frame longer than the time it would require for just the data portion. You can compute the total time as long as you know the different fields that make up the frame - you can find this information in the links I gave in my post above.

    I hope this is clear; please let me know if you have questions.

    Max
  • Hi Robertson,

    Thanks for your reply. Could you please provide one example calculation about how to calculate the time take to send a byte at 512kBits in CAN protocol?

  • Hi Prakash,

    The time it takes to send a CAN packet is:
    (Bit Time)(Number of bits) + (tPHR) + delay of the cable - typically 5ns/m + (tPLD)

    So in your case the calculation from CAN controller to CAN controller using the TCAN10420 would be:
    (1.95us)(1 byte = 8 bits) + 75ns + delay of the cable - typically 5ns/m + 55ns

    CAN packets are not just one byte long though. A classic CAN frame could be 108 bits long so for this case the time to transmit a CAN packet at 512kbps through a 10 meter cable would be:
    (1.95us)(108) + 75ns + (5ns/m)(10m) + 55ns = 210.7us from CAN controller to CAN controller.

    Here is an application report that will help you understand the CAN protocol better: www.ti.com/.../sloa101b.pdf

    Please let me know if you have more questions?