Vous êtes sur la page 1sur 8

iCC 2005 CAN in Automation

Comparison of CAN Gateway Modules for


Automotive and Industrial Control Applications
Jan Taube1,2, Florian Hartwich1, Helmut Beikirch2
1Robert Bosch GmbH Reutlingen, 2University of Rostock

Bus architectures with up to five independent CAN channels are used in today's auto-
motive and industrial control systems. Caused by the rising numbers of sensors, actu-
ators and electronic control units over the last years, modern control concepts demand
devices supporting cross-linking of these channels. This interconnection is realized
with a CAN gateway that connects several CAN buses between sub networks at differ-
ent speeds.
Current gateway implementations are based on one of two concepts. The one concept
is an application-specific multi-channel CAN controller with shared message object
memory. This concept is inflexible regarding the gateway structure, especially the
number of CAN channels, but it enables the transfer of messages between the net-
works without causing a high load on the host CPU. The other concept is a set of single
channel CAN controllers served by a message handling software on the host CPU. This
implementation is more flexible regarding the gateway structure, but the load on the
CPU depends on the combined bus traffic of all connected CAN networks. Starting
from these two solutions, a new concept has been developed, combining the advan-
tages of a flexible structure with a low CPU load.
In this paper, the three concepts are compared and advantages/disadvantages are
shown. In addition, problems in the design of gateways are discussed.

Introduction In automotive and industrial control applica-


The increased complexity of automotive and tions, the term gateway is preferred even
industrial networks and the need for data though the data is transferred between net-
transparency and information exchange works using the same protocol, because
within the overall system led to the introduc- these gateways perform more functions than
tion of gateways. the forwarding of messages.

Theoretically, the term gateway is not quite These functions [5] can/must be message fil-
correctly used in automotive applications. In tering (to prevent the overload of a low-
the literature, the term „gateway” is used for speed network when transferring messages
a network node of a communication network from a high-speed network), message trans-
equipped for interfacing with another network fers with identifier translation, message inte-
that uses different protocols. It may contain gration (combining parts of the data of
devices such as protocol translation, rate several messages into a new message), and
converters and signal translators to provide the synchronisation of time-triggered net-
system interoperability. works (when implemented) to guarantee that
the information is updated on time.
In that context, the term „bridge” is used to
describe a device of a communication sys- In general, the gateway functionality could be
tem that links or routes signals from one bus implemented in software, as long as several
or network to another, to extend the distance CAN modules are available in the ECU. But a
span and the capacity of a single network. It large amount of messages would cause a
does not modify packets or messages, it only high load on the CPU, leaving less perform-
reads them and forwards those with destina- ance for the ECU control applications until
tions not on the same segment of the net- real-time operation can no longer be guaran-
work as the transmitter. teed.
06-1
iCC 2005 CAN in Automation

Therefore dedicated gateways have to be tion and received message objects over the
developed with the objective of reducing the peripheral bus from one CAN module and
demands on the CPU performance. How- then writes the same data over the periph-
ever, there is not one single solution fitting for eral bus to some other CAN module(s). Con-
all applications; a concept is required that current message transfer requests from
can be easily adapted to different demands. different CAN channels are served sequen-
tially.
This paper wants to compare available gate-
way implementations with a new innovative
Tx
structure that combines the advantages of

CPU Interface
CAN Core
Rx
both gateway concepts.
Message
RAM
1 Gateway Implementations
Gateway implementations which can be Tx

CPU Interface
CAN Core
Rx
found in present-day automotive and indus-
trial applications are based on one of two CPU

CPU Peripheral Bus


Message
concepts. The first concept is a set of dis- RAM

crete channel CAN controllers served by a

...
message handling software on the host
CPU. This concept is flexible regarding the Tx

CPU Interface
CAN Core
number of CAN channels, but a high-per- Rx

formance host CPU is required to ensure


real-time operation at full bus-load. Message
RAM

