Advanced PIC18 Projects—CAN Bus Projects:Nominal Bit Timing

Nominal Bit Timing

The CAN bus nominal bit rate is defined as the number of bits transmitted every second without resynchronization. The inverse of the nominal bit rate is the nominal bit time. All devices on the CAN bus must use the same bit rate, even though each

device can have its own different clock frequency. One message bit consists of four nonoverlapping time segments:

• Synchronization segment (Sync_Seg)

• Propagation time segment (Prop_Seg)

• Phase buffer segment 1 (Phase_Seg1)

• Phase buffer segment 2 (Phase_Seg2)

The Sync_Seg segment is used to synchronize various nodes on the bus, and an edge is expected to lie within this segment. The Prop_Seg segment compensates for physical delay times within the network. The Phase_Seg1 and Phase_Seg2 segments compensate for edge phase errors. These segments can be lengthened or shortened by synchronization. The sample point is the point in time where the actual bit value is located and occurs at the end of Phase_Seg1. A CAN controller can be configured to sample three times and use a majority function to determine the actual bit value.

Each segment is divided into units known as time quantum, or TQ. A desired bit timing can be set by adjusting the number of TQ’s that comprise one message bit and the number of TQ’s that comprise each segment in it. The TQ is a fixed unit derived from the oscillator period, and the time quantum of each segment can vary from 1 to 8. The lengths of the various time segments are:

• Sync_Seg is 1 time quantum long

• Prop_Seg is programmable as 1 to 8 time quanta long

• Phase_Seg1 is programmable as 1 to 8 time quanta long

• Phase_Seg2 is programmable as 2 to 8 time quanta long

By setting the bit timing, a sampling point can be set so multiple units on the bus can sample messages with the same timing.

The nominal bit time is programmable from a minimum of 8 time quanta to a maximum of 25 time quanta. By definition, the minimum nominal bit time is 1ms, corresponding to a maximum 1Mb/s rate. The nominal bit time (TBIT) is given by:

Advanced PIC18 Projects—CAN Bus Projects -0202

In order to compensate for phase shifts between the oscillator frequencies of nodes on a bus, each CAN controller must synchronize to the relevant signal edge of the received signal. Two types of synchronization are defined: hard synchronization and resynchronization. Hard synchronization is used only at the beginning of a message frame, when each CAN node aligns the Sync_Seg of its current bit time to the recessive or dominant edge of the transmitted start of frame. According to the rules of synchronization, if a hard synchronization occurs, there will not be a resynchronization within that bit time.

With resynchronization, Phase_Seg1 may be lengthened or Phase_Seg2 may be shortened. The amount of change in the phase buffer segments has an upper bound given by the synchronization jump width (SJW). The SJW is programmable between 1 and 4, and its value is added to Phase_Seg1 or subtracted from Phase_Seg2.

Leave a comment

Your email address will not be published. Required fields are marked *