Controller Area Network (FlexCAN)
MPC5510 Microcontroller Family Reference Manual, Rev. 1
Freescale Semiconductor
25-29
Preliminary
Before proceeding with the functional description, an important concept must be explained. A message
buffer is said to be “active” at a given time if it can participate in the matching and arbitration algorithms
that are happening at that time. An Rx MB with a ‘0000’ code is inactive (refer to
a Tx MB with a ‘1000’ or ‘1001’ code is also inactive (refer to
‘0000’, ‘1000’ or ‘1001’ will be temporarily deactivated (will not participate in the current arbitration or
matching run) when the CPU writes to the C/S field of that MB (see
Section 25.4.5.2, “Message Buffer
25.4.1
Transmit Process
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 IFLAG1/2
register to check if the transmission was aborted (see
Section 25.4.5.1, “Transmission Abort Mechanism
”).
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
”).
•
Write the ID word.
•
Write the data bytes.
•
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 into 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
in Section
”). When the abort feature is enabled (AEN in CANx_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 be negated by CPU. It means that the CPU must clear the
corresponding CANx_IFLAG before starting to prepare this MB for a new transmission or reception.
25.4.2
Arbitration Process
This process selects which will be the next MB 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 C/S word of any MB after the previous arbitration
finished
1. 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.