Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
162
Добавлен:
01.03.2016
Размер:
3.56 Mб
Скачать

RM0016

Controller area network (beCAN)

 

 

23.6.6Bit timing

The bit timing logic monitors the serial bus-line and performs sampling and adjustment of the sample point by synchronizing on the start-bit edge and resynchronizing on the following edges. Its operation may be explained simply by splitting nominal bit time into three segments as follows:

Synchronization segment (SYNC_SEG): a bit change is expected to occur within this time segment. It has a fixed length of one time quantum (1 x tCAN).

Bit segment 1 (BS1): defines the location of the sample point. It includes the PROP_SEG and PHASE_SEG1 of the CAN standard. Its duration is programmable between 1 and 16 time quanta but may be automatically lengthened to compensate for positive phase drifts due to differences in the frequency of the various nodes of the network.

Bit segment 2 (BS2): defines the location of the transmit point. It represents the PHASE_SEG2 of the CAN standard. Its duration is programmable between 1 and 8 time quanta but may also be automatically shortened to compensate for negative phase drifts.

The resynchronization Jump Width (SJW) defines an upper bound to the amount of lengthening or shortening of the bit segments. It is programmable between 1 and 4 time quanta.

To guarantee the correct behavior of the CAN controller, SYNC_SEG + BS1 + BS2 must be greater than or equal to 5 time quanta.

Note:

For a detailed description of the CAN bit timing and resynchronization mechanism, please

 

refer to the ISO 11898 standard.

As a safeguard against programming errors, the configuration of the Bit Timing Registers CAN_BTR1 and CAN_BTR2 is only possible while the device is in Initialization mode.

Figure 154. Bit timing

 

NOMINAL BIT TIME

 

 

(min. 5 x tq)

 

SYNC_SEG

BIT SEGMENT 1 (BS1)

BIT SEGMENT 2 (BS2)

1 x tq

tBS1

tBS2

 

(1 .. 16 x tq)

(1 .. 8 x tq)

 

SAMPLE POINT

TRANSMIT POINT

 

1

BaudRate =

----------------------------------------------

 

NominalBitTime

NominalBitTime = tq + tBS1 + tBS2

with

 

tBS1 = ( BS1[3:0] + 1) × tq

tBS2 = ( BS2[2:0] + 1) × tq

tq = ( BRP[5:0] + 1) × tsys

where tq refers to the time quantum, tsys is the system clock period (fMASTER). BRP[5:0], BS1[3:0], and BS2[2:0] are defined in the CAN_BTR1 and CAN_BTR2 registers.

Doc ID 14587 Rev 9

383/454

Controller area network (beCAN)

RM0016

 

 

Figure 155. CAN frames

Inter-Frame Space

 

 

 

 

 

 

Data Frame (Standard identifier)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

44 + 8 * N

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Arbitration Field

 

Ctrl Field

Data Field

CRC Field

 

 

 

 

 

 

 

12

 

 

 

 

 

 

 

6

 

 

 

 

 

 

8 * N

 

 

 

 

 

 

 

16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

STID[10:0]

 

 

 

 

 

DLC

 

 

 

 

 

 

 

 

 

 

 

 

CRC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SOF

RTR IDE/r1 r0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Inter-Frame Space

 

 

 

 

 

Data Frame (Extended identifier)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

64 + 8 * N

 

 

 

 

 

 

Std Arbitr. Field

 

Ext Arbitr. Field

 

 

 

 

 

 

 

 

 

 

Ctrl Field

Data Field

 

 

 

 

 

12

 

 

 

 

 

 

20

 

 

 

 

 

 

6

 

 

 

8 * N

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EXID[28:18]

 

 

 

 

EXID[17:0]

 

 

 

 

DLC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Inter-Frame Space

or Overload Frame

Ack Field

2

7

EOF

ACK

Inter-Frame Space or Overload Frame

CRC Field Ack Field 2

16 7 CRC EOF

SOF

SRR IDE

RTR r1

r0

 

Inter-Frame Space

Remote Frame (Standard identifier)

 

 

 

 

44

 

 

Arbitration Field

Ctrl Field

CRC Field

Ack Field

12

 

6

 

16

2

 

 

7

STID[10:0]

 

DLC

 

CRC

EOF

SOF

RTR IDE/r1

r0

 

 

 

ACK

Inter-Frame Space

 

Remote Frame (Extended identifier)

 

 

 

 

 

64

 

Std Arbitr. Field

Ext Arbitr. Field

Ctrl Field

CRC Field

12

 

20

 

 

6

16

EXID[28:18]

 

EXID[17:0]

 

 

DLC

CRC

SOF

SRR IDE

 

RTR r1

r0

 

ACK

Inter-Frame Space or Overload Frame

Inter-Frame Space or Overload Frame

Ack Field

2

7

EOF

ACK

Data Frame or

 

 

 

 

 

 

 

 

 

 

Inter-Frame Space

Remote Frame

Error Frame

 

 

 

or Overload Frame

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Error

Flag Echo Error Delimiter

 

 

 

 

 

 

 

Flag

 

 

 

 

 

 

 

 

 

 

 

 

 

8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Data Frame or

Any Frame

 

Inter-Frame Space

Remote Frame

Intermission

 

Suspend

Bus Idle

 

Transmission

 

3

 

 

8

 

 

 

 

 

 

 

End Of Frame or

 

 

 

 

 

Error Delimiter or

 

Overload Frame

Inter-Frame Space

Overload Delimiter

 

or Error Frame

Overload

Flag

Overload

 

Flag

 

Echo

Delimiter

 

 

6

 

8

 

1.Legend:

0 <= N <= 8

384/454

Doc ID 14587 Rev 9

Соседние файлы в папке Минимум документации STM8_1