Você está na página 1de 4

2010 2nd International Conference on Industrial and Information Systems

Development of a Real-time Monitoring System for ECU based on CAN Bus

Xiaofeng Yin, Jingxing Tan, and Lei Li


Institute of Automotive Engineering
Xihua Unversity
Chengdu, P. R. China
e-mail: xiaofengyin@vip.sina.com

Abstract-To overcome the shortcomings of compatibility domains. To overcome the above limits of existing
with different CAN (Controller Area Network) monitoring systems, a general purpose real-time
communication devices and applicability in different fields monitoring system for ECU based on CAN bus has been
for the current real-time monitoring systems for ECU developed, which supports a number of CAN
(Electronic Control Unit) based on CAN bus, a novel communication devices provided by different companies,
architecture for the monitoring system was put forward, and
and configures the protocol of application layer flexibly.
the corresponding monitoring software has been developed,
which consists of a communication module, a configuration II. ARCHITECURE OF MONITORING SYSTEM
database for the protocol of application layer and its
management tool, a message parsing module, and an
The architecture of real-time monitoring system for
application module. The proposed architecture and
ECU based on CAN bus is shown as Fig.l, which consists
developed monitoring software were verified through real­ of the monitoring software, CAN communication interface
time communication tests on the ECU of automatic device(s), CAN bus, and various ECU's bein& monitored.
transmission of an experimental vehicle.

Keywords- CAN; communcation; real-time monitoring;


ECU; software

1. INTRODUCTION

