Preface
MPC5565 Microcontroller Reference Manual, Rev. 1.0
21-26
Freescale Semiconductor
The CPU should read an RX frame from its MB in the following way:
•
Control and status word (mandatory, activates internal lock for this buffer)
•
ID (optional, needed only if a mask was used)
•
DATA field words
•
Free running timer (optional, releases internal lock)
Reading the free running timer is not mandatory. If not executed, the MB remains locked, unless the CPU
starts reading another MB. Note that only a single MB is locked at a time. The only mandatory CPU read
operation is of the control and status word, to assure data coherency. If the BUSY bit is set in the CODE
field, then the CPU should defer the access to the MB until this bit is negated.
The CPU should synchronize to frame reception by the status flag bit for the specific MB in one of the
CANx_IFRH and CANx_IFRL registers and not by the control and status word code field of that MB.
Polling the CODE field does not work because after a frame was received and the CPU services the MB
(by reading the C/S word followed by unlocking the MB), the CODE field will not return to EMPTY. It
will remain FULL, as explained in
. If the CPU tries to work around this behavior by writing to
the C/S word to force an EMPTY code after reading the MB, the MB is actually deactivated from any
currently ongoing matching process. As a result, a newly received frame matching the ID of that MB may
be lost. In summary: never do polling by reading directly the C/S word of the MBs. Instead, read the
CANx_IFRH and CANx_IFRL registers.
Note that the received ID field is always stored in the matching MB, thus the contents of the ID field in a
MB can change if the match was due to mask.
21.4.3.2
Reception Queue
A queue of received messages can be implemented that allows the CPU more time for servicing MBs. By
programming more than one MB with the same ID, received messages will be queued into the MBs.
Matching to a range of IDs is possible by using ID acceptance masks that mask individual MBs. During
the matching algorithm, if a mask bit is asserted, then the corresponding ID bit is compared. If the mask
bit is negated, the corresponding ID bit is a don’t care.
Suppose, for example, that the second and fifth MBs in an array have the same ID, and FlexCAN starts
receiving messages with that ID. When FlexCAN receives the first message, the matching algorithm
matches it to MB number 2. The code of this MB is EMPTY, so the message is stored there. When the
second message arrives, the matching algorithm will find MB number 2 again, but it is not free to receive
1
,
so it will keep looking and find MB number 5 and store the message there. If yet another message with the
same ID arrives, the matching algorithm perceives that there are no matching MBs that are free to receive
so it decides to overwrite the last matched MB, which is number 5. In doing so, it sets the Code field of
the MB to indicate OVERRUN.
In this manner, a reception queue is built, with messages temporally ordered by the CPU’s reading of each
MB’s time stamp field. This functionality is set by asserting the CAN
x
_MCR[MBFEN] bit. Note that the
RXIMR
n
registers are implemented in RAM, so they are not initialized out of reset. Also, they can only
be programmed if the MBFEN bit is asserted and while the module is in freeze mode.
1. If, however, the CPU has read the MB2 data and released it before the next matching process at the CRC frame, then, even if
the MB2 RX code is FULL, the MB2 is free to receive and the message will be stored in MB2 rather than in MB5.
Содержание MPC5565
Страница 18: ...MPC5565 Microcontroller Reference Manual Devices Supported MPC5565 MPC5565 RM Rev 1 0 09 2007...
Страница 34: ...MPC5565 Reference Manual Rev 1 0 Freescale Semiconductor 15...
Страница 35: ...MPC5565 Reference Manual Rev 1 0 16 Freescale Semiconductor...
Страница 325: ...Error Correction Status Module ECSM MPC5565 Microcontroller Reference Manual Rev 1 0 8 16 Freescale Semiconductor...
Страница 515: ...External Bus Interface EBI MPC5565 Microcontroller Reference Manual Rev 1 0 12 70 Freescale Semiconductor...
Страница 553: ...Flash Memory MPC5565 Microcontroller Reference Manual Rev 1 0 13 38 Freescale Semiconductor...
Страница 559: ...SRAM MPC5565 Microcontroller Reference Manual Rev 1 0 14 6 Freescale Semiconductor...
Страница 577: ...Boot Assist Module BAM MPC5565 Microcontroller Reference Manual Rev 1 0 15 18 Freescale Semiconductor...
Страница 895: ...Deserial Serial Peripheral Interface DSPI MPC5565 Microcontroller Reference Manual Rev 1 0 19 72 Freescale Semiconductor...
Страница 973: ...Preface MPC5565 Microcontroller Reference Manual Rev 1 0 21 36 Freescale Semiconductor...
Страница 1145: ...MPC5565 Register Map MPC5565 Microcontroller Reference Manual Rev 1 0 A 60 Freescale Semiconductor...
Страница 1153: ...Calibration MPC5565 Microcontroller Reference Manual Rev 1 0 B 8 Freescale Semiconductor...