|
XA-C3 Datasheet, PDF (55/68 Pages) NXP Semiconductors – XA 16-bit microcontroller family 32K/1024 OTP CAN transport layer controller 1 UART, 1 SPI Port, CAN 2.0B, 32 CAN ID Filters, transport layer co-proce | |||
|
◁ |
Philips Semiconductors
XA 16-bit microcontroller family
32K/1024 OTP CAN transport layer controller
1 UART, 1 SPI Port, CAN 2.0B, 32 CAN ID filters, transport layer co-processor
Preliminary specification
XA-C3
condition will always be generated at the end of each successfully
transmitted frame.
There is a control bit associated with each Message Object
indicating whether a message complete condition should generate
an interrupt, or just set a âmessage complete status flagâ (for polling)
without generating an interrupt. This is the INT_EN bit in the objectâs
MnCTL register, MnCTL[3].
There are two 16âbit MMRs, MCPLH and MCPLL, which contain the
message complete status flags for all 32 objects. When a message
complete (Tx or Rx) condition is detected for a particular Message
Object, the corresponding bit in the MCPLH or MCPLL register will
be set. This will occur regardless of whether the INT_EN bit is set
for that object (in MnCTL[3]), or whether message complete status
flags have already been set for any other objects.
In addition to these 32 message complete status flags, there is a Tx
Message Complete Interrupt Flag and an Rx Message Complete
Interrupt Flag (CANINTFLG[1] and CANINTFLG[0] respectively),
which will generate the actual Event interrupt requests to the XA
core. When an end of message occurs, at the same moment that
the message complete status flag is set, the appropriate Tx or Rx
Message Complete Interrupt flipâflop will also be set provided that
INT_EN = 1 for the object, and the interrupt is not already set and
pending.
The message complete interrupt flags should always be cleared
using the 2âstep process outlined below:
1. Message Complete Status Flags for all interrupt enabled objects
of that type (Tx or Rx) should first be cleared by writing â1â to
their bit positions.
2. The Message Complete Interrupt Flag itself can now be cleared
by writing â1â to its bit position.
Warning: Message Complete Interrupt Flags may be cleared before
all Message Complete Status Flags for interrupt enabled objects of
that type (Rx or Tx) are removed. However, the interrupt flag will not
be reset to â1â by hardware, unless a new message complete
condition occurs for some other interrupt enabled object. Therefore,
it is strongly recommended that Message Complete Interrupt Flags
be cleared only after removing all Message Complete Status Flags
for interrupt enabled objects of the same type, and at the end of the
interrupt service routine.
The newest addition is the Message Complete Info Register (MCIR).
MCIR[4:0] will encode the lowest object number of all objects whose
INT_EN bits are set AND who currently have a message complete
condition (objects whose message complete status flags are set). A
â1â in bit 5 means that one or more objects whose INT_EN bits are
set have a message complete condition. A â0â in bit 5 means that no
objects whose INT_EN bits are set have a message complete
condition. Bits 6 and 7 are unused.
Rx Buffer Full Interrupt
As successive frames of a Fragmented message are transferred by
DMA into an objectâs message buffer, it is possible to reach the end
of the designated buffer space before the complete message has
been received. When this occurs, it is necessary for the processor to
intervene in order that the remainder of the message be stored
without any loss of data.
If the system protocol is DeviceNet, CANopen, or OSEK, then a
message buffer is considered full when the number of bytes
remaining in the buffer space, at the end of a complete frame, is less
than seven.
If the system protocol is CAN, i.e., [Prtcl1 Prtcl0] = 00, then Rx
Buffer Full is defined as âless than 9 bytes remainingâ after storage
of a complete CAN frame. When the DMA pointer wraps around, it
will be reset to offset â1â in the buffer, not offset â0â, and there will be
no Byte Count written.
This condition could occur if the application has underestimated the
message size, or deliberately established a small buffer to conserve
memory. The condition will always occur with messages containing
more than 255 data bytes (excluding Fragmentation information
bytes), since the maximum message buffer size is 256 bytes.
The following discussion only applies to frames which are not the
last frame of a message (which also, necessarily, excludes
nonâFragmented, singleâframe messages). After DMA of the last
data byte of the frame is completed, a check will be performed to
determine if the current byte count is less than 7 bytes from the end
of the assigned message buffer. If it is, then there is the potential for
the next frame to overrun the buffer. We will consider this
âlessâthanâsevenâbytesâremainingâ situation to be a bufferâfull
condition. When this condition is detected, the following will occur:
D The current byte count will be written into buffer location â0â
except in CAN systems. If [Prtcl1 Prtcl0] = 00, no byte count will
be written.
D The address pointer will be initialized to location â1â
D The Rx Buffer Full interrupt will be generated
As subsequent frames are received, the data bytes will be stored,
beginning at location â1â. The semaphore byte will not be written to
again, since message assembly is still in progress. Once the
endâofâmessage is finally received, the DMP will respond as usual,
writing the byteâcount to location â0â and setting the Rx Message
Complete Interrupt Flag. Note that the byte count will now reflect
the number of bytes received since the buffer wrapped around,
not the total number of bytes in the message. Software will have
to calculate the difference.
The software has two choices as to how to respond to this Rx Buffer
Full interrupt:
1. Read the contents of the buffer, thereby freeing up space in the
buffer for any remaining frames.
2. Reposition the buffer by modifying the address pointer. Note: The
least significant bit of the address pointer will already be set to
â1â, and must remain so. The bottom location must be reserved
for the byteâcount which will be written at the end of the
message.
If option 1 is selected, the software will retrieve the current byte
count from the bottom of the buffer. It will then retrieve the
designated number of data bytes from the buffer. Subsequent data
received will be loaded into the buffer, beginning at location â1â.
When the endâofâmessage occurs, the byteâcount stored in
location â0â will indicate how many new bytes have been received
which must now be retrieved.
For option 2, subsequent bytes will actually be written into a different
buffer space, elsewhere in memory. The processor can wait until the
entire message is received before retrieving any data. At that time,
the â0â location of the 1st buffer will indicate how many bytes are
stored there, and likewise for the second buffer (or third or so on).
Note that option 2 is far more efficient and can be implemented with
very few instructions.
2000 Jan 25
48
|
▷ |