0
\$\begingroup\$

I am new to the CAN. I have came across bit stuffing which is used to ensure that all receivers nodes are synchronized to transmitter node (After 5 bits of the same polarity, CAN will add a bit stuffing bit of the opposite polarity).

I have some doubts regarding bit stuffing in CAN:

Bit stuffing in not applied to Identifier field in CAN protocol.

  1. Is this statement correct?

All bits after Identifier field will be bit stuffed if applicable

  1. Is this statement also correct?
\$\endgroup\$
1
  • \$\begingroup\$ The source for those - as I don’t think they are original... \$\endgroup\$
    – Solar Mike
    Feb 6 '19 at 8:02
1
\$\begingroup\$

The first statement is wrong - the identifier field must be bit stuffed. The CAN bus uses the stuff bit for two purposes: to synchronise timing between nodes, and to signal an active error condition. If the identifier field is not stuffed, then it would not have either of these capabilities.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks Jon for correcting me. I am confused with arbitration when there bit stuffing is involved. Let us assume that Node A and B tries to transmit data frame simultaneously. Node A transmits frame with identifier 10000010001 and Node B with identifier 11010001001. Which node will succeed in transmitting? How will arbitration work in this case? \$\endgroup\$
    – cdev
    Feb 6 '19 at 13:22
  • 1
    \$\begingroup\$ @cdev Arbitration happens on a bit by bit basis. If you get to the point of a stuff bit being sent, then all bits beforehand must have been identical (no arbitration) so the stuff bit will also be identifical. Once a different bit is detected one node immediately stops transmitting and any differences in stuff bits doesn't matter any more. \$\endgroup\$
    – Jon
    Feb 6 '19 at 13:41
0
\$\begingroup\$

From the CAN Spec:

The ERROR FLAG’s form violates the law of bit stuffing (see CODING) applied to all fields from START OF FRAME to CRC DELIMITER or destroys the fixed form ACK FIELD or END OF FRAME field.

which includes the identifier.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.