I'd like to go deeper into the concept of bit stuffing.CAN, as you are no doubt aware, is a synchronous protocol without an explicit clock signal from the transmitter that the receiver can use. The transmitter and the receiver must use independent clocks that are not synchronized. In order for this to work the clocks must be close to each other in frequency so that over a sequence of bits the accumulating difference between the transmit clock and the receive clock does not get large enough to move the sample point in each bit cell into the next bit. One thing that makes this process more difficult is long strings of one bits or zero bits. To avoid long strings of bits with a single polarity the stuff bit is inserted to allow the receiver to determine where the bit boundaries are so that it can correct the location of the sample point.
To better understand, let's consider a hypothetical example of a CAN data frame being transmitted.
Code:
Identifier: 0x123
Data: 1010101111000111