As a serial communication bus, CAN (Controller Area


Network) bus [1] has been widely used in automotive
embedded control systems, as well as other industrial
monitoring and control systems [2-7], due to its high speed
of communication, good reliability and fault-tolerant
capability. Meanwhile, a number of communication
protocols, such as SAE J1939 [8] for the communication
among vehicle controllers and CANopen [9] oriented to
industrial control domain, are built with CAN as low level
protocol. The real-time monitoring systems for ECU
(Electronic Control Unit) based on CAN bus can be used
to not only analyze the functionality and performance of
ECU through monitoring the work or status parameters,
but also calculate the statistical parameters of CAN bus Figure 1. Architecture of monitoring system
such as bus load, number and rate of various frames
transmitted on the bus, etc. It is an indispensable tool for As shown in Fig. 1, the monitoring software is a toolset
the processes of development, debug, and fault diagnosis, consists of a number of drivers for CAN interface devices,
etc. , for ECU and network based on CAN bus. a communication module (CM), a configuration database
With regard to current real-time monitoring systems for for the protocol of application layer (VND), a management
ECU based on CAN bus, there are two issues existed: the tool for VND (VND Editor), a message parsing module
first issue is the compatibility with different CAN (MsgParser), and an application module (AM).
communication device, i.e., most commercial monitoring To be compatible with different CAN interface devices,
software (such as Vector's CANoe/CANalyzer) usually the architecture places a middle software layer, i. e. , CM
only support the interface devices developed by the same module, between the protocol software of CAN data link
company, which limit the scope of users' choice that may layer implemented by various device drivers and AM
results in cost increase; the second one is the applicability module, to mask the details of the underlying
in different fields of application, i. e., the monitoring implementation of the drivers provided by different
systems usually are either domain-specific [3-5] since manufacturers, and provide a set of unified application
fixed protocol configuration of application layer used, or programming interfaces (APls) to AM module. AM
only support the real-time monitoring of CAN messages at module can then realize various communication functions
data link layer and cannot configure the protocol of based on CAN bus according to those APls provided by
application layer thus cannot parse the messages in specific CM module. The advantage of this scheme is: when the

978-1-4244-8217 -7110/$26.00 ©2010 IEEE IIS 2010


273
CAN interface device not supported by the current version More than 20 types of CAN interface devices provided
of CM module is used, the user only needs to extend CM by Vector Infomatik GmbH and Guangzhou ZLG MCU
module on the premise of keeping APls unchanged, and Development Limited Corporation, are supported by the
thus ensures the robustness of the whole monitoring current version of CM module through encapsulating
system. corresponding drivers with a triple (vendor name, device
To be applicable in different fields of application, type, device number) to differentiate different equipments.
VND database is used to describe the ECU being CM module is a relatively independent component
monitored and the network consists of a number of ECU's providing a set of unified APIs exported from Windows
connected via CAN bus, and to store the configuration dynamic link library [10], which can not only be integrated
information of the protocol of application layer. And VND by AM module, but also be integrated into user-specific
Editor is used to manage VND database thus could flexibly self-developed tools for further development purpose.
configure the protocol of application layer.
In actual industrial applications, a frame of CAN B. VND Database
message usually contains multiple signals in order to make VND database is constructed using object-oriented
full use of its data field. To extract various signals method (key classes of VND database are shown in Fig. 3),
contained in the data field of CAN message, MsgParser to describe the physical structure and information
module is adopted in this architecture to parse the values of organization of the monitored ECU network, which
various signals automatically according to the description consists of three sub-databases: network, ECU node and
record of message (that is transmitted from the monitored message sub-databases. These three sub-databases are
ECU to CAN bus) stored in VND database. independent from each other, and all adopts dynamically
AM module is the software integrated environment for extendable linear structure. As message is the smallest unit
the monitoring system, which realizes the monitoring (corresponding to CAN frame) of data transmission in the
functionality through invocation of CM module, reading network and a signal is only subordinated to a particular
specific file from VND database, passing the message and message, the signal is modeled and implemented as a sub­
its description to and getting extracted value of signals field of message (see details in the description of sub­
from MsgParser module, as well as providing a set of database "message" in this section) according to the basic
standard graphic user interfaces (GUI). principle of object-oriented modeling.
CNetDese
CNodeDese
III. IMPLEMENTATION OF MONITORING SOFTWARE m_Name: CString +m RxMsgNames
m_Protocol : BYlE + m=TxMsgNames m_Name: CString
�4 m_Address : BYlE
����
m_BaudRate : DWORD §��r--=-----"'-
p..--oE m_Comment: CStnng
A. Communication Module (CM) m_Comment: CStnng I
The UML (Unified Modeling Language) class diagram
CSigDese
+m_Recei\erNames
m_Name: CString
of CM module is shown as Fig. 2.
+m_SenderNames
c:::.Cc)�rT1I\11C)dule m_Comment: CStnng
m_ByteOrder: BYIE
CCOfTlfTlModule()
CMsgDese m_StartBit: BYIE
m_Name: CString m_Length : BYIE
CCornrnModule()

mJD: DWORD t:::=..._-----4 m-Factor: float


Lc>adDri�rO
OpenPort()

mJDFormat: BYIE m_Oflset: float


InitChanO

m_DLC: BYlE m_Unit: CStnng


!';ActivateChanO

m_MinVal: double
.Deacti'\.EIteChan()

�� -::�:��( m_Period : DWORD


ClosePortO

m_Comment: CStnng m_MaxVal: double


iver()

m_ValType: BYIE
r )
Receive()
Receive 1 0
SetRxNotification()
ResetClockO
FlushBufferO
.GetDe�nfo() Figure 3. Key classes of VND database
GetLastErrlnfo()
GetErrDescriptionO
�GetRxEventNurnO
RequestChipState()
Flus.hTxBuffer()
Each record in the sub-database "network" is an
FlushRxBuffer()
.GetEventDescription()
instance of class CNetDesc, which not only contains fields
GetDJ"VC:onfig()
GetAppConfig()
used to describe the basic parameters of network (such as
"';SetAppConfig()
GetChanlndex() name m_Name, protocol m_Protocol, communication rate
GetChanMas kO
SetTirnerCycleO
SetChanBaudrateO
m_BaudRate, etc. ), but also is associated with the record
SetChanBitTl",ingPararns()
SetChanBitTirningRegsC2000
in the sub-database "ECU node" via the name of ECU
SetChanOutputModeO node m NodeNames.
SetChanTransceiverO
""';SetChanTxTxrqModeO
SetPortRxModeO Each record in the sub-database "ECU node" is an
SetChanFilter()
instance of class CNodeDesc, which not only contains

