Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

iCC 2006 CAN in Automation

CAN configuration within Autosar

Dr.-Ing. R. Machauer, Bosch Engineering GmbH

AUTOSAR (AUTomotive Open System ARchitecture) aims to standardize interfaces


between software application functions and further between application functions and
basic software modules in ECUs (Electronic Control Unit). Independence from
underlying hardware and this modular software design allows exchangeability of
software functionalities amongst ECUs. The integration of functions from different
suppliers is established through a virtual function bus. The mapping to a certain
network topology (or to ECUs) is carried out after that step. In this paper configuration
of a CAN stack and related basic software modules in system architecture
development according to AUTOSAR is shown.

1 Introduction The AUTOSAR partnership was


established in summer 2003 [1]. First
Nowadays in automotive environment E/E release of AUTOSAR specification was
systems comprise of many ECUs, which published in mid 2005. A second release
are connected via different bus systems followed during the first quarter of 2006
(CAN, LIN, FlexRay, MOST, proprietary [2]. In chapter 2 a short technical overview
serial lines, etc.). In luxury cars the of the AUTOSAR concept and its layer
number of ECUs may even reach 70. They model is given. In chapter 3 the Basic
are classified into several system domains Software (BSW) modules of
like powertrain domain, chassis domain, communication software(COM stack) and
body domain, safety, infotainment, etc. the underlying layers are discussed in
Inter domain communication is established detail.
through gateways. The functional behavior
of an ECU is specified by the Original 2 AUTOSAR concept
Equipment Manufacturer (OEM), and
implemented by the hardware supplier. The AUTOSAR software architecture
Each ECU implements certain application provides new design choices to software
functions, which interact in some way with engineers building distributed,
other ECUs. It is a common approach, that communication software systems. A key
ECU hardware manufacturers also supply aspect of this architecture is a design
application software with their ECU. With abstraction called the AUTOSAR Virtual
this approach the system integration Function Bus (VFB) (rf. Figure 1). VFB
medium is more or less the bus system allows the design of software systems
the ECU is connected to. With such a without reference to target hardware.
large number of ECUs and interacting Hence during the design process the
functions error detection within a system is mapping to a specific hardware is shifted
a challenge for the system integrator. The to later phase. The VFB is the collection of
driving forces for AUTOSAR are [1]: all communication mechanisms (plus
• Exchangeability of functional modules some interfaces to the basic software) on
(multiple suppliers) an abstract level.
• Manage increasing E/E complexity An AUTOSAR system is build from of a
associated with growth in functional set of software components (SW-Cs).
scope, which yields to improved quality Interaction among SW-Cs is accomplished
and reliability of E/E systems only through statically defined ports. Each
• Higher flexibility for product port is assigned an interface type, defining
modification, upgrade and update the “way” of communication. Two
communication paradigms are provided for
• Enable detection of errors in early
SW-C ports, called sender-receiver and
design phases
client-server communication; Sender-

06-12
iCC 2006 CAN in Automation

receiver provides message passing, depicts the software layer architecture. A

Figure 1: Virtual Function Bus [3] Figure 2: Software layer model [4]
whereas client-server communication color schema helps Figure 2: Software
invokes a service function call. VFB allows Layer Model [4] in distinguishing different
an early (virtual) integration of SWCs as layers. The application layer resides on
soon as the communication mechanism top of the layer model. This is abstracted
amongst SW-Cs are defined. The through the RTE from the underlying
AUTOSAR partnership specified a meta- hardware (including ECU). The RTE layer
model, described in the configuration is generated completely by tools based on
language XML. Hence XML configuration the provided XML-schema. Developing
files can be used for the entire system such tools is not in the focus of
specification. These XMLconfiguration files AUTOSAR, but they play a key role. Below
are used as input for code generation RTE all BSW-modules are divided into
tools, tools for creating object code or just several layers. Each layer abstracts its
as uniform specification exchange format. adjacent underlying layers a certain
Additionally, development tools like bus degree more from real hardware. The
analyzer, function modeling tools, etc. will service layer (blue) comprises system
support AUTOSAR exchange format in services (e.g. Operating System (OS)),
midterm. memory services (e.g. Non Volatile RAM
The Run Time Environment (RTE) is the (NVRAM)) and communication services
realization of the VFB for a specific ECU. (like bus communication). An example of
The RTE realizes the communication such abstraction would be the
between SWCs within an ECU (intra- communication service layer, which
communication) and among different abstracts from communication hardware.
ECUs (inter-communication). SW-Cs with The network system (LIN, CAN, FlexRay)
their ports and interfaces are mapped to is still not known. The hardware
certain ECUs after the VFB system design abstraction layer, on the other side,
step. XML configuration files are used to supports interfaces, providing
describe this mapping. After appropriate independence from hardware driver
system configuration XML configuration software and therefore from real
files are fed to an RTE generator microcontroller. On board device
producing code (e.g. source code files interfaces, memory hardware, I-O drivers
rte.c, rte.h, etc.) specific to an ECU. In this and communication hardware modules are
way the RTE layer encapsulates the whole distinguished in the layer next to the
communication mechanism for SW-Cs by microcontroller. The communication
providing a standardizes API to application hardware abstraction layer hides the used
functions and simultaneously being network system. Through this module the
independent from actual underlying network system type is chosen. For
hardware. example a CAN interface module is used,
if signals shall be transferred on CAN.
2.1 System layer model Apart from these hardware abstraction
blocks two more (green) BSW modules
A technical overview on AUTOSAR is appear. Input/ Output (IO) hardware
given in [3]. This subsection focuses on abstraction layer hides controller specific
the architecture within an ECU. Figure 2 properties of input and output ports.
Interfaces are provided to access data

