Preface
MPC5565 Microcontroller Reference Manual, Rev. 1.0
21-34
Freescale Semiconductor
21.5
Initialization and Application Information
This section provides instructions for initializing the FlexCAN2 module.
21.5.1
FlexCAN2 Initialization Sequence
The FlexCAN2 module can be reset in three ways:
•
MCU-level hard reset, which resets all memory mapped registers asynchronously
•
MCU-level soft reset, which resets some of the memory mapped registers synchronously (refer to
for the registers affected by a soft reset)
•
SOFTRST bit in CAN
x
_MCR, which has the same effect as the MCU level soft reset
Soft reset is synchronous and has to follow an internal request/acknowledge procedure across clock
domains. Therefore, it may take some time to fully propagate its effects. The SOFTRST bit remains
asserted while soft reset is pending, so software can poll this bit to know when the reset has completed.
After the module is enabled (CAN
x
_MCR[MDIS] bit negated), FlexCAN2 should be put into freeze mode
before doing any configuration. In freeze mode, FlexCAN2 is un-synchronized to the CAN bus, the HALT
and FRZ bits in CAN
x
_MCR are set, the internal state machines are disabled and the FRZACK and
NOTRDY bits in the CAN
x
_MCR are set. The CNTX pin is in recessive state and FlexCAN2 does not
initiate frame transmission nor receives any frames from the CAN bus. Note that the message buffer
contents are not affected by reset, so they are not automatically initialized.
For any configuration change/initialization, it is required that FlexCAN2 is put into freeze mode (refer to
Section 21.4.6.1, “Freeze Mode
). The following is a generic initialization sequence applicable for the
FlexCAN2 module:
•
Initialize CANx_CR.
— Determine bit timing parameters: PROPSEG, PSEG1, PSEG2, RJW.
— Determine the bit rate by programming the PRESDIV field.
— Determine internal arbitration mode (LBUF bit).
•
Initialize message buffers.
— The control and status word of all message buffers may be written either as active or inactive.
— Other entries in each message buffer should be initialized as required.
•
Initialize CANx_MCR bits MBFEN, SRXDIS, and WRNEN.
•
The initialization of FlexCAN registers for either global or individual acceptance masking depends
on the configuration of MBFEN:
– If MBFEN is negated, initialize CANx_RXGMASK, CANx_RX14MASK, and
CANx_RX15MASK registers for acceptance mask.
– If MBFEN is asserted, initialize CANx_RXIMR[0-63] for individual acceptance masking.
•
Set required mask bits in CAN
x
_IMRH and CAN
x
_IMRL registers (for all MBs interrupts), and
in CAN
x
_CR (for bus off and error interrupts).
•
Negate the CAN
x
_MCR[HALT] bit.
Starting with this last event, FlexCAN2 attempts to synchronize with the CAN bus.
Содержание MPC5565
Страница 18: ...MPC5565 Microcontroller Reference Manual Devices Supported MPC5565 MPC5565 RM Rev 1 0 09 2007...
Страница 34: ...MPC5565 Reference Manual Rev 1 0 Freescale Semiconductor 15...
Страница 35: ...MPC5565 Reference Manual Rev 1 0 16 Freescale Semiconductor...
Страница 325: ...Error Correction Status Module ECSM MPC5565 Microcontroller Reference Manual Rev 1 0 8 16 Freescale Semiconductor...
Страница 515: ...External Bus Interface EBI MPC5565 Microcontroller Reference Manual Rev 1 0 12 70 Freescale Semiconductor...
Страница 553: ...Flash Memory MPC5565 Microcontroller Reference Manual Rev 1 0 13 38 Freescale Semiconductor...
Страница 559: ...SRAM MPC5565 Microcontroller Reference Manual Rev 1 0 14 6 Freescale Semiconductor...
Страница 577: ...Boot Assist Module BAM MPC5565 Microcontroller Reference Manual Rev 1 0 15 18 Freescale Semiconductor...
Страница 895: ...Deserial Serial Peripheral Interface DSPI MPC5565 Microcontroller Reference Manual Rev 1 0 19 72 Freescale Semiconductor...
Страница 973: ...Preface MPC5565 Microcontroller Reference Manual Rev 1 0 21 36 Freescale Semiconductor...
Страница 1145: ...MPC5565 Register Map MPC5565 Microcontroller Reference Manual Rev 1 0 A 60 Freescale Semiconductor...
Страница 1153: ...Calibration MPC5565 Microcontroller Reference Manual Rev 1 0 B 8 Freescale Semiconductor...