The second concept is an application spe- Figure 1: Structure of discrete channel gateway
cific complex channel CAN controller. This modules
concept is inflexible regarding the gateway
structure, especially the number of CAN The number of CAN channels connected to
channels. Furthermore such gateways need the CPU’s peripheral bus can easily be
elaborate control mechanisms. However, this adapted to actual requirements, but a rising
structure supports the transfer of messages number of CAN channels will increase the
to other networks without causing a high CPU load even if the CAN bus-load remains
load on the host CPU. unchanged.

A third concept is the new modular gateway. Complex Channel Gateway


These gateway concepts will be described in
Tx
the following text. CAN 1
Rx
Discrete Channel Gateway Tx
Shared
CAN 2
The most distributed gateway concept is the Link Message Rx
Control Object
discrete channel gateway. This gateway con- Memory
...

sists of the components CPU, CPU Periph-


Tx
eral Bus and several single channel CAN
CAN n
modules (Figure 1). Rx

There are different implementations of this


CAN Control
gateway concept available, depending on the
preferences of the manufacturers. The CPU CPU Interface
may be a CISC or RISC machine. In most
Address

Control
Data

applications, its software controls not only


the gateway function, but may also include
some other tasks. Each CAN module is con- Figure 2: Structure of complex channel gateway
nected to the CPU via the CPU’s peripheral modules
bus. During the gateway operation, the CPU The complex channel gateway, which was
needs to read all necessary control informa- designed in the last years, is a concept to

06-2
iCC 2005 CAN in Automation

reduce the demand for CPU performance. It is expanded with a gateway interface (Figure
is more elaborate than the discrete channel 4). Several instances of this adapted single
gateway and consists of a shared Message channel CAN module may be combined and
RAM, several CAN Cores and an internal be turned into a gateway controlled by an
Control Unit (CAN Control). In some imple- application specific Gateway Unit (Figure 5).
mentations, a Link Control is added to pro-
vide a basic gateway functionality without CAN_TX

CAN Core
causing any CPU load (Figure 2). CAN_RX

Clock CAN-Message
The system design is comparable to a single Reset
Control
channel CAN module with two or more CAN

Module Interface
CPU IFC Register 1
protocol controllers. A CAN protocol control- Address

Message Handler
ler performs the serial communication in a DataIN

CAN bus system according to the CAN pro- DataOUT


CPU IFC Register 2

tocol specification. The CAN Control unit Wait

manages the data flow between the CAN Interrupt Message RAM
(single ported)
protocol controllers, the Message RAM and
the CPU Interface, respectively the CPU
itself. It also controls the access of the differ- Figure 3: CAN Module w/o Gateway Interface
ent instances to the Message RAM and pre-
The single channel CAN module (in this
vents data corruption. The Message RAM is
case, Bosch’s C_CAN IP, Figure 3) com-
implemented as shared memory, the mes-
prises the components CAN Core, Message
sages for all CAN channels are combined in
Handler, Message RAM and CPU IFC Regis-
the same RAM block to reduce the need for
ters. The CAN Core performs the serial com-
internal data transfer and therefore to reduce
munication on the CAN bus. Individual
the CPU load. The optional Link Control unit
messages can be (pre-)configured in the
is configured with the fundamental routing
Message RAM and are managed by the
rules. These rules are checked when a new
Message Handler. This includes the transfer
message is received. If a rule for a message
of messages between the CAN Core and
is defined, it will be performed by the CAN
Message RAM, acceptance filtering and the
Control unit without any need for CPU action.
handling of transmission requests and inter-
Different functions may be provided, depend-
rupts. Two sets of CPU Interface Registers
ent on the complexity of the Link Control and
are used for the data transfer between the
CAN Control units. This can be a simple
CPU’s peripheral bus and the Message
copy of the complete message, a transfer of
RAM. They consist of the complete data,
the message data with a translated identifier,
header and control information, which are
up to message integration, where data of
moved as one single word on the internal
several messages is combined into a new
data bus.
one.
Cascade-Input
This concept, especially when it includes a CAN-Message CAN_TX

Link Control unit, reduces the CPU load sig- CAN Core
CAN_RX
nificantly. Its disadvantage is that it is compli- Clock CAN-Message
cated to change the number of CAN Reset
Control
channels. This would require major changes
Module Interface

CPU IFC Register 1