06-13
iCC 2006 CAN in Automation

from ECU inputs or to put data to the communication services layer apart
hardware output ports with physical
values. The kinds of ports (Analog Digital
Converter (ADC), Pulse Width Modulated
(PWM), or digital input/output) shall not be
of relevance to upper layers. The
rightmost side of Figure 2 shows another
BSW module Complex Device Driver
(CDD). CDD allows direct access of RTE
to peripheral hardware. This module is
used for very time critical applications,
which can be speed up through directly
accessing peripheral hardware. Further
supplier can protect their IP within a CDD.

3 COM stack

This section gives an elaborated overview


of the COM stack. For simplicity only the
COM stack for CAN communication is
sketched. Figure 3 gives more insight into
the layered architecture of COM related
modules. The service layer contains
several modules. Subsection 3.1 gives an
overview of AUTOSAR COM, subsection Figure 3: Communication stack layer
3.2 gives details on PDUrouter, subsection model [4]
3.3 gives an overview of CAN transport from AUTOSAR COM. Network
protocol (CAN TP), subsection 3.4 and management provides uniform services to
subsection 3.5 summarize the task of CAN get and set modes of networks nodes.
Interface and of CAN Driver modules.
3.2 PDU-Router
3.1 COM
The PDU-Router [6] provides services for
AUTOSAR COM is based on the OSEK routing I-PDUs between the following
COM specification [5]. The COM service modules:
layer provides a uniform interface to the
CAN network. Protocol and message
properties are hidden from the application. • communication interface modules (e.g.
COM provides a microcontroller and ECU LIN, CAN and FlexRay)
hardware independent interface to • Transport protocol modules (e.g. CAN
application. COM transfers signals to and TP, FlexRay TP)
from the RTE. Signals are packed into and • AUTOSAR Diagnostic Communication
from I-PDUs. Dependent on the service to Manager (DCM) and Transport
be used, signals are directly passed to Protocol (TP) modules (e.g. CAN TP,
transport protocol modules or to the PDU FlexRay TP)
Router. External signal exchange between • AUTOSAR COM and communication
SW-Cs on different ECUs are routed interface modules (e.g. LIN, CAN or
through RTE via COM to PDU-Router and FlexRay) or I-PDU Multiplexer
then to a bus system as configured during
• I-PDU Multiplexer and communication
system design. COM is able to work as a
interface modules (e.g. LIN, CAN or
signal gateway, without inclusion of higher
FlexRay)
layers. Attributes are attached to signals,
which are managed and evaluated within
COM. Network management is included in The PDU router provides an API to the
above layers (e.g. COM) and an API for

06-14
iCC 2006 CAN in Automation

