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

RM0016

Controller area network (beCAN)

 

 

Figure 142. beCAN operating modes

 

 

 

Reset

 

 

 

 

Sleep

 

 

 

 

SLAK = 1

 

 

 

 

INAK = 0

 

 

 

IN

S

 

 

 

.

 

 

 

 

C

 

 

 

 

N

 

 

 

 

Y

 

 

 

S

S

 

 

.

K

 

 

 

L

 

 

 

C

E

 

 

 

A

E

 

 

 

.

P

C

 

 

 

.

S

 

P

K

 

I

 

 

E

 

 

 

 

E

 

 

 

 

L

 

 

 

 

S

 

.

 

 

 

 

A

 

 

 

 

C

Normal

 

 

 

K

 

 

INRQ . ACK

Initialization

SLAK = 0

 

 

 

SLAK = 0

INAK = 0

 

 

 

INAK = 1

 

 

 

INRQ . SYNC . SLEEP

 

23.4Operating modes

beCAN has three main operating modes: Initialization, Normal and Sleep. After a hardware reset, beCAN is in sleep mode to reduce power consumption. The software requests beCAN to enter Initialization or Sleep mode by setting the INRQ or SLEEP bits in the CAN_MCR register. Once the mode has been entered, beCAN confirms it by setting the INAK or SLAK bits in the CAN_MSR register. When neither INAK nor SLAK are set, beCAN is in Normal mode. Before entering Normal mode beCAN always has to synchronize on the CAN bus. To synchronize, beCAN waits until the CAN bus is idle, this means 11 consecutive recessive bits have been monitored on CANRX.

23.4.1Initialization mode

The software initialization can be done while the hardware is in Initialization mode. To enter this mode the software sets the INRQ bit in the CAN_MCR register and waits until the hardware has confirmed the request by setting the INAK bit in the CAN_MSR register.

To leave Initialization mode, the software clears the INQR bit. beCAN has exit Initialization mode once the INAK bit has been cleared by hardware. However the Rx line has to be in recessive state to leave this mode.

While in Initialization mode, all message transfers to and from the CAN bus are stopped and the status of the CAN bus output CANTX is recessive (high).

Entering Initialization Mode does not change any of the configuration registers.

To initialize the CAN Controller, software has to set up the Bit Timing registers and the filter banks. If a filter bank is not used, it is recommended to leave it non active (leave the corresponding FACT bit in the CAN_FCRx register cleared).

Doc ID 14587 Rev 9

367/454

Controller area network (beCAN)

RM0016

 

 

23.4.2Normal mode

Once the initialization has been done, the software must request the hardware to enter Normal mode, to synchronize on the CAN bus and start reception and transmission. This request to enter Normal mode is done by clearing the INRQ bit in the CAN_MCR register. Afterwards, the beCAN is synchronized with the data transfer on the CAN bus by waiting for the occurrence of a sequence of 11 consecutive recessive bits (Bus Idle state) before finishing the switch to Normal mode and being ready to take part in bus activities. The switch completion is confirmed by hardware by clearing the INAK bit in the CAN_MSR register.

The initialization of the filter values is independent from Initialization mode but must be done while the filter bank is not active (corresponding FACTx bit cleared). The filter bank scale and mode configuration must be configured in initialization mode.

23.4.3Sleep mode (low power)

 

To reduce power consumption, beCAN has a low power mode called Sleep mode. This

 

mode is entered on software request by setting the SLEEP bit in the CAN_MCR register. In

 

this mode, the beCAN clock is stopped, however software can still access the beCAN

 

mailboxes.

Note:

If software requests entry to initialization mode by setting the INRQ bit while beCAN is in

 

sleep mode, it must also clear the SLEEP bit.

 

beCAN can be woken up (exit Sleep mode) either by software clearing the SLEEP bit or on

 

detection of CAN bus activity.

 

On CAN bus activity detection, hardware automatically performs the wakeup sequence by

 

clearing the SLEEP bit if the AWUM bit in the CAN_MCR register is set. If the AWUM bit is

 

cleared, software has to clear the SLEEP bit when a wakeup interrupt occurs, in order to exit

 

from sleep mode.

Note:

If the wakeup interrupt is enabled (WKUIE bit set in CAN_IER register) a wakeup interrupt

 

will be generated on detection of CAN bus activity, even if the beCAN automatically

 

performs the wakeup sequence.

 

After the SLEEP bit has been cleared, Sleep mode is exited once beCAN has synchronized

 

with the CAN bus, refer to Figure 142: beCAN operating modes. However the Rx line has to

 

be in recessive state to leave this mode. Sleep mode is exited once the SLAK bit has been

 

cleared by hardware.

23.4.4 Time triggered communication mode

The TTCM (Time Triggered Communication Mode in CAN_MCR) bit has to be set to enable the Time Triggered Communication mechanism.

In this mode, the internal counter of the CAN hardware is activated and used to generate the Time Stamp value stored in the CAN_MTSRH and CAN_MTSRL registers (for Rx and Tx mailboxes). The internal counter is captured on the sample point of the Start Of Frame bit in both reception and transmission.

The TGT bit (Transmit Global Time in CAN_MDLCR) enables automatic transmission of the contents of both CAN_MTSRH and CAN_MTSRL in the two last data bytes of the message (refer to the TTCAN specification ISO 11898-4).

368/454

Doc ID 14587 Rev 9

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