ResetChanFilterO
ddChanAcceptlDRangeO
Rerno�ChanAcceptlDRangeO
ransrnitViaChanMaskO
fields used to describe the basic parameters of ECU node
GetChanContrStatus 0
-.!GetChanContrPararTlsO
(such as name m_Name, network address m_Address, etc. ),
SetChanContrPararns()
but also is associated with the records of messages sent
Figure 2. UML class diagram of CM module and received by its own, in the sub-database "message",
via the names of message m_TxMsgNames and
The functions provide by CM module includes: load m_RxMsgNames, respectively.
and unload device driver, open and close communication Each record in the sub-database "message" is an
port, initialize, activate, and release channel, transmit and instance of class CMsgDesc, which not only contains
receive message, set notification for receiving event, set fields used to describe the basic parameters of message
and reset hardware clock, clear transmitting and receiving (such as name m_Name, ID mjD, format of frame
buffer, set acceptance code, set output mode, transmitting mjDFormat, data length m_DLC, cycle m_Period, etc.),
mode, and transmitting request mode for channel, etc. but also is associated with the ECU nodes which send and

274
receive the message via the name of ECU node
m�SenderNames and m�ReceiverNames, respectively. In I__
L "_'�
�' _' � �
PD _ a '" _nd_,"_ n_ M ·� , g
,

_
7
addition, dynamic extension of the number of signal
objects contained one message is supported via a dynamic
object array m�Signals. As a field of message description Construct msgDatalntcl and msgDataMotorola using the

record, each signal object is an instance of class CSigDesc, data pointed by pDala according 10 canMsg.m _OLe

