ECMs & Kernals

rr RRauscher at nni.com
Tue Sep 4 22:03:51 GMT 2001


Several folks inquired about the internal works of the kernal. I've
also changed the subject line.

BobR.

---------------- cut here -----------------------------------

An ECM needs to run routines at a set pace. This is quite different
then the computer that you are using to read this. The computer on
your desk is event driven. That is it doesn't do anything unless
an outside influence causes it to. The mouse cursor moves when the
mouse is moved. Files are written or read from disk when you make the
request. Otherwise it just sits there waiting for something to do.

The operating system in the ECM is the opposite. As it is required
to run tasks at a set pace it is known as a real time operating system.
These tasks will run at the same pace if the engine speed is 1000 RPM
or 5000 RPM. Each and every input and output (sensor or status
line), will be serviced at the same pace no matter what is happening
with the throttle, load, vehicle speed, whatever. (with the exception
of engine running or not running. this will change how some routines
operate).

(Note that this particular information is 99.9% '7747 related. Other
ECMs will operate in different ways. However, the methodology is
carried across the GM line of ECMs).


When the ECM is powered up (ignition on), the init routine is run.
This routine sets up the hardware registers and such, checksums the
EPROM, checks to see if battery was lost, init's RAM, reads all of
the sensors and in general gets the ECM ready for operation.

Once the init routine completes it jumps to a location which is
nothing more than a loop. The code sits in the loop until a IRQ1
interrupt occurs. During the init routine the hardware was setup
to interrupt 160 times a second. It is this interrupt that the
ECM is waiting for. This is the mechanism used to drive the real
time kernal scheduler. This is interrupt IRQ1.

The code has a counter that counts up once each time the interrupt
occurs. Once this value reaches 160 it is reset back to 0. Many
routines use this counter to do additional time & duration tests.
This counter is also used to run the proper major loop (1 of 16).


OK, whenever the IRQ1 interrupt occurs the ECM will run the kernal
routine. The kernal is responsible for several misc tasks and then
the task of running other routines. The misc tasks include reading
the MAP sensor value, checking for VSS and DRP pulses, kicking the
ALDL bit one shot, updating the one second counter, etc.

The kernal will then run either the minor fuel loop or the minor
spark loop. These loops are run on alternate IRQ1 interrupts. The
spark loop is run on even counter values and the fuel loop is run
on odd counter values.

The minor fuel loop handles the VE% lookup and calculates the BPW.
Also handled is programing the hardware for injector pulse width,
AE, PE, DFCO, decel enleanment, proportional terms, integrator,
BLM, reading the O2 and TPS sensors, etc.

The minor spark loop handles the main spark lookup, coolant comp,
knock retard, PE spark, min & max SA, programing the hardware for
the actual SA. The EST test is done at the end of the loop.

When the minor fuel and spark loops complete they return to the
kernal.

The kernal will then run one of sixteen major loops in a round-robin
fashion. It uses the lower 4 bits of the 160 hz counter to index
into a table. The table contains the addresses of each major loop.
Hence each of these loops will run 10 times a second, or every
100 msec. Each loop has a different set of tasks to complete. One
loop is set to do most of the diagnostics, another loop handles EGR
functions, another handles O2 filtering, battery under & over voltage
and MCU2 output. Another handles IAC functions. Another handles
reading the coolant sensor and doing diagnostics on it. Some loops
do nothing, they return immediately. Several loops handle RAM refresh.
Another loop handles the decay of spark & fuel choke terms.

Once completed each of these loops return to the kernal. A test is
done to check for an IRQ1 overflow. The kernal then sits in the
same loop as before waiting for the next IRQ1 interrupt. And the
process repeats. This time the opposite minor loop is run and the
next major loop is run.

--




----------------------------------------------------------------------------
To unsubscribe from gmecm, send "unsubscribe gmecm" (without the quotes)
in the body of a message (not the subject) to majordomo at lists.diy-efi.org




More information about the Gmecm mailing list