Freescale Semiconductor MCF5329 Reference Manual page 588

Devices supported: mcf5327; mcf5328; mcf53281; mcf5329
Table of Contents

Advertisement

FlexCAN
The purpose of deactivation is data coherency. The match/arbitration process scans the MBs to decide
which MB to transmit or receive. If the CPU updates the MB in the middle of a match or arbitration
process, the data of that MB may no longer be coherent; therefore, that MB is deactivated.
Even with the coherence mechanism described above, writing to the C/S word of active MBs when not in
freeze mode may produce undesirable results. Examples are:
Matching and arbitration are one-pass processes. If MBs are deactivated after they are scanned, no
re-evaluation is done to determine a new match/winner. If an Rx MB with a matching ID is
deactivated during the matching process after it was scanned, then this MB is marked as invalid to
receive the frame, and FlexCAN continues looking for another matching MB within the ones it has
not scanned yet. If it can not find one, the message is lost. Suppose, for example, that two MBs
have a matching ID to a received frame, and the user deactivated the first matching MB after
FlexCAN has scanned the second. The received frame is lost even if the second matching MB was
free to receive.
If a Tx MB containing the lowest ID is deactivated after the FlexCAN has scanned it, the FlexCAN
looks for another winner within the MBs that it has not yet scanned. Therefore, it may transmit an
MB that may not have the lowest ID at the time because a lower ID might be present that it had
already scanned before the deactivation.
There is a point in time until which the deactivation of a Tx MB causes it not to be transmitted (end
of move-out). After this point, it is transmitted, but no interrupt is issued and the CODE field is not
updated.
23.3.15.3 Locking and Releasing Message Buffers
Besides MB deactivation, FlexCAN has another data coherence mechanism for the receive process. When
the CPU reads the control and status word of an active not empty Rx MB, FlexCAN assumes that the CPU
wants to read the whole MB in an atomic operation, and thus 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. The MB locking is done to prevent a new frame to be written
into the MB while the CPU is reading it.
The locking mechanism only applies to Rx MBs which have a code different
than INACTIVE (0000) or EMPTY1 (0100). Also, Tx MBs can not be
locked.
Suppose, for example, that FlexCAN has already received and stored a message into one of the MBs.
Suppose now that the CPU decides to read that MB at the same time another message with the same ID
is arriving. When the CPU reads the control and status word, the MB is locked. The new message arrives
and the matching algorithm finds out that the matching MB is not free to receive It remains in the SMB
waiting for the MB to be unlocked, and only then, is it 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 is no indication of lost messages in the code field of the MB or in the error and status
register.
23-24
NOTE
MCF5329 Reference Manual, Rev 3
Freescale Semiconductor

Advertisement

Table of Contents
loading

Table of Contents