FlexCAN
MPC5606S Microcontroller Reference Manual, Rev. 7
698 Freescale Semiconductor
18.4.2 Transmit process
In order to transmit a CAN frame, the CPU must prepare a Message Buffer for transmission by executing
the following procedure:
1. If the MB is active (transmission pending), 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 IFRL/IFRH registers to check if the transmission was aborted (see Section 18.4.6.1,
Transmission abort mechanism). If backwards compatibility is desired (AEN in MCR negated),
just write 1000 to the Code field to inactivate the MB, but be aware that in this case the pending
frame may be transmitted without notification (see Section 18.4.6.2, Message Buffer deactivation).
2. Write the ID word.
3. Write the data bytes.
4. Write the Length, Control, and Code fields of the Control and Status word to activate the MB.
Once the MB is activated in the fourth step, it will participate in the arbitration process and eventually be
transmitted according to its priority. At the end of the successful transmission, the value of the Free
Running Timer is written into the Time Stamp field, the Code field in the Control and Status word is
updated, a status flag is set in the Interrupt Flag Register, and an interrupt is generated if allowed by the
corresponding Interrupt Mask Register bit. The new Code field after transmission depends on the code that
was used to activate the MB in step four (see Table 18-5 and Table 18-6 in Section 18.3.2, Message Buffer
structure). When the Abort feature is enabled (AEN in MCR is asserted), after the Interrupt Flag is asserted
for a MB configured as transmit buffer, the MB is blocked—therefore the CPU is not able to update it until
the Interrupt Flag is negated by the CPU. It means that the CPU must clear the corresponding interrupt flag
bit before starting to prepare this MB for a new transmission or reception.
18.4.3 Arbitration process
The arbitration process is an algorithm executed by the MBM that scans the whole MB memory looking
for the highest priority message to be transmitted. All MBs programmed as transmit buffers will be
scanned to find the lowest ID
1
or the lowest MB number or the highest priority, depending on the LBUF
and LPRIO_EN bits on the Control Register. The arbitration process is triggered in the following events:
• During the CRC field of the CAN frame
• During the error delimiter field of the CAN frame
• During Intermission, if the winner MB defined in a previous arbitration was deactivated, or if there
was no MB to transmit, but the CPU wrote to the Control and Status word of any MB after the
previous arbitration finished
• When MBM is in Idle or Bus Off state and the CPU writes to the Control and Status 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. However,
1. Actually, if LBUF is negated, the arbitration considers not only the ID, but also the RTR and IDE bits placed inside the ID at the
same positions they are transmitted in the CAN frame.