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

RM0016

Controller area network (beCAN)

 

 

23.11.10 CAN error interrupt enable register (CAN_EIER)

Address offset: See Table 71.

Reset value: 0000 0000 (00h)

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

ERRIE

 

 

LECIE

 

BOFIE

EPVIE

EWGIE

 

Reserved

 

 

Reserved

 

 

 

rw

 

rw

rw

rw

rw

 

 

 

 

 

 

 

 

 

 

 

Bit 7 ERRIE Error interrupt enable

0:No interrupt is generated when an error condition is pending in the CAN_ESR (ERRI bit in CAN_MSR is set).

1:An interrupt is generated when an error condition is pending in the CAN_ESR (ERRI bit in CAN_MSR is set).

Refer to Figure 156 for more details.

Bit 6:5 Reserved.

Bit 4 LECIE Last error code interrupt enable

0:ERRI bit is not set when the error code in LEC[2:0] is set by hardware on error detection.

1:ERRI bit is set when the error code in LEC[2:0] is set by hardware on error detection.

Bit 3 Reserved.

Bit 2 BOFIE Bus-Off interrupt enable

0:ERRI bit is not set when BOFF is set.

1:ERRI bit is set when BOFF is set.

Bit 1 EPVIE Error passive interrupt enable

0:ERRI bit is not set when EPVF is set.

1:ERRI bit is set when EPVF is set.

Bit 0 EWGIE Error warning interrupt enable

0:ERRI bit is not set when EWGF is set.

1:ERRI bit is set when EWGF is set.

23.11.11CAN transmit error counter register (CAN_TECR)

Address offset: See Table 71.

Reset value: 0000 0000 (00h)

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

TEC[7:0]

 

 

 

 

 

 

 

 

 

 

 

 

r

r

r

r

 

r

r

r

r

 

 

 

 

 

 

 

 

 

Bits 7:0 TEC[7:0] Transmit error counter

In case of an error during transmission, this counter is incremented by 8 depending on the error condition as defined by the CAN standard. After every successful transmission the counter is decremented by 1 or reset to 0 if the CAN controller exited from bus-off to error active state. When the counter value exceeds 127, the CAN controller enters the error passive state. When the counter value exceeds 255, the CAN controller enters the bus-off state.

Doc ID 14587 Rev 9

395/454

Controller area network (beCAN)

RM0016

 

 

23.11.12 CAN receive error counter register (CAN_RECR)

Address offset: See Table 71.

Reset value: 0000 0000 (00h)

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

REC[7:0]

 

 

 

 

 

 

 

 

 

 

 

 

r

r

r

r

 

r

r

r

r

 

 

 

 

 

 

 

 

 

Bits 7:0 REC[7:0] Receive error counter

This is the Receive Error Counter implementing part of the fault confinement mechanism of the CAN protocol. In case of an error during reception, this counter is incremented by 1 or by 8 depending on the error condition as defined by the CAN standard. After every successful reception the counter is decremented by 1 or reset to 120 if its value was higher than 128. When the counter value exceeds 127, the CAN controller enters the error passive state.

23.11.13 CAN bit timing register 1 (CAN_BTR1)

Address offset: See Table 71.

Reset value: 0100 0000 (40h)

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

SJW[1:0]

 

 

 

BRP[5:0]

 

 

 

 

 

 

 

 

 

 

 

 

rw

 

rw

rw

rw

rw

 

rw

rw

rw

 

 

 

 

 

 

 

 

 

 

This register can only be accessed by the software when the CAN hardware is in initialization mode.

Bits 7:6 SJW[1:0] Resynchronization jump width

These bits define the maximum number of time quanta the CAN hardware is allowed to lengthen or shorten a bit to perform the resynchronization. Resynchronization Jump Width = (SJW+1).

Bits 5:0 BRP[5:0] Baud rate prescaler

These bits define the length of a time quantum. tq = (BRP+1)/fMASTER

396/454

Doc ID 14587 Rev 9

RM0016

Controller area network (beCAN)

 

 

23.11.14 CAN bit timing register 2 (CAN_BTR2)

Address offset: See Table 71.

Reset value: 0x23

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

BS2[2:0]

 

 

 

BS1[3:0]

 

Reserved

 

 

 

 

 

 

 

 

 

rw

rw

rw

rw

rw

 

rw

rw

 

 

 

 

 

 

 

 

 

This register can only be accessed by the software when the CAN hardware is in initialization mode.

Bit 7 Reserved, must be kept cleared.

