Sie sind auf Seite 1von 6

Software Development of Automotive Engine Electronic Control Unit

Chengwu Wang
1,2,a,*
, Feng Luo
1,2,b,*

1
College of Automotive Engineering, Tongji University, Shanghai, China
2
Clean Energy Automotive Engineering Center, Tongji University, Shanghai, China
a
wangchengwu4725@163.com,
b
luo_feng@tongji.edu.cn
Keywords: Engine management system, Electronic control unit, Software design, 32-bit MCU.
Abstract. Due to increasing restrictions on dynamics, fuel economies, emission behavior, higher
requirements are put forward to hardware and software of engine electronic control unit (ECU). To
improve real-time response, control accuracy, network performance and stability of ECU, a new
engine electronic control software is developed based on closed-loop control system and some basic
parameter computational formulas. A software program for engine electronic control system based on
a 32-bit microcontroller named MPC5634M is designed in modular and hierarchical programming
method. The program performs the basic functions of sensor signals gathering, calculation of
injection and ignition, actuators driving, etc. This article will introduce related content about software
architecture, control logic based on new functions and characteristics of 32-bit MCU.
1. Introduction
Since the early 1990s, the application of automotive engine electronic control system has became a
main method to improve the dynamics, fuel economies, emission behavior of vehicle.
An automotive engine electronic control system usually consists of hardware and software. It will
possess all kinds of sensors to get the real-time information of engine's working condition, these
sensors include but not limited to crankshaft position sensor, intake manifold air temperature and
pressure sensor, coolant temperature sensor, knock sensor and exhaust oxygen sensor
[1]
. Electronic
control system will handle the signals from sensors properly and transfer them to the MCU, then the
best working parameters for the engine will be calculated and the control signal will be outputted to
drive the actuators such as fuel injectors, igniters and exhaust gas recirculation system.
Making full use of the hardware resources of 32-bit MCU MPC5634M, we can develop much
better automotive engine electronic control system to greatly improve the performances of our
vehicles. That's the main point of this research.
2. Basic electric control logic
2.1 Fuel charge control
This automotive engine electronic control system realizes accurate control of air-fuel ratio by
real-time adjusting fuel charge per cycle. MCU gets signals from extern sensors and calculates the air
intake flow at each cycle, and then the electronic control system determines the amount of fuel
injection to control the air-fuel ratio and makes the engine working at best operation points.
Furthermore, so-called best operation point is not a fixed value and there will be different operation
points according to engine characteristics and specific working conditions, so these points should be
tested through experiments and stored in the data storage area of MCU.
To calculate the amount of fuel injection, ECU should get the air intake flow. Some ECU uses
mass air flow sensor to get air intake flow directly, but mass air flow sensor is quite expensive so


2012 International Conference on Power and Energy Systems
Lecture Notes in Information Technology, Vol.13
978-1-61275-011-8/10/$25.00 2012 IERI ICPES2012

147


another way called speed-density method is adopted. Intake manifold temperature and pressure
sensor is used to get the intake air temperature and pressure signals. Then we can calculate air intake
flow through the Ideal-Gas equation below.
m
f
=
P
in
V
h

v
RT
in
. (1)
P
in
: intake manifold air pressure, V
h
: cylinder capacity,
v
: volumetric efficiency, T
in
: manifold air
temperature.
Then we can calculate the amount of fuel injection: m
a
:
m
a
=
P
in
V
h

v
RT
in
A
F

. (2)
In consideration of fuel injector parameters, we can get the injection pulse length Tp:
T
p
=
V
h
m
f
RT
in
A
F

