Controller Area Network (FlexCAN)
MPC5510 Microcontroller Family Reference Manual, Rev. 1
25-30
Freescale Semiconductor
Preliminary
•
When MBM is in idle or bus off state and the CPU writes to the C/S word of any MB
•
Upon leaving freeze mode
When LBUF is asserted, the LPRIO_EN bit has no effect and the lowest number buffer is transmitted first.
When LBUF and LPRIO_EN are both negated, the MB with the lowest ID is transmitted first but. If LBUF
is negated and LPRIO_EN is asserted, the PRIO bits augment the ID used during the arbitration process.
With this extended ID concept, arbitration is done based on the full 32-bit ID and the PRIO bits define
which MB should be transmitted first, therefore MBs with PRIO = 000 have higher priority. If two or more
MBs have the same priority, the regular ID will determine the priority of transmission. If two or more MBs
have the same priority (3 extra bits) and the same regular ID, the lowest MB will be transmitted first.
Once the highest priority MB is selected, it is transferred to a temporary storage space called serial
message buffer (SMB), which has the same structure as a normal MB but is not user accessible. This
operation is called “move-out” and after it is done, write access to the corresponding MB is blocked (if the
AEN bit in CANx_MCR is asserted). The write access is released in the following events:
•
After the MB is transmitted
•
FlexCAN enters in HALT or BUS OFF
•
FlexCAN loses the bus arbitration or there is an error during the transmission
At the first opportunity window on the CAN bus, the message on the SMB is transmitted according to the
CAN protocol rules. FlexCAN transmits up to eight data bytes, even if the data length code (DLC) value
is bigger.
25.4.3
Receive Process
The CPU prepares a message buffer for frame reception by executing the following steps:
•
If the MB has a pending transmission, write an ABORT code (‘1001’) to the code field of the
control and status word to request an abortion of the transmission, then read back the code field
and the CANx_IFLAG1/2 register to check if the transmission was aborted (see
”). If backwards compatibility is desired (AEN in CANx_MCR
negated), just write ‘1000’ to the code field to inactivate the MB, but then the pending frame may
be transmitted without notification (see
Section 25.4.5.2, “Message Buffer Deactivation
”). If the
MB already programmed as a receiver, just write ‘0000’ to the code field of the control and status
word to keep the MB inactive.
•
Write the ID word.
•
Write ‘0100’ to the code field of the control and status word to activate the MB
After the MB is activated in the third step, it will be able to receive frames that match the programmed ID.
At the end of a successful reception, the MB is updated by the MBM as follows:
•
The value of the free-running timer is written into the time stamp field
•
The received ID, data (8 bytes at most), and length fields are stored
•
The code field in the control and status word is updated (see
in
Section 25.3.2, “Message Buffer Structure
•
A status flag is set in the interrupt flag register and an interrupt is generated if allowed by the
corresponding interrupt mask register bit