Professional Documents
Culture Documents
XA-C3 Supports CAN Higher Layer Protocols: Peter Hank Systems Laboratory Hamburg
XA-C3 Supports CAN Higher Layer Protocols: Peter Hank Systems Laboratory Hamburg
XA-C3 Supports CAN Higher Layer Protocols: Peter Hank Systems Laboratory Hamburg
Peter Hank
Systems Laboratory Hamburg
The XA-C3 is the first CAN Microcontroller featuring a power- • Unique ‘Transport Layer Co-processor’ (TLC), supporting
ful combination of FullCAN and PeliCAN functionality togeth- CAN Higher Layer Protocols
er with a unique on-chip Transport Layer Co-processor support- • 512 byte on-chip XRAM message buffer (extendable to
ing Higher Layer Protocols such as DeviceNet, CANopen and 8kbyte off-chip)
OSEK.
• Message Handler with DMA engine
• SPI, UART and three 16-bit timers
• 32kbyte of on-chip program memory and 1kbyte of Data RAM
SFRs UART
Interface
MMRs CPU SPI Port to
SPI Slaves
and
1k RAM Timers other
devices
32k EPROM Interrupts
Message ID [28:13] 1 1 1 RX
Message ID [12:0], IDE 2 2 2
Mask ID [28:13] 3 3 3 RX
Mask ID [12:0] FRAG 4 RX 4
Control 5 5
RX
Buffer Base Address +0
Buffer Size
{
+1
Fragment Count +2
31 31 RX
Message Object n + 1 32 RX 32 RX
Figure 3. Pre-Arbitration
Message Object 32 * Self Test Mode (supports complete CAN Node check)
Due to this, the CAN controller on the XA-C3 combines all the
benefits of well-known FullCAN and PeliCAN implementations.
Higher Layer Protocol Support Transport Layer Co-processor (TLC)
Long data packages are transferred as multiple CAN data To reduce processor load, caused by servicing the received CAN
frames. The worst case situation for a conventional FullCAN or data frame fragments of long messages, the XA-C3 manages
BasicCAN Controller occurs if all fragments are received consec- Communication at the Transport Layer of Higher Layer
utively at high busload. Protocols in hardware (figure 5). Long messages are reassembled
automatically and the CPU is interrupted only when a particular
The CPU is interrupted for every subsequent fragment, as long message is complete. The whole process of receiving, comparing
as the “end of message” (last fragment) has not been detected by and storing fragmented messages is performed by the Transport
the software. Servicing the interrupt results in a significant con- Layer Co-processor, which is a unique DMA driven ‘message
stant CPU load during the whole download process. This is a handling’ engine. With these CAN Controller properties, the
real bottleneck for the whole system processing resources, and it interrupt overhead can be reduced significantly, because the
gets even worse when multiple, interleaved messages are received CPU is only interrupted at the end of a certain message. This
simultaneously. allows the 16-bit CPU to focus more on main application tasks
and less on housekeeping of the Transport Layer Protocol.
Open
Connection n n-1 1
k k-1 2 1
2 1
First Fr 1
agmen
t
Middle
Fragme
nt "TLC"
DMA
Receiving Module
1
Sending Module
3 2
4
0 byte count
1
5
2 fragment 1
7
Middle fragment 2
Fragme
nt
First Fr
agmen
t last fragment
1
2
32
Close
Connection Message Buffers Message Objects
}
}}
}
Id 1 2 3 4 5 6 7 8 Id 1 2 3 4 5 6 7 8 Id 1 2 3 4 5 6 7 8
fragment (n) 1st data byte fragment (n+2)
For the XA-C3 one of three Higher Layer Protocols (DeviceNet, DeviceNet
CANopen, OSEK) can be selected. Whatever HLP has been The XA-C3 provides hardware support for DeviceNet I/O
chosen, it applies to all receive message objects which are Messages. They are transmitted in an unacknowledged fashion.
enabled for fragmented message reception. In other words download of fragments can take place without
acknowledge frames from the receiving node. As shown in figure
Fragmented message reception supported by the XA-C3 is based
6 the PCI byte contains a fragment type field indicating whether
on eight bytes of data per fragment. In this context, the first
this is the first, middle or last fragment of a message. The frag-
data byte has an important control function for the transfer (see
ment count field marks each separate fragment such that the
figure 6). In some HLPs, this byte is called Protocol Control
receiver can determine, whether or not a fragment has been
Information Byte (PCI). It specifies start/end of a fragmented
missed.
transmission and includes a fragment count, which is increment-
ed by one for every subsequent fragment. According to the value
CANopen
of the PCI byte, data will be automatically stored into the corre-
sponding buffer area via DMA. This byte is always stripped off CANopen SDO’s (Service Data Objects) have a toggle bit that is
and gets never stored in the message buffer. Data bytes from changing its value with every subsequent fragment. In addition,
successive fragments are stored in the message order received. a single bit indicates the end of a message. Each download seg-
When the end of message has been decoded, and the final ment request is confirmed by the XA-C3 with a download seg-
frame’s data bytes have been received, the byte count is written ment response. This is organized in such a way, that a pre-
into address 0 of the buffer (Buffer Base Address). The byte defined message object is taken as a response frame. Upon valid
count represents the total number of data bytes, which have reception of a download segment, the TLC starts transmission of
been stored in the buffer. The end of a certain message will be the response frame without any software intervention.
set only after the special encoded ‘Last Frame’ has been received.
OSEK / ISO 15765 (Diagnostics on CAN) Application Example
The USDT (Unacknowledged Segmented Data Transfer) The behavior of the TLC will become even more transparent with
protocol used for OSEK and Diagnostics on CAN does not the following configuration and processing example for DeviceNet
define an end-of frame indication as known from DeviceNet and (figure 7). Whenever the general initialization of the XA-C3 has
CANopen. However, a message length indicator is transmitted been finished, one or more message objects can be enabled for
within the first frame. Due to this, the user software can calculate fragmented message reception.
the size and the start address for the message buffer ahead of time.
First, the ‘Higher Layer Protocol’ has to be selected within the
As soon as segmented data are received as consecutive frames, the
Global Control Byte. Next the object’s Message ID must be speci-
XA-C3 can fully profit from the TLC functionality. All data bytes
fied in the MID registers. Note that masking of message IDs is
are stored in the sequential order received. Whenever a message is
not allowed for fragmented messages. The Buffer Location Register
longer than the specified message buffer size, an RX Buffer Full
(BLR) includes the start address within the message buffer. In this
interrupt can be enabled. This type of interrupt allows, e.g., to
example, a message with 26 data bytes (4 fragments) shall be
enable a new buffer space for the remaining message bytes by re-
received. Therefore, a buffer size of 32 has been chosen. Finally, the
defining the object’s Buffer Base Address. This feature is important
‘FRAG’ bit is set ‘1’ (message data is stored sequentially) and the
because USDT specifies up to 4095 user data bytes per message.
object is enabled for reception. From now on, the TLC takes care
However, the TLC is not only performing a simple data transfer to of the whole reception process.
the message buffer but also managing a complete data integrity
As soon as the last fragment of the message has been stored in the
check. Any kind of errors and buffer overflow conditions during
message buffer, the TLC generates a message complete interrupt
fragmented message reception are detected and signaled to the user.
for the CPU. On receipt of this interrupt the software will reset
In case of, e.g., detecting an ‘out of sequence’ fragment, the auto-
the message complete status and process the data.
mated data transfer to the message buffer is aborted. In addition, a
fragmentation error interrupt can be enabled for the CPU. In this
case, a re-initialization of the download process has to be done.
store
wait data
Last
Fragment
store
data RXMessageComplete_Interrupt (void)
{
if (MCPL == Object_18) /* check if Obj_18
{ is complete
generate MCPL = Reset_18; /* reset message compl.
interrupt
Process_Object18(); /* process
Interrupt Service Routine }
if (MCIR < 0x20) /* check for another object
receipt CANINTFLG = 0x01; /* clear RMCIF
'Message Complete Status' else .....
if (MCIR < 0x020) /* check for a new message
}