Information

FlexCAN. CPU must maintain data coherency in the FIFO
region when RFEN is asserted.
45.4.6.3 Mailbox lock mechanism
Other than Mailbox inactivation, FlexCAN has another data coherence mechanism for the
receive process. When the CPU reads the Control and Status word of an Rx MB with
codes FULL or OVERRUN, FlexCAN assumes that the CPU wants to read the whole
MB in an atomic operation, and therefore it sets an internal lock flag for that MB. The
lock is released when the CPU reads the Free Running Timer (global unlock operation),
or when it reads the Control and Status word of another MB regardless of its code. A
CPU write into C/S word also unlocks the MB, but this procedure is not recommended
for normal unloack use because it cancels a pending-move and potentially may lose a
received message. The MB locking is done to prevent a new frame to be written into the
MB while the CPU is reading it.
NOTE
The locking mechanism applies only to Rx MBs that are not
part of FIFO and have a code different than INACTIVE
(0b0000) or EMPTY
1
(0b0100). Also, Tx MBs can not be
locked.
Suppose, for example, that the FIFO is disabled and the second and the fifth MBs of the
array are programmed with the same ID, and FlexCAN has already received and stored
messages into these two MBs. Suppose now that the CPU decides to read MB number 5
and at the same time another message with the same ID is arriving. When the CPU reads
the Control and Status word of MB number 5, this MB is locked. The new message
arrives and the matching algorithm finds out that there are no "free-to-receive" MBs, so it
decides to override MB number 5. However, this MB is locked, so the new message can
not be written there. It will remain in the SMB waiting for the MB to be unlocked, and
only then will be written to the MB.
If the MB is not unlocked in time and yet another new message with the same ID arrives,
then the new message overwrites the one on the SMB and there will be no indication of
lost messages either in the CODE field of the MB or in the Error and Status Register.
While the message is being moved-in from the SMB to the MB, the BUSY bit on the
CODE field is asserted. If the CPU reads the Control and Status word and finds out that
the BUSY bit is set, it should defer accessing the MB until the BUSY bit is negated.
1. In previous FlexCAN versions, reading the C/S word locked the MB even if it was
EMPTY. This behavior is maintained when the IRMQ bit is negated.
Functional description
K20 Sub-Family Reference Manual, Rev. 1.1, Dec 2012
1164
Preliminary
Freescale Semiconductor, Inc.
General Business Information