which contains a couple of sub-fields as follows: signal Loop I '" I to total nwnbcr of canMsg.m_Signals, Step"" I
name m�Name, byte order m�ByteOrder (Intel/Motorola
format), position of start bit m�StartBit, length in bits Extract ul1 bits of cllnMsg.m_Signalslll from msgDatalntel or msgDataMotorola;
store th{'"111 in sigData according 10 canMsg.IIl_Signalslll.IIl_By\f..-0rder,

m�Length, proportion m�Factor, offset value m�O./ftet, canMsg.m_ Signalslll.m_StartBit and canMsg.m _Signalslll.mJ_{'"I1gth

units m� Unit, maximum/minimum value m�MaxVal!


m�MinVal, data type m�ValType (signed/unsigned integer,
IEEE float, and IEEE double), actual value m�Val, etc.
C. Management Toolfor VND Database (VND Editor) Calculate
canMsg.m Signalslll.m Val wI Y
VND Editor is implemented as a standalone Windows factor and �n·sct accordi-;;g to
lUlsigncd integer operation mle

application to manage VND database thus model the


monitored ECU nodes and flexibly configure the protocol Convert sigData to a data wI
of application layer. The GUI of VND Editor is shown as type IEEE double; calculate
canMsg.IIl_SigTUlIsIII.m_VIII wI valType = 3'�---''--'
Fi . 4 .
factor and on'sct according to
IEEE double operation rule

_ � x

....... ".. ......


anorn .,uU''''' �I (AI' $, ..4.,,, ..
•"C. ... "'-t.� Il.t cu St_'''� ""
,n.. , •• ,1._ Q.O CAW $t_ • ..-. ".
- el.u""",
- 601r-.<r.r ....... h_ Figure 5. Main flow chart of message parsing module
.".. .�(JI., l.fi .... -ISeHw(dl�t,""(.)lc "fo"I·"I�1
""h.k, ... ,01
.- . -,------
, ..
U[_" E. Application Module (AM)
" .... ,
.,.,. ...... � ..... �
"'�J" ltw, lH r.-3 ......... �,d fii"""3
"""'hf",,, lIIlt I),-H) r.t .. l.I" � �\ ro--­
AM module is the software integrated environment of
- ..,.. SiCl"l'
..,...ccJt' [....... "'.) t.... �1I(h",� the real-time monitoring system, which is also
.". .. .10 ..... 4
$....... .... � .... rr----
""'nr..,., implemented as a standalone Windows application to
1M........ r
."., ....J..
""'ho.p.rU ...
,. ........ . 0.1-.1 ............ _YOl....
realize the features of file management, device control,
view management, monitoring, playback, and
configuration, etc., as shown in Fig. 6.
Figure 4. VND Editor HCreate monitoring file I
AM
HOpen monitoring file I
The main functions of VND Editor include: (1) ,-___--, HSave monitoring file
inserting and deleting record entries, as well as modifYing I
the value of fields contained in each record for each sub­
H File mgmt �H Load VND database file I
HOpen VND Editor I
database ("network", "controller node", and "message"); (2) EXp0l1 all data I
H Export to data file
supporting dynamic extension of the number of signal JExp0l1 data of cunent viewl
objects by inserting signal objects into, or deleting signal YPrint I
objects from their owner message for each record of -iQuick launch I
message; (3) modifYing the attribute value of its sub-fields, -i0pen device I
such as signal name, byte order, start bit, bit length, -i l nit channel(s) I
proportion, offset, units, maximum/minimum value, data H Device control � -1Activate channel(s) I rlTrace window mgmt
type, etc. , for each field of signal object; and (4) checking -1 Release channel(s) I
the validity of data and the uniqueness of primary keys in I I
the configuration database. H View mgmt
-1Close device I HGraphic view mgmt
Signal view mgmt
-iStaJ1
I
D. Message Parsing Module (MsgParser) I H Bus statistics view mgmt
I
H Monitoring f- -1 Pause I -1CoPY figure
MsgParser module is also implemented as an I
independent component in the form of Windows dynamic
..,Resume I rlAII in one step
I
link library, and is used to extract the actual values of
-1Stop I HSta,l from specific pos
1----========----l I
H Playback
various signals from the data field of CAN messages ..,Communication device I
according to the description of corresponding message and I HPause
y Configuration f- -iHW parameters I I
signal(s) contained, in the file of VND database. The main HResume I
flow chart of MsgParser module is shown as Fig. 5, where,
-1Chart parameters I
pData is a pointer to the address of message data (8 bytes -iUpdate cycle I
YStop I
at most), canMsg is a reference to the object of message Figure 6. Main features of AM module
description (which is an instance of class CMsgDesc).
Once the value of a signal is parsed, it will be assigned to The real-time monitoring feature is carried out with an
the field m�Val of the corresponding signal member of assistant thread. Fig. 7 shows the main flow chart of real-
canMsg.

275
time monitoring thread, which could be started, paused, monitor the working process of the ECU of automatic
resumed, or stopped by the user. transmission. During the test, these two AM instances
were configured with same baud rate, chart parameters,
update cycle. The test result shows that data recorded in
the monitoring files generated by two instances are strictly
matched.
N

V. CONCLUSION
y
Aiming at the shortages of compatibility and
Calculate elapsed time
applicability of existing real-time monitoring system for
ECU based on CAN bus, a general-purpose architecture of
Accumulate number of frames and total number of bits
according to format (standard and extended) and type the monitoring system was put forward, and corresponding
(data, remote, and error) of frame respectively; calculate monitoring software has also been developed.
rates of various frames and bus load
The proposed monitoring system has been applied to
the monitoring of working process of ECU of automatic
Lock synchronization section; add statistic data into bus
statistics record table; set document updated nag; unlock
transmission. Tests result show: (1) the monitoring system
synchronization section could be compatible with different CAN interface devices;
(2) the protocol of application layer could be configured
N
flexibly thus could be applied in wide range of fields; (3)
CAN messages could be parsed and the parsed signals
y could be visualized via graphic curves and data form; and
(4) bus statistic parameters could be calculated for
Parsing message; lock synchronization section; add parsed
message into message record table; set document updated
communication analysis. Besides, the feature of playback
nag; unlock synchronization section enables the user to analyze the function and performance
of the monitored system after online monitoring process.
Figure 7. Flow chart of monitoring thread
ACKNOWLEDGMENT

IV. EXPERIMENTAL EVALUATION The authors would like to thank National Natural
Science Foundation of China (Grant No. 60970072) and
Real-time monitoring test has been carried out on the
Research Fund of Key Discipline of Vehicle Engineering
ECU of automatic transmission of an experimental vehicle
of Sichuan Province (Grant No. SZD041O-08-0) for
using the proposed system architecture and developed
fmancial support to this project.
software. As shown in Fig. 8, the monitoring system can
not only trace the original information of CAN message,
but also display the parsed signals via graphic curves and REFERENCES
data form simultaneously, during real-time monitoring of
[I] ISO, "ISO 11898-1 2003(E) Road vehicles - Controller area
the working process of automatic transmission. In addition, network (CAN) - Part I: Data link layer and physical signalling,"
the system updates the statistic parameters such as bus load, 2003.
peak load, as well as numbers and rates of various [2] F. Luo, J. Su, and D. H. Yuan, "Vehicle electronic networks and
messages periodically during the real-time monitoring bus standards," Automotive Engineering, vol. 25, Apr. 2005, pp.
process via the bus statistics window. 372-376.

tlh C-..v.J. 1'" .... 1_ o .....� ;""110 I)",," Io1;t


[3] Y. Leng, Q. X. Li, S. Liu, and T. L. Dong, "Direct tire pressure
Dolg .. .. . o f'll monitoring system based on wireless sensor and CAN bus,"
Chinese Journal of Scientific Instrument, vol. 29, Apr. 2008, pp.
,; .
, .1. ... _
�I _. 711-717.
:!::�:::;:;::"-
-. ..........,
�:::::�:�:
1". ... ..1 ..'. �* :10 ..
• -,oJ..(\JIo". ,.......I ..t. 1$41 oJ•••
[4] Z. G. Yang, and B. Sun, "Development of supervisory system for
_1 ...
\,. ,""ooIo ••r ..,. " >ooA

rubber manufacture based on CAN bus," Chinese Journal of


Scientific Instrument, vol. 29, Apr. 2008, pp. 1686-1689.
I.,."
' �L ...
.. ,.
[5] T. Zhang, L. Zhu, Y. L. Yuan, C. L. Wang, and D. H. Chen,
.
.. "Development of CAN based monitoring platform for HEV,"
Automotive Engineering, vol. 30, Jun. 2008, pp. 496-500.

f�
�04
[6] T. Kozak, D. Makowski, and A. Napieralski, "Distributed
Radiation Monitoring System for Linear Accelerators Based on
CAN Bus," Proc. the 16th International Conference "Mixed Design
of Integrated Circuits and Systems" (MIXDES 2009), Lodz, Jun.
2009, pp. 107-110.
Figure 8. Real-time monitoring of the ECU of automatic transmission [7] 1. da Silva Sa, J. J. da Silva, M. G. Wanzeller, and 1. S. da Rocha
Neto, "Monitoring of Temperature Using Smart Sensors Based on
To evaluate the compatibility of the developed real­ CAN Architecture," Proc. the 15th International Conference on
Electronics, Communications and Computers (CONIELECOMP
time monitoring system, a laptop was equipped with two
2005), Puebla, Feb. 2005, pp. 218-222.
different CAN interface cards (one is CANCardXL from
[8] SAE, "SAE JI939 Recommended practice for a serial control and
Vector Infomatik GmbH, the other is USBCAN II from communications vehicle network," 2005.
Guangzhou ZLG MCU Development Limited Corporation) [9] CAN in Automation, "CiA 2011207 DS V1.1 CAN application
connected to CAN bus, the ECU of automatic transmission layer for industrial applications," 2005.
was also connected to the same CAN bus, two instances of [10] X.Yin, "CM User Guide (V2.0)," ATCESL Lab, Sept. 2009.
AM module launched simultaneously on the laptop to

276

Você também pode gostar