= f(P
in
, n) . (3)
From the equation (3), the conclusion is drawn that injection pulse length is a function mainly
affected by manifold air pressure and engine speed "n", intake manifold air temperature makes little
difference and its effect can be considered by adding temperature correction coefficient K
AT
.
Software will visit data storage and find T
p
based on P
in
and n.
Injection pulse length T
p
we've got in equation (3) is got under ideal condition, many correction
factors should be added to the equation to improve accuracy of control. The finally equation should
be:
T
0
=T
P
K
AT
(1+K
TW
+K
AS
+K
AL
+K
L
+K
P
)+T
U
+T
acc
. (4)
T
P
: basic injection pulse length, K
AT
: intake manifold air temperature correction coefficient , K
TW
:
engine warming correction coefficient, K
AS
: engine starting correction coefficient, K
AL
: engine idling
afterwards correction coefficient, K
L
: engine idling correction coefficient, K
f
:EGO feedback
correction coefficient, T
U
: voltage correction coefficient , T
acc
: speed up correction coefficient
[4]
.
These coefficients are determined by the practical engine parameters and should be confirmed
through a great quantity of experiments and in this electronic control system, their present value is 1
while the software structure is well built and the value can be set again when needed.
2.2 Spark advance angle control
Spark advance angle is another important parameter which has a great effect on engine performances.
The ideal spark advance angle should keep engine working under the condition of slight combustion
knock to improve dynamic and economy without producing much gas emission and noise. Best spark
advance angle comes from the following equation :
f(nPt
1
t
2
, ) (5)
n: engine speed; P: engine power; t
1
: coolant liquid temperature; t
2
: manifold air temperature; :
air-fuel ratio.
Just like the calculation of injection pulse length above, it's unrealistic to directly get spark
advance angle from the equation and we just consider the basic two influencing factor: engine speed
and intake manifold air pressure, then we get an angle called basic spark advance angle from MCU
memory space, the data stored in the memory is got from a great quantity of engine bench tests. Next,
we will have some correction coefficients to reflect other secondary influencing factors including
coolant temperature, air intake temperature, lubrication pressure, idling operation, acceleration and
deceleration operation.
148


The control target of spark advance angle is to keep engine working under the condition of slight
combustion knock, so the system should keep the angle fluctuate around the best spark advance angle.
A closed loop control system well satisfies that need. The signal from a knock sensor plays the role of
a feedback signal, when ECU detects stronger knock signal than the value preset, ECU will decrease
the spark advance angle, on the contrary, it will increase the angle to improve dynamic property and
economy.
3. Electronic control software design
An outstanding electronic control software for MCU should not only perform the tasks such as sensor
signals gathering and A/D conversion , control logics implement, fault diagnosis,actuator driving but
also have the characteristics of real-time response, stability and program portability. To achieve these
goals, development methods are quite important. In this software system, Codewarrior integrated
development environment developed by Freescale helped accomplishing modularized, hierarchical
software designing
[2,3]
.

Fig.1. Program structure diagram
The software is divided into three layers: bottom layer dealing with program initialization, MCU
I/O pins definition and external devices access, interlayer dealing with real-time task scheduling , top
layer dealing with modules to accomplish tasks including sensor signal gathering and transition, table
lookup , calculation and actuators driving.
3.1 MCU initialization module
To create an appropriate operating environment for the program, some initialization work should be
done at first, when the MCU powers on, initialization module runs first and does the following works
including reset source confirming, signal process engine activation, memory space deploy, phase
locked loop(PLL) initialization, CPU initialization, external clock initialization, I/O pins function
setting.
The MCU made for automotive industry offers a standard startup code and we can directly visit the
BAM (backstage administration module) to accomplish these works. Pay attention that I/O pins
function setting should be done in the beginning of the program because most I/O pins are multiplex
and should decide their function by setting corresponding control registers from PCR0 to PCR345.
This part of program can be found in a subprogram named "Initialization.c".
3.2 Sensor signals gathering module
As already stated, ECU gather signals from lots of sensors to get information of engine working
condition. ECU gathers signals periodically from intake manifold temperature and pressure sensor,
149


and the period is decided by the timer that triggers the subroutine which gets sensor signals and
converses them from analog quantity to digital quantity.
After gathering the manifold air temperature and pressure signals, ECU will converse them into
digital signal. The sensor signals are actually put into A/D conversion channels (AN8 and AN9 ),
MPC5634M supports 12-bit A/D conversion which means its accuracy can be 1mV, compared to
8-bit A/D conversion of 16-bit MCU, we can realize much more accurately signal gathering. Then the
program checks the two dimensional tables stored in the memory to get real physical quantity of the
digital signal , DMA(direct memory access) function help transfer the data and it will be explained
later.
3.3 Engine speed and crank phase angle signal gathering module
The crank phase angle sensor exports a 58 teeth signal to the MCU. This signal is connect to the
eMIOS9 channel and MCU will record the time of every failling edge, and calculates time slot
between two falling edges.

Fig. 2. Crank phase angle signal pulse scheme
Then the program does a judgement named "ABa":
If TBkT
A
T
B
kT
a
k=2.5, period B is the missing tooth and we get crank phase angle,
engine speed "n" will be 10000000/Ta rpm. If not, the program can confirm that period B is not the
missing tooth and the program can also get engine speed "n," it will be 10000000/TB rpm, and the
program will go on to get another crank angle phase signal.
The engine speed signal "n" will be stored in a global variable "n_REAL" and be used in other
subprograms including intake manifold temperature and pressure gathering module, injection and
ignition module.

