Home › Electrical Engineering Forum › General Discussion › Controller Area Network (CAN) bit stuffing › Re: Controller Area Network (CAN) bit stuffing
CAN bus makes use of asynchronous signaling with NRZ codification and, therefore, sample operation in receivers is needed. So, in order that a CAN controller of a node, that is a synchronous digital system with frequency clock generated by an oscillator, could sample the received asynchronous signal with fiability and accuracy, it must use a higher sample frequency to the signal going through the bus.
Whatsmore, real electrical signals in a CAN bus suffer from their own influences from distortion by physical characteristics, propagation delays, controller delays itself, EMI’s, and each member of a CAN network has its own clock, that normally is a quars clock with certain tolerance. So, a sample process and resynchronization are required in order to avoid clashing due to that factors.
CAN spec defines:
– Nominal bit frequency, that is the number of bits transmitted per second, with lack of resynchronization, realised by an ideal transmitter. Opposite value is Nominal bit time, Nbt.
– As already told, CAN controller must use a clock frequency that is multiple of nominal bit frequency, got as oscillator frequency quocient. Minimum time quantum, Mtq, is defined the same as oscillator frequency (maybe same or maybe half frequency). Basic time quantum, Tq, whose opposite is controller basic frequency, is proportional to Mtq by means of a Baud rate prescaler, Brp, normally able to configuration. So, Tq=Brq·Mtq.
Bit is sampled in a point into bit time. Communication speed in the controller settings, for a given oscillator frequency, is defined by Brp, and number of Tq per bit. This last value, Tq, is also obtained from an adding of partial values, also allowed to configuration that have some relation to bit synchornization.
CAN fixes two sampling synchronization methods with frame sequence bits when talking about receiver nodes: Hard synchronization and Soft synchronization
So, going back to the question, bit stream in a CAN message is coded according to the Non-Return-to-Zero (NRZ) method. This means that during the total bit time the generated bit level is either “dominant” or “recessive”.
Bit stuffing is provided for Error Handling when Transfer Layer instead of Physical Layer.