526
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
The software can set CAN_MCTRL.INIRQ and CAN_MCTRL.SLPRQ bit to configure CAN to enter
initialization
or
sleep
mode. The software reads values of the CAN_MSTS.INIAK or CAN_MSTS.SLPAK bit to confirm
whether the
initialization
or
sleep
mode is entered, at this time the internal pull-up resistor of the CANTX pin is
disabled.
CAN is in
normal
mode when CAN_MSTS.INIAK and CAN_MSTS.SLPAK bits are both '0', and it must
synchronize
with CAN bus to enter
normal
mode. When 11 consecutive recessive bits are monitored on the CANRX
pin, the CAN bus is idle and synchronization is completed.
Normal mode
After the initialization is completed, the software configures CAN to enter normal mode. Clear the
CAN_MCTRL.INIRQ and wait for the hardware to clear the CAN_MSTS.INIRQ bit to confirm that CAN enters
normal mode. Only after the synchronization with CAN bus is completed, CAN can receive and send messages
normally.
Setting the bit width and mode of the filter group must be completed when the filter is in the initialization mode (the
CAN_FMC.FINITM bit is 1). Setting the initial value of the filter must be completed when it is inactive (the
corresponding CAN_FA1.FAC bit is 0).
Initialization mode
The software can perform initialization configuration only when CAN is in initialization mode. Set the
CAN_MCTRL.INIRQ bit and clear CAN_MCTRL.SLPRQ bit, and wait for the hardware to set the
CAN_MSTS.INIAK bit to confirm that CAN enters the initialization mode. When entering the initialization mode,
the register configuration will not be affected. When CAN is in initialization mode, message receiving and sending
are prohibited, and the CANTX pin outputs a recessive bit (high level). To exit initialization mode, clear the
CAN_MCTRL.INIRQ bit, and wait for the hardware to clear the CAN_MSTS.INIAK bit to confirm that CAN exits
the initialization mode.
To perform initialization configuration for CAN by software, at least the bit time characteristic register (CAN_BTIM)
and the control register (CAN_MCTRL) need to be configured. The software needs to set the CAN_FMC.FINITM
bit to initialize the filter group (mode, bit width, FIFO association, activation and filter value) that configures CAN.
Configuring the filter group of CAN does not necessarily need to be in initialization mode.
Specially,when CAN_FMC.FINITM=1, it is forbidden to receive messages. If you want to modify the value of the
corresponding filter, you need to first clear the filter activation bit (in CAN_FA1). It is necessary to keep the unused
filter group inactive (keep its CAN_FA1.FAC bit to '0').
Sleep mode (low power)
To enters sleep mode, set the CAN_MCTRL.SLPRQ bit, and wait for the hardware to set the CAN_MSTS.SLPAK
bit to confirm that CAN enters sleep mode. CAN can configure to sleep modeto reduce power consumption when
unused. In sleep mode, the clock of CAN stops working, but the software can still access the sending/receiving
mailbox register. When CAN is in sleep mode, the CAN_MCTRL.INIRQ bit must be set and the
CAN_MCTRL.SLPRQ bit must be clear at the same time so as to enter the initialization mode.
There are two situation to wake up CAN(CAN exits sleep mode):
When the CAN_MCTRL.AWKUM bit is set(enable hardware wake up automatically), once the activity of the
CAN bus is detected, the hardware will automatically clear the CAN_MSTS.SLPRQ bit to wake up CAN.