|
MC9S08DZ60MLH Datasheet, PDF (253/416 Pages) Freescale Semiconductor, Inc – Microcontrollers | |||
|
◁ |
Chapter 12 Freescaleâs Controller Area Network (S08MSCANV1)
The MSCAN then schedules the message for transmission and signals the successful transmission of the
buffer by setting the associated TXE ï¬ag. A transmit interrupt (see Section 12.5.7.2, âTransmit Interruptâ)
is generated1 when TXEx is set and can be used to drive the application software to re-load the buffer.
If more than one buffer is scheduled for transmission when the CAN bus becomes available for arbitration,
the MSCAN uses the local priority setting of the three buffers to determine the prioritization. For this
purpose, every transmit buffer has an 8-bit local priority ï¬eld (PRIO). The application software programs
this ï¬eld when the message is set up. The local priority reï¬ects the priority of this particular message
relative to the set of messages being transmitted from this node. The lowest binary value of the PRIO ï¬eld
is deï¬ned to be the highest priority. The internal scheduling process takes place whenever the MSCAN
arbitrates for the CAN bus. This is also the case after the occurrence of a transmission error.
When a high priority message is scheduled by the application software, it may become necessary to abort
a lower priority message in one of the three transmit buffers. Because messages that are already in
transmission cannot be aborted, the user must request the abort by setting the corresponding abort request
bit (ABTRQ) (see Section 12.3.8, âMSCAN Transmitter Message Abort Request Register
(CANTARQ)â.) The MSCAN then grants the request, if possible, by:
1. Setting the corresponding abort acknowledge ï¬ag (ABTAK) in the CANTAAK register.
2. Setting the associated TXE ï¬ag to release the buffer.
3. Generating a transmit interrupt. The transmit interrupt handler software can determine from the
setting of the ABTAK ï¬ag whether the message was aborted (ABTAK = 1) or sent (ABTAK = 0).
12.5.2.3 Receive Structures
The received messages are stored in a ï¬ve stage input FIFO. The ï¬ve message buffers are alternately
mapped into a single memory area (see Figure 12-38). The background receive buffer (RxBG) is
exclusively associated with the MSCAN, but the foreground receive buffer (RxFG) is addressable by the
CPU (see Figure 12-38). This scheme simpliï¬es the handler software because only one address area is
applicable for the receive process.
All receive buffers have a size of 15 bytes to store the CAN control bits, the identiï¬er (standard or
extended), the data contents, and a time stamp, if enabled (see Section 12.4, âProgrammerâs Model of
Message Storageâ).
The receiver full ï¬ag (RXF) (see Section 12.3.4.1, âMSCAN Receiver Flag Register (CANRFLG)â)
signals the status of the foreground receive buffer. When the buffer contains a correctly received message
with a matching identiï¬er, this ï¬ag is set.
On reception, each message is checked to see whether it passes the ï¬lter (see Section 12.5.3, âIdentiï¬er
Acceptance Filterâ) and simultaneously is written into the active RxBG. After successful reception of a
valid message, the MSCAN shifts the content of RxBG into the receiver FIFO2, sets the RXF ï¬ag, and
generates a receive interrupt (see Section 12.5.7.3, âReceive Interruptâ) to the CPU3. The userâs receive
handler must read the received message from the RxFG and then reset the RXF ï¬ag to acknowledge the
interrupt and to release the foreground buffer. A new message, which can follow immediately after the IFS
1. The transmit interrupt occurs only if not masked. A polling scheme can be applied on TXEx also.
2. Only if the RXF ï¬ag is not set.
3. The receive interrupt occurs only if not masked. A polling scheme can be applied on RXF also.
MC9S08DZ60 Series Data Sheet, Rev. 4
Freescale Semiconductor
253
|
▷ |