in the Link Control unit and in the CAN Con- Address
In-Mux Message Handler
trol unit, especially in the arbitration of con- DataIN

CPU IFC Register 2


current accesses to the shared Message DataOUT

RAM. Up to now, there is no complex chan- Wait

Interrupt Message RAM


nel gateway available which supports more WR_Sel
(single ported)
Out-Mux
than 5 CAN channels. RD_Sel
Com. Mask
Com. Rqst

Modular Gateway GWMode


Cascade-Output

The modular gateway is based on a proven Figure 4: CAN Module with Gateway Interface
single channel CAN module (Figure 3) which

06-3
iCC 2005 CAN in Automation

The existing single channel CAN module is interconnection with several other protocol
expanded by several functional blocks to interfaces (e.g. FlexRay, LIN, MOST, etc.).
adapt it into a gateway cell. These functional For the system designers, these parameters
blocks are an input multiplexer In-Mux and may be the flexibility in programming the
an output-multiplexer Out-Mux together with gateway functionality, access time for read/
the necessary control signals to direct the transfer of messages, or the required CPU
data flow (Figure 4). performance. In general, a compromise has
to be found between these parameters,
The two multiplexers give access to the inter- especially the system structure/module size
nal data bus, making it possible to load the and the needed CPU performance.
complete CPU IFC Register in parallel from
a wide input port (Cascade-Input) and to Discrete channel gateways are solutions
export the contents of the CPU IFC Register optimized for modularity and module size.
over an equally wide output port (Cascade- Several CAN cells can be connected to the
Output). The Cascade-Input may also be CPU bus, only the address space has to be
routed directly to the Cascade-Output. adapted. No semaphores or additional flags
are necessary to control concurrent requests
These two wide ports allow the transfer of a to a message buffer by several instances,
complete CAN message and necessary con- because only the CPU can access the cells.
trol information in one step directly from one This allows the interconnection of an
CAN cell to other CAN cells, avoiding the unspecified number of CAN channels.
bottleneck of the CPU’s peripheral bus.
The simple system structure without any
Gateway
Unit additional interconnecting logic reduces the
Control signals CAN_TX

GW Mode[1n]
Write Enable[1n]
CPU_IFC
C_CAN 1 CAN_RX module size to a minimum. The lack of hard-
Cmd Rqst[1n]
Cmd Msk[1n]
Write Sel[1n]
ware support for gateway functions however
Read Sel[1n]

CAN_TX increases the need for CPU performance. All


C_CAN 2
CPU-Bus
CPU_IFC CAN_RX
data transfers between two or more cells,
...

data manipulations, and insertions need to


C_CAN n
CAN_TX be executed by the CPU. Especially the
CPU_IFC CAN_RX

sequential read and write cycles for a mes-


Cascade-Ring sage transfer between cells cause high CPU
Figure 5: Structure of modular gateway module burdens. In summary, a high number of CPU
cycles is unavoidable. This number of cycles
When several instances of this adapted sin-
is increased by the interrupt handling or by
gle channel CAN module are cascaded into
the polling of the connected cells (to check
a gateway module, the wide input and output
for receptions), and by special functions like
ports are connected to the cascade ring bus.
the already named data manipulation or the
This allows the transfer of a complete mes-
combination of several messages.
sage and control signals to all connected
cells in one clock cycle. The data flow Even regarding the high CPU burden, this
between the CAN cells is controlled by an gateway model provides the most flexibility in
application specific Gateway Unit that pro- programming, since the gateway functional-
vides the control signals for the multiplexers ity is implemented in software. Such a gate-
and the information to load/store a message way model meets the requirements of a wide
from/to the Message RAMs. range of gateway applications.
2 Comparison of Gateway Concepts In automotive and industrial control applica-
tions, where the numbers of interconnected
Semiconductor manufacturers and system CAN cells and routed messages cause a
designers will use different parameters when very high CPU load, gateway models are
they compare the advantages of gateway needed that provide additional functions.
modules. For semiconductor manufacturers, One such gateway model is the complex
these parameters may be the module’s gate channel gateway that implements a wide
count, its adaptability to different numbers of range of functions in hardware, its central
CAN channels, as well as the possibility of component is the shared Message RAM.