Bits 6:4 BS2[2:0] Bit Segment 2

These bits define the number of time quanta in Bit Segment 2.

Bit Segment 2 = (BS2+1)

Bits 3:0 BS1[3:0] Bit Segment 1

These bits define the number of time quanta in Bit Segment 1

Bit Segment 1 = (BS1+1)

For more information on bit timing, please refer to Section 23.6.6: Bit timing.

Doc ID 14587 Rev 9

397/454

Controller area network (beCAN)

RM0016

 

 

23.11.15 Mailbox registers

This chapter describes the registers of the transmit and receive mailboxes. Refer to

Section 23.6.4: Message storage for detailed register mapping.

Transmit and receive mailboxes have the same registers except:

CAN_MCSR register in a transmit mailbox is replaced by CAN_MFMIR register in a receive mailbox.

A receive mailbox is always write protected.

A transmit mailbox is write enabled only while empty (the corresponding TME bit in the CAN_TPR register is set).

Caution: As the mailbox registers usually have no defined reset value, the user should not rely on the initial setup and should always fill all the configuration bits accordingly.

CAN message control/status register (CAN_MCSR)

Address offset: See Table 66. and Table 67.

Reset value: 0x00

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

TERR

ALST

TXOK

RQCP

ABRQ

TXRQ

 

Reserved

 

 

 

 

 

 

 

r

r

r

rc_w1

rs

rs

 

 

 

 

 

 

 

 

 

 

Note:

This register is implemented only in transmit mailboxes. In receive mailboxes, the

 

CAN_MFMIR register is mapped at this location.

Bits 7:6

Reserved.

Bit 5

TERR Transmission error

 

This bit is updated by hardware after each transmission attempt.

 

0: The previous transmission was successful

 

1: The previous transmission failed due to an error

Bit 4 ALST Arbitration lost

This bit is updated by hardware after each transmission attempt.

0:The previous transmission was successful

1:The previous transmission failed due to an arbitration lost

Bit 3 TXOK Transmission OK

The hardware updates this bit after each transmission attempt.

0:The previous transmission failed

1:The previous transmission was successful

Note: This bit has the same value as the corresponding TXOKx bit in the CAN_TSR register.

Bit 2 RQCP Request completed

Set by hardware when the last request (transmit or abort) has been performed.

Cleared by software writing a “1” or by hardware on transmission request.

Note: This bit has the same value as the corresponding RQCPx bit of the CAN_TSR register. Clearing this bit clears all the status bits (TXOK, ALST and TERR) in the CAN_MCSR register and the corresponding RQCPx and TXOKx bits in the CAN_TSR register.

398/454

Doc ID 14587 Rev 9

RM0016

 

 

 

 

 

 

 

Controller area network (beCAN)

 

 

 

 

 

 

 

 

 

 

 

 

Bit 1

ABRQ Abort request for mailbox

 

 

 

 

 

 

 

 

 

Set by software to abort the transmission request for the corresponding mailbox.

 

 

Cleared by hardware when the mailbox becomes empty.

 

 

 

 

 

 

Setting this bit has no effect when the mailbox is not pending for transmission.

 

Bit 0

TXRQ Transmit mailbox request

 

 

 

 

 

 

 

 

 

Set by software to request the transmission for the corresponding mailbox.

 

 

 

 

Cleared by hardware when the mailbox becomes empty.

 

 

 

 

 

 

CAN mailbox filter match index register (CAN_MFMIR)

 

 

 

 

Address offset: See Table 66. and Table 67.

 

 

 

 

 

 

 

Reset value: 0xXX

 

 

 

 

 

 

 

 

 

 

7

6

 

5

 

4

 

3

2

 

1

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FMI[7:0]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

r

r

 

r

 

r

 

r

r

 

r

 

r

 

 

 

 

 

 

 

 

 

Note:

This register is implemented only in receive mailboxes. In transmit mailboxes, the

 

 

CAN_MCSR register is mapped at this location.

 

 

 

 

 

Bits 7:0 FMI[7:0] Filter match index

This register contains the index of the filter the message stored in the mailbox passed through. For more details on identifier filtering please refer to Section 23.6.3: Identifier filtering - Filter Match Index paragraph.

Doc ID 14587 Rev 9

399/454

Controller area network (beCAN)

RM0016

 

 

CAN mailbox identifier register 1 (CAN_MIDR1)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

 

1

0

 

IDE

RTR

 

 

STID[10:6] / EXID[28:24]

 

 

