CAN – CAN FD Bit Stuffing

can

Ok, it may be just peanuts, but here
the author says that the max. length (i.e. max. bit stuffing) of the flexible data rate part of a 64 Byte payload frame is 673 bit (Figure 6).
That part consists of:

  • ESI (1 bit)
  • DLC (4)
  • Data field (64 * 8 + x stuff)
  • CRC (21 + 6 stuff )
  • CRC Delimiter (1)

Now, 673 is the sum of the above plus 128 stuff bits. However that means that he considered a stuff bit after four consecutive bits of the same level, like it is done for the CRC part.

But in the Data Field a stuff bit has to be inserted after five consecutive bits, hasn't it?
Therefore, the max. length of the Data field is 512 + 512/5 = 615 bit, what gives a maximum of 648 instead of 673 bit.
Am I correct?

Best Answer

The author is correct. You must take into account the presence of previous stuff bits when generating subsequent ones. For example, consider the sequence below:

Input:   00000   1111   0000   1111...
Stuffed: 00000(1)1111(0)0000(1)1111(0)...

The first stuff bit combined with the four '1's that follow requires the insertion of a '0' stuff bit after only four data bits. If this is not done then it would be possible to have a sequence of six bits of the same level in the output stream. This would defeat the purpose of CAN bitstuffing which is to provide a synchronisation edge at a maximum of five bit intervals. In other words, if the receiver must be designed to handle an interval of six bit times in some situations then they are wasting bandwidth using a five bit rule most of the time.

Related Topic