06-4
iCC 2005 CAN in Automation

The messages for all connected CAN chan- has another advantage: It allows the transfer
nels are configured and stored in the same of a message to one, several or all con-
RAM block. A message that is to be received nected cells simultaneously with nearly the
on one channel and to be transmitted on same effort.
another channel will occupy only one seg-
ment of the RAM block. This feature reduces The modular structure allows also a flexible
the CPU load, because it supersedes the programming of the gateway function. Even
transfer operations of the message from when the gateway function is controlled by a
CAN cell(n) to the CPU and then from the finite state machine, the CPU keeps full
CPU to CAN cell(m). Automatic transmis- access to all functions of each CAN cell. For
sions of received messages on other net- example, it can write or read messages and
works can be started if a Link Control is can start their transfer. Concurrent requests
implemented. The CAN Control Unit detects of the CPU and of the FSM to the same cell
the reception of a message and checks the are solved in a deterministic way, sema-
routing rules in the Link Control. If a rule is phores and flags are not necessary. This
defined, it is executed by the CAN Control maximises the flexibility of the module. If
Unit. Several functions can be implemented, additional functions beyond a simple mes-
dependent on the complexity of the Link sage transfer/copy are required (e.g. the
Control and CAN Control Units. This can be merging of messages), special modules that
the simple copy of a message onto another implement this features can be inserted into
network up to the merger of several mes- the cascade ring.
sages into a new one, combined with cycli- Different applications need quite different
cally updated transmissions. solutions. A modular structure allows to
The reduction of the CPU load is paid with design a new gateway by combining compo-
less flexibility in the system design. A compli- nents of a library, speeding up the design
cated control system is needed to transfer time significantly. The size of such a module
the messages between the CPU, the CAN is marginally larger than that of a discrete
cells, and the RAM, arbitrating between pos- channel gateway structure, it is increased by
sibly concurrent requests by several cells to the Gateway Unit and the optional message
the shared message RAM, requiring flags manipulation functions.
and semaphores to assure data consistency. The modular gateway structure is not
A priorisation of all modules is required to restricted to the CAN protocol, it is possible
define which unit gets access to the RAM. to add several other protocol interfaces to the
When a specific application of the gateway cascade ring. These can be different bus
needs new transfer functions or a different systems like TTCAN, FlexRay or LIN. When
number of CAN channels, this will require a implementing the time-triggered variant of
redesign of the whole gateway structure CAN, the gateway structure (incl. gateway
(especially link control and CAN control). control unit) can be the same. Only the con-
The modular gateway is a merger of discrete cerned CAN cells have to be replaced by the
channel and complex gateway, combining time-triggered ones. A different interface
the advantages of both concepts. The opti- structure then the cascade ring might be
mized structure allows a fast data transfer used for the implementation of bus systems
between several cells without causing a high transferring multimedia data (e.g. MOST,
CPU load [4]. If an internal state machine is IEEE 1394, Bluetooth) because of different
provided, the CPU load can be reduced to a requirements regarding higher data rates on
minimum. The transfer of messages from the one hand and less emphasis on trans-
one Message RAM over the cascade ring to mission reliability, security, and time sched-
one other Message RAM takes more time ules on the other hand.
then in a complex channel gateway with Link An exemplary implementation of the modular
Control unit where no data transfer between gateway structure was tested to demonstrate
two CAN cells is necessary. However, the the functionality of the cascaded ring struc-
transfer over the cascade ring takes less ture. It consists of three CAN nodes,
then two CAN bit times and the cascade ring enhanced by a data integration unit (mes-

06-5
iCC 2005 CAN in Automation

sage combination, message comparison), plex automotive and industrial control appli-
controlled by a set of special function regis- cations. Real-time information exchange and
ters. The control software runs on a Motorola real-time ECU control structures can no
HC08 CPU. The gateway was synthesized longer be guaranteed.
into an FPGA. In total, the module needs an
additional gate count of nearly 10% com- Available solutions that require less CPU
pared to the same number of discrete chan- performance for data transfers are complex
nel CAN modules. The functionality of the channel gateways. With the module-internal
test structure could be demonstrated in a data handling, the requirement for CPU per-
small application [4]. formance can be reduced dramatically. How-
ever, the system structure is inflexible
A short summary of important parameters regarding the number of CAN channels as
for the gateway models is shown in the fol- well as regarding the possibility to implement
lowing table (Table 1). additional functions.
Com-
Discrete Modular
The new modular gateway structure, which is
plex presented in this paper, solves the problem
Channel Gateway
Channel of CPU performance, gives flexibility in sys-
Design tem design, and allows real-time operation.
low high high
Flexibility
Module Size 3 Advanced CAN Gateway Architecture
high low middle
(Chip area)
Expandability difficult easy easy
The differentiation of the application areas,
combined with increased pricing pressure,
Hardware
Functionality
high low high led to the implementation of specialised bus
systems, e.g. LIN, TTCAN, and FlexRay.
Required CPU
low high low
Performance A gateway connecting these bus systems to
Time for internal the CAN channels has to fulfil the same
low high low
Mess. Transfer requirements of limited CPU load and flexible
Table 1 : Overview of important parameters for system structure as well as some additional
gateway design requirements, e.g. when connecting time-
triggered networks, networks with different
It was possible to show that discrete channel
message length, or with different data rates.
gateways are no longer applicable in com-