Fig. 3. Engine speed and crank phase angle signal gathering module program flow diagram
It's worth noticing that engine speed n is gotten from a fractional number, MPC5634M possesses
powerful point calculation function which help us improve calculation and control accuracy, what's
more, to avoid overflow error of division, the program should notice that at the very first point,
global variable T
B
should be set an starting value because at first gathering cycle, the engine speed
150


will be 10000000/TB rpm, I set T
B
to be 10000 and starting value doesn't matter much because
engine speed "n" will soon be updated next circle.
3.4 Injection and ignition module
Injection and ignition module is the most important part of the program. Its real-time performance has
a great effect on the dynamic and economy of engine. So this module has the highest priority level.

Fig. 4. Engine injection and ignition module program flow diagram
When program is started and waiting in the main cycle, ECU gathers 58 teeth signal and after a
judgement method named "ABa", ECU updates engine speed variable and crank phase angle signal.
At the same time, sensor signals gathering module is working and intake manifold temperature and
pressure signals are updated every 1ms. ECU reads the crank phase angle signal and generates a
software interrupt at the right tooth before ignition.
Then the program enters injection and ignition module, it will look up the spark advance angle
table based on engine speed signal and intake manifold air pressure signal to get the basic spark
advance angle. Then the basic spark advance angle will be corrected by coefficients determined by
the practical engine parameters, considering other factors of influence such as intake manifold air
temperature, engine starting condition, engine warming condition, engine idling condition.
3.5 Real-time interrupt handling
Lots of real-time tasks need to be handled. Considering traditional linear and circulatory program
structure can't meet the needs, MCU uses interrupt mechanism to invoking complex real-time tasks.

Fig. 5. Interrupt handling program flow diagram
151


MPC5634M can receive and respond to two kinds of interrupt request, critical interrupt request and
non-critical interrupt request from 308 interrupt sources including 8 software interrupt sources. This
interrupt handling mechanism allows interrupt nesting and every interrupt source has an interrupt
priority as many as 15 levels. Modules which have higher real-time require should have higher
interrupt priority to guarantee their request handled at the first time.
The MPC5634M is a family of system-on-chip devices that are built on Power Architecture
technology. Its core frequency is 80MHz providing faster operating rate. And it also has many
enhanced functions developed specially for automotive industry such as DMA (direct memory access)
channels, eMIOS (enhanced modular input-output system) Channels, eQADC (enhanced queued
analog-to-digital converter) channels, eSCI (serial communication interface) and so on.
3.6 eDMA function
DMA(direct memory access) technology has been developed for a long time and it allows two-way
data transmission between high-capacity devices and memories. However, the eDMA function is
different because it allows data transmission between internal memory like flash memory, SRAM and
I/O external devices.
Processor core of MCU without DMA function will have to stop their work when I/O external
devices request data transmission. These requests interrupt processor core and have a bad effect on
real-time performances. eDMA function will provide a host machine in the bus and allows data
transmission between resources in chip and I/O external devices without occupying processor time.
In this program, the intake manifold air temperature, pressure digital signals after A/D conversion,
engine speed and crank angle phase signals are transferred by eDMA function.
4. Conclusions
This project takes full advantage of new functions and features of 32-bit MCU MPC5634M to
develop an automotive engine electronic control system.
Using hierarchical structure and modular programming method to improve readability and stability
of the program, making full use of computing power and memory space of MCU, increase sampling
frequency and table checking sampling density to improve accuracy. Using interrupt handling
mechanism and eDMA technology To improve real-time performances of ECU.
New developments in electronic industry will have a great effect on automotive engine electronic
control system. Only by keeping up with the latest developments can we improve the performances of
ECU continually.
References
[1] Yang Nan. Research and development of general engine electronic control unit. Central South
University master's degree paper, (2009).
[2] Bao Shengzhong. Electronic control unit design and simulation system research of a
four-cylinder gasoline engine. Central South University master's degree paper, (2007).
[3] G. Mercalli et al. A New Automotive Real Time Engine Control System With 32 bit
Micro-controller. SAE paper 945002.
[4] Zhang Cuiping. Development and experiment research of injection and ignition control system.
Taiyuan University of Technology doctoral dissertation,(2007).
152

Das könnte Ihnen auch gefallen