modules below the PDU router (e.g. CAN • Detection of errors in segmentation
interface). PDUs are identified by static sessions
PDU IDs. The routing operation of the
PDU router is controlled by routing tables,
The main purpose of CAN TP is to
which contain routing attributes for each
segment and reassemble CAN I-PDUs
PDU, e.g.: PDU Id and destination
longer than eight bytes (data flow control).
address. The PDU router does not modify
Two routing paths exist between CAN
I-PDUs, it simply forwards the I-PDU to the
interface and PDU router engine (see
destination module. A detailed sketch of
Figure 4). The PDU router determines
the PDU router structure is given in Figure
whether a transport protocol is to be used
4. The PDU-R module is split into two
or not. The PDU router can handle
parts:
different communication protocols for
COM and DCM I-PDUs. COM I-PDUs are
• The PDU Routing tables generally routed directly to CAN interface,
• The PDU Router engine whereas DCM I-PDUs are routed via CAN
TP, in a CAN network system. Diagnostic
information [8, 9, 10] exceeds eight byte
The PDU router engine performs routing data fields, which makes data flow control
actions according to the routing tables. necessary.
Two translations can be distinguished: up
(to higher layer) and down translation. In
order to provide access to the DCM for the 3.4 CAN interface
activation of the bootloader, the PDU
router engine provides a minimum routing The CAN Hardware Interface provides
capability. Specific PDUs can hence be uniform mechanisms to access a CAN bus
routed correctly to DCM in case the channel regardless of its location (internal/
configurable PDU router tables are external), i.e. upper layers do not
corrupted (e.g. by a previous flash differentiate, whether a CAN controller is
operation). connected via an SPI bus or whether an
on-chip CAN controller is used. CAN-
Interface abstracts from the location of
CAN controllers (on-chip/on-board), the
ECU hardware layout and the number of
CAN drivers. The upper layer addresses
CAN channels rather than CAN
controllers.

3.5 CAN driver

The CAN Driver provides services for


initiating transmissions and callback
functions for notifying receive events,
Figure 4: PDU router structure [6] independent from the CAN controller
3.3 CAN-TP hardware.

CAN Transport Protocol (CAN-TP) is


3.6 CAN transceiver driver
located between PDU router and CAN
Interface (see Figure 3). CAN TP provides The CAN Transceiver driver controls the
services for [7]: external CAN transceiver hardware. It
controls wake-up and sleep of the CAN
• Segmentation of data in transmit bus. It observes the bus line and provides
direction physical network layer diagnostic
• Reassembling of data in receive information (short circuit, open line, etc.) to
direction the upper layers.
• Control of data flow

06-15
iCC 2006 CAN in Automation

4 Example application are written by the pport. A require port (r-


port) represents a read data element
In this section the configuration and operation, as can be seen at the rightmost
integration process of a small mirror demo SW-C in Figure 5. Graphical tools will be
application is illustrated. First the demo (soon) available to configure SW-Cs by
application is split into SW-Cs: drawing them as they are sketched in
SensorInputProcessing, Figure 5. These tools support import and
MirrorAdjustManager, export of XML code, in order to exchange
ActuatorOutputProcessing. These SW-Cs configurations with other tools. In the next
communicate with each other over ports development phase SW-Cs are mapped to
and their assigned interfaces. Figure 5 hardware (ECUs), which represents
depicts the top level design. A small mirror mapping to a certain system architecture
control application serves as a design. Tools also assist in this step. A
demonstration. The example system manual way is, to map the SWCs by
consists of three SW-Cs. The left SW-C means of AUTOSAR XML code. After this
(SensorInputProcessing) reads in sensor step intra ECU and inter ECU signals are
information provided by the car driver via distinguished for the first time. For
joystick movements. The right SW-C example:
(ActuatorOutput- Processing) sends
steering commands to actuators. The If SensorInputProcessing is mapped to
MirroAdjustManager SW-C coordinates ECU1 and the right SW-Cs MirrorAdjust-
incoming requests and calculates Manager, ActuatorOutputProcessing are
corresponding move commands. At this located on ECU2, the ports
step sensor- and actuator component PP_Req_Mirror and RP_Req_Mirror
depends on logic signals, like: MoveX, exchange their data elements between
MoveY, Stop, etc. Now ports, interfaces ECUs. Data elements between the ports
and data elements are defined. Table 1 PP_cmd_Mirror and RP_cmd_Mirror are
shows an extract of a software component intra ECU signals. In case no special
XML description. For simplicity a table is routing is necessary, nothing is to be done
used instead of copying XMLcode. Table 1 for intra-ECU signals. All intra ECU traffic
is related to the leftmost SW-C of Figure 5. of SWCs is managed by RTE. Inter ECU
The name of the atomic SW-C is defined signals are communicated to external
in the first row. The component contains a devices. They are passed from RTE to
providing port (p-port) PP_Req_Mirror, COM and vice versa. COM packs signals
which uses a sender-receiver (S/R) into I-PDUs, which contain one ore more
interface of type IF_MirrorMoveXY. The signals. Signals within a COM I-PDU must
communication type sender-receiver occupy contiguous bits. Signals in COM
involves transmission and reception of layer need a reference to data elements of
signals for atomic data elements. An S/R SW-C ports. Data elements of SW-C ports
interface may contain multiple data has to be mapped to I-PDU signals.
elements. Here DT_Req_MoveX and Through this mechanism data elements
DT_Req_MoveY are two data elements from SW-C ports are linked to external
networks (a CAN network in this case).
Parameter Settings While transmitting the PDU-Router reads
Atomic-Software- CT_SensorInput- the I-PDUs and routes them according to
Component-Type ProcessingType the routing table to lower layers. In case of
P-Port-Prototype PP_Req_Mirror reception PDU-R transfers I-PDUs without
Sender-Receiver- IF_MirrorMoveXY modifications to upper layers.
Interface-Type
Data-Element- DT_Req_MoveX
Prototype DT_Req_MoveY
Table 1: SensorInputProcessing
configuration parameters (extract)
defined within the interface
IF_MirrorMoveXY. These data elements