Time-Triggered Network A

Ref 258 Ref 050 12D 09A … 09A Ref

Time-Triggered Network B

Ref 09A 355 Ref 258 050 12D … 12D Ref 09A

Basic Cycle 1 Basic Cycle 2 Basic Cycle 1


Matrix Cycle Matrix Cycle

Synchronization Synchronization
Reference Point Reference Point

Figure 6: Predefined data transfer between time-triggered networks

A message transfer between two unsynchro- Therefore, all participants have to be syn-
nised time-triggered networks is possible, chronised in order to achieve a predefined
but time-triggered systems need to work on data transfer (Figure 6).
a predefined schedule, otherwise it would
not be assured that the processed data is up The synchronisation between TTCAN net-
to date. In the worst case, caused by phase works, where the global time is provided by a
shifts and differing time bases on the unsyn- single time master, is quite easy. It can be
chronised networks, a time delay of an entire implemented in a simple hardware state
cycle time could occur. machine, when the gateway cells connected
to the (time-) slave networks are time mas-
06-6
iCC 2005 CAN in Automation

ters of that networks. The gateway cell con- considered when interconnecting automotive
nected to the (time-) master network may be and multimedia bus systems. When such a
time slave, potential time master or actual gateway is implemented in hardware, struc-
time master in that network. It is not neces- tures have to be implemented that prevent
sary that all TTCAN networks operate with the unintended data transfer between the
the same basic cycle length; they may use domains. Possible concepts are hardware
different cycle length and may operate on dif- firewalls and data encryption.
ferent CAN bit times.
4 Summary and Conclusion
A simple hardware state machine is not suffi-
cient to synchronize FlexRay networks, Currently, the gateways provided by semi-
because FlexRay is a multi-master bus sys- conductor manufacturers are discrete chan-
tem where the global time is calculated on nel gateways or complex channel gateways.
signals coming from up to 15 nodes, the syn- Complex channel gateways have an inflexi-
chronisation will be done by software. The ble application specific system structure
synchronisation of TTCAN networks with a whereas discrete channel gateways need
FlexRay network follows the same principle control software that causes a CPU load that
as the synchronisation of two TTCAN net- depends on the combined bus traffic of all
works. In this case the FlexRay network connected CAN networks.
would be the master network and all inter-
This paper has shown and compared the
connected TTCAN networks would be con-
structure as well as the advantages and dis-
sidered as (time-) slave networks.
advantages of both implementations. Also it
CAN applications uses data rates up to was shown that it is possible to adapt proto-
1000 kBit/s. Specialised routing algorithms col interface cells to use it in a modular gate-
are necessary when connecting CAN with a way. This modular gateway combines the
bus system that uses higher data rates (e.g. advantages of discrete and complex gateway
FlexRay 2x10 MBit/s), to prevent an overload implementations. It is flexible in system
of the „slower” network. A possible solution is structure and reduces the load of the host
the usage of message filtering, which is pro- CPU or the Gateway Control Unit signifi-
vided by the most modules. This means that cantly. First implementations and evaluation
only predefined messages will be routed in results of an exemplary gateway were dem-
the gateway. However, some messages need onstrated.
to be transferred only fractionally to another
Future challenges are the enhancement of
network. In this case, it is applicable to inte-
the CAN gateway with TTCAN modules for
grate several messages.
networks using a time-triggered architecture
Multimedia components have become stand- and the integration of a finite state machine
ard in the upper car class (e.g. navigation to allow CPU-independent operation. A con-
and entertainment systems). The data com- cept for this control unit is in development.
munication between multimedia compo-
References
nents and automotive bus systems
1. Bosch: C_CAN User’s Manual, Revision 1.2; Robert
increased significantly in the last years (e.g. Bosch GmbH; http://www.can.bosch.com/docu/…
adapting the sound volume to the driving Users_Manual_C_CAN.pdf; 08.01.2005
speed). The communication between the two 2. Bosch: C_CAN Module Integration Guide, Revision
domains with their different requirements 1.2; Robert Bosch GmbH; 21.01.2002
needs a dedicated interface. The communi- 3. Bosch: TTCAN User’s Manual, Revision 1.6; Robert
cation between both network domains must Bosch GmbH; http://www.can.bosch.com/docu/…
not interfere with the communication reliabil- Users_Manual_TTCAN.pdf; 08.01.2005
ity of the automotive networks, while multi- 4. J. Taube, F. Hartwich, H. Beikirch: C_CAN Gateway
media applications are less critical. Another Module - A New Approach for CAN Gateways -;
aspect are the different timing requirements. embedded world 2005 Conference, Nuremberg
(Germany)
Automotive networks have to work at a pre-
5. V. Nieten: Gateway Development Support for Multi-
defined schedule; most multimedia systems
Channel CAN with Event-Processor; 7th interna-
cannot guarantee timing requirements. tional CAN Conference, iCC 2000, Amsterdam
Security is also an important factor to be (Netherlands)