Reserved

 

 

 

 

 

 

 

 

 

 

rw

rw

rw

rw

 

rw

 

rw

rw

 

 

 

 

 

 

 

 

 

 

Bit 7 Reserved.

Bit 6 IDE Extended identifier

This bit defines the identifier type of message in the mailbox.

0:Standard identifier.

1:Extended identifier.

Bit 5 RTR Remote transmission request

0:Data frame

1:Remote frame

Bits 4:0 STID[10:6] Standard identifier

5 most significant bits of the standard part of the identifier.

or

EXID[28:24] Extended identifier

5 most significant bits of the “Base” part of extended identifier.

CAN mailbox identifier register 2 (CAN_MIDR2)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

 

 

STID[5:0] / EXID[23:18]

 

 

 

EXID[17:16]

 

 

 

 

 

 

 

 

 

rw

rw

rw

rw

rw

rw

rw

 

rw

 

 

 

 

 

 

 

 

 

Bits 7:2 STID[5:0] Standard Identifier

6 least significant bits of the standard part of the identifier.

or

EXID[23:18] Extended Identifier

6 least significant bits of the “Base” part of extended identifier.

Bits 1:0 EXID[17:16] Extended Identifier

2 most significant bits of the “Extended” part of the extended identifier.

400/454

Doc ID 14587 Rev 9

RM0016

Controller area network (beCAN)

 

 

CAN mailbox identifier register 3 (CAN_MIDR3)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

 

 

 

 

EXID[15:8]

 

 

 

 

 

 

 

 

 

 

 

 

rw

rw

rw

rw

 

rw

rw

rw

rw

 

 

 

 

 

 

 

 

 

Bits 7:0 EXID[15:8] Extended identifier

Bit 15 to 8 of the “Extended” part of the extended identifier.

CAN mailbox identifier register 4 (CAN_MIDR4)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

 

 

 

 

EXID[7:0]

 

 

 

 

 

 

 

 

 

 

 

 

rw

rw

rw

rw

 

rw

rw

rw

rw

 

 

 

 

 

 

 

 

 

Bits 7:0 EXID[7:0] Extended identifier

8 least significant bits of the “Extended” part of the extended identifier.

CAN mailbox data length control register (CAN_MDLCR)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

TGT

 

 

 

 

 

DLC[3:0]

 

 

 

Reserved

 

 

 

 

 

 

rw

 

 

 

rw

rw

 

rw

rw

 

 

 

 

 

 

 

 

 

Bit 7 TGT Transmit global time

This bit should be used only when the hardware is in the Time Trigger Communication mode, TTCM bit in the CAN_MCR register is set. It must be cleared by user in Normal mode to transfer last two data bytes correctly

0:CAN_MTSRH and CAN_MTSRL registers are not sent.

1:CAN_MTSRH and CAN_MTSRL registers are sent in the last two data bytes of the message.

Bits 6:4 Reserved.

Bits 3:0 DLC[3:0] Data length code

This field defines the number of data bytes in a data frame or a remote frame request.

Doc ID 14587 Rev 9

401/454

Controller area network (beCAN)

RM0016

 

 

CAN mailbox data register x (CAN_MDAR) (x= 1 .. 8)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

 

 

 

 

DATA[7:0]

 

 

 

 

 

 

 

 

 

 

 

 

rw

rw

rw

rw

 

rw

rw

rw

rw

 

 

 

 

 

 

 

 

 

Bits 7:0 DATA[7:0] Data

A data byte of the message. A message can contain from 0 to 8 data bytes.

Note: These bits are write protected when the mailbox is not in empty state.

CAN mailbox time stamp register low (CAN_MTSRL)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

TIME[7:0]

 

 

 

 

 

 

 

 

 

 

 

 

r

r

r

r

 

r

r

r

r

 

 

 

 

 

 

 

 

 

Bits 7:0 TIME[7:0] Message time stamp low

This field contains the low byte of the 16-bit timer value captured at the SOF detection.

CAN mailbox time stamp register high (CAN_MTSRH)

Address offset: See Table 66. and Table 67.

Reset value: 0xXX

7

6

5

4

3

2

1

0

 

 

 

 

TIME[15:8]

 

 

 

 

 

 

 

 

 

 

 

 

r

r

r

r

 

r

r

r

r

 

 

 

 

 

 

 

 

 

Bits 7:0 TIME[15:8] Message time stamp high

This field contains the high byte of the 16-bit timer value captured at the SOF detection.

402/454

Doc ID 14587 Rev 9

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