06-16
iCC 2006 CAN in Automation

router selects to (or from) which network


interface data is transferred. In case of
CAN the I-PDUs are put (or get) to the
CAN Interface, which transfers them finally
to the CAN driver and from there to the
CAN controller.

6 Acronyms, abbreviations

Figure 5: SW-Cs of demo application ADC Analog Digital Converter


BSW Basic Soft ware
5 Conclusion
CAN-TP CAN Transport Protocol
The AUTOSAR standard aims to achieve CDD Complex Device Driver
DCM Diagnostic Communication
standardized interfaces between software
Manager
application functions and from them to
NVRAM Non Volatile RAM
basic software modules within ECUs OEM Original Equipment
(Electronic Control Unit). Software Manufacturer
modules designed this way, are PWM Pulse Width Modulated
independent from their underlying RTE Run Time Environment
hardware. Software modules may be OS Operating System
exchangeable due to a standardized API TP Transport Protocol
to other modules or to application VFB Virtual Function Bus
functions. In future automotive system
architectures the number of ECUs may be References
reduced, because of the ability to integrate
SW-Cs on a virtual function bus in a quite [1] H. Heinecke, K.-P. Schnelle, H. Fennel,J.
early development phase. The increasing Bortolazzi, L. Lundh, J. Leflour, J.-L.Mate, K.
Nishikawa, and T. Scharnhorst, AUTomotive
functional scope with the growing Open System ARchitecture -an industry-wide
complexity may be kept feasible in future initiative to manage the complexity of
emerging automotive e/earchitectures.
systems. The architectural concept of Convergence 2004, October 18-20 2004.
AUTOSAR is based on a VFB. Per ECU [2] AUTOSAR. AUTOSAR partnership
the VFB is instantiated as an RTE layer. homepage: www.autosar.org.
RTE encapsulates the whole [3] AUTOSAR. Technical Overview, 2.0.0
edition, March 2006.
communication infrastructure for SW-Cs [4] AUTOSAR. Layered Software Architecture,
which build the application functions. BSW 2.0.0 edition, March 2006.
modules are standardized for [5] OSEK. OSEK/ VDX Communication, 3.0.1
edition, January 2003.
configuration. Also BSW module APIs are
[6] AUTOSAR. Specification of PDUR, 2.0.0
part of the AUTOSAR standardization, edition, April 2006.
which yields exchangeable BSW modules [7] AUTOSAR. Specification of CAN Transport
(e.g. from different suppliers). Each layer Layer, 2.0.0 edition, April 2006.
abstracts gradually its underlying layer [8] ISO 15765-2 (2004-10-12), Road vehicles -
Diagnostic on Controller Area Networks
from hardware. Data elements of SW-Cs (CAN) - Part2: Network layer services.
are identified as internal or external [9] ISO 15765-3 (2004-10-06), Road vehicles -
signals when they are mapped to certain Diagnostic on Controller Area Networks
(CAN) - Part3: Implementation of Diagnostic
ECUs according to a system network Services.
architecture. External signals are [10] ISO 15765-4 (2005-01-04), Road vehicles -
transferred through RTE to COM, where Diagnostic on Controller Area Networks
(CAN) - Part4: Requirements for emission-
they are packed/ unpacked into/ from I- related systems.
PDUs. User data is put into (or get from)
buffers of the PDU-router, which routes
the packed I-PDUs according to its routing
table. A default routing table exists for
diagnostic data exchange, which serves
as backup in case a prior program
sequence destroyed the routing table. The

06-17

You might also like