06-7
iCC 2005 CAN in Automation

6. U. Kelling: The MultiCAN module - Two CAN were


not enough; CAN Newsletter June 2004; p16-p18
7. Freescale Semiconductor, Inc.: XGATE Block Guide;
http://www.freescale.com/files/microcontrollers/…
doc/ref_manual/S12XGATEV2.pdf; 08.01.2005
8. NEC Corporation: Preliminary User’s Manual
V850E/CA1TM ATOMIC; http://www.ee.nec.de/…
_pdf/U14913EE1V0UM00.PDF; 08.01.2005

Contact
___________________________________
Jan Taube
Robert Bosch GmbH, AE/EIS3
P.O.Box 13 42
72703 Reutlingen
Germany
Phone: +49 7121 35-4570
Fax: +49 7121 35-1746
E-mail: Jan.Taube@de.bosch.com
___________________________________
Florian Hartwich
Robert Bosch GmbH, AE/EIS3
P.O.Box 13 42
72703 Reutlingen
Germany
Phone: +49 7121 35-2594
Fax: +49 7121 35-1746
E-mail: Florian.Hartwich@de.bosch.com
___________________________________
Prof. Helmut Beikirch
University of Rostock
Faculty of Computer Science and Electr. Eng.
Albert-Einstein-Str. 2
18051 Rostock
Germany
Phone: +49 381 498-3514
Fax: +49 381 498-3608
E-mail: Helmut.Beikirch@etechnik.uni-rostock.de
___________________________________

Additional Sources
http://www.can.bosch.com/
Definitions, Acronyms, Abbreviations
CAN Controller Area Network
CPU Central Processing Unit
GW Gateway
FSM Finite State Machine
SFR Special Function Register
ECU Electronic Control Unit
ASIC Application Specific Integrated Circuit
ASµC Application Specific Microcontroller
IP Intellectual Property
CISC Complex Instruction Set Computer
RISC Reduced Instruction Set Computer

06-8

Vous aimerez peut-être aussi