![Freescale Semiconductor ColdFire MCF5211 Скачать руководство пользователя страница 460](http://html1.mh-extra.com/html/freescale-semiconductor/coldfire-mcf5211/coldfire-mcf5211_reference-manual_2330619460.webp)
FlexCAN
MCF5213 ColdFire® Integrated Microcontroller Reference Manual, Rev. 3
25-22
Freescale Semiconductor
25.3.14 Receive Process
The CPU prepares or changes an MB for frame reception by writing the following:
1. Control/status word to hold Rx MB inactive (CODE = 0000)
2. ID word
3. Control/status word to mark the Rx MB as active and empty (CODE = 1000)
NOTE
The first and last steps are mandatory.
The first write to the control/status word is important in case there was a pending reception or transmission.
The write operation immediately deactivates the MB, removing it from any currently ongoing arbitration
or matching process, giving time for the CPU to program the rest of the MB. After the MB is activated in
the third step, it is able to receive CAN frames that match the programmed ID. At the end of a successful
reception, the value of the free running timer (TIMER) is written into the time stamp field, the received
ID, data (8 bytes at most) and length fields are stored, the CODE field in the control and status word is
updated (see
), and a status flag is set in the IFLAG register and an interrupt is generated if
allowed by the corresponding IMASK bit.
The CPU should read a receive frame from its MB by reading the following:
1. Control/status word (mandatory—activates internal lock for this buffer)
2. ID (optional—needed only if a mask was used)
3. Data field words
4. Free-running timer (Releases internal lock —optional)
Upon reading the control and status word, 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. Reading the free running timer is not mandatory. If not
executed the MB remains locked, unless the CPU reads the C/S word of another MB. Only a single MB is
locked at a time. The only mandatory CPU read operation is the one on the control and status word to
assure data coherency.
The CPU should synchronize to frame reception by an IFLAG bit for the specific MB (see
“Interrupt Flag Register (IFLAG)”
), and not by the control/status word CODE field for 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 does not return to EMPTY. It
remains FULL, as explained in
. If the CPU tries to workaround 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 directly reading the C/S word of the MBs. Instead, read the IFLAG
register.
The received identifier field is always stored in the matching MB, thus the contents of the ID field in an
MB may change if the match was due to masking.
Содержание ColdFire MCF5211
Страница 48: ...Overview MCF5213 ColdFire Integrated Microcontroller Reference Manual Rev 3 1 14 Freescale Semiconductor...
Страница 158: ...Reset Controller Module MCF5213 ColdFire Integrated Microcontroller Reference Manual Rev 3 9 10 Freescale Semiconductor...
Страница 218: ...Edge Port Module EPORT MCF5213 ColdFire Integrated Microcontroller Reference Manual Rev 3 13 8 Freescale Semiconductor...
Страница 234: ...DMA Controller Module MCF5213 ColdFire Integrated Microcontroller Reference Manual Rev 3 14 16 Freescale Semiconductor...
Страница 378: ...I2 C Interface MCF5213 ColdFire Integrated Microcontroller Reference Manual Rev 3 22 16 Freescale Semiconductor...
Страница 468: ...FlexCAN MCF5213 ColdFire Integrated Microcontroller Reference Manual Rev 3 25 30 Freescale Semiconductor...