MegaSquirt Scrapbook
All of this is just scrapbooking until I get my thoughts (and a full page) together. I’m going to list my assumptions and hardware that I use for each page/piece of information, since there’s so much different information online about these things, and the reason for me compiling the information into one source is so that I can filter out what I don’t need.
Currently the plan is to use EDIS with a MegaSquirt-II processor on a v2.2 MegaSquirt board. I’ll probably upgrade to a v3.0 board if I have a need for it later, but when I started this six months ago, the v3.0 boards weren’t out (I really should have waited a few weeks, they were released not long afterwards :()
Ford EDIS
MegaSquirtII EDIS information page
The EDIS system handles the complete task of crank/ignition synchronization as well as current control for the wasted-spark coils. It sends just one signal (PIP) to MegaSquirt-II, and receives just one signal (SAW) back. The desired amount of ignition advance is generated by MegaSquirt-II. The interface between the EDIS and MegaSquirt-II is extremely simple. There is one output signal (PIP) and one input signal (SAW) from the EDIS module MegaSquirt-II.
On all engines, the complementary coils are connected to the cylinders that are 360° (i.e., ½ of a 720° engine ‘cycle’) apart in the firing order. For example, the firing order for HO 5.0L and 351 engines is 1-3-7-2-6-5-4-8. Connect cylinders 1 and 6 to the same coil, 3 and 5 to another coil, 7 and 4 to another coil, and 2 and 8 to the remaining coil. Note that the coils are packages in two groups of two coils (each of which fires 2 cylinders) in V8 applications.
The operation the EDIS system is very simple. The crankshaft is fitted with a 36-tooth wheel, with one tooth missing. The missing tooth indicates the exact position of the crankshaft to the EDIS. The EDIS system is a wasted-spark setup (i.e. two spark plugs fire which are separated by 360 “cycle-degrees” of a 4-cycle engine), so there is no synchronization with the camshaft. This means that one cylinder has its spark plug firing during the valve overlap period near top dead center, but because the pressures are so low and the charge is diluted by the exhaust gases, no ignition occurs. This spark is ‘wasted’ on a cylinder that isn’t firing, and EDIS is referred to as a ‘wasted spark’ ignition system.
Near the crank wheel is a Variable-Reluctance (VR) sensor - this sensor produces a bipolar signal. The VR sensor is pointed at the center of the crank wheel, with a 0.030 to 0.060 inch gap (0.75 mm to 1.5 mm) to the crank wheel teeth.
The VR sensor and 36-1 crank trigger wheel must be set in the correct relationship to each other. With the engine at TDC for cylinder #1, exactly nine teeth (90°) ahead of the missing tooth for a 4 cylinder engine.
With the above configuration, the EDIS module will fire the ignition at 10° BTDC, unless the module receives a Spark Angle Word (SAW) command. The 10° advance is constant, regardless of RPM. This functions as a limp-home mode; if the module doesn’t receive SAW commands from MegaSquirt-II, it will generate a usable (but not optimal) 10° BTDC of ignition advance.
To test the VR sensor alignment, run the EDIS in limp home mode. This can be done by disconnecting the SAW/PIP plug, or disconnecting MegaSquirt-II (or its power).
Start your engine and check that the timing is exactly 10° BTDC with a timing light on cylinder #1. If the timing isn’t 10° BTDC, adjust the position of your VR sensor until the timing is as close to 10° BTDC as you can get it. Don’t forget to reconnect the SAW/PIP plug when you are done, or you will have NO timing advance and your engine will run poorly and inefficiently.
The VR sensor signal polarity is such that when the tooth tip is exactly centered on the VR sensor, the VR output is at zero volts falling from a positive to a negative polarity - i.e. a zero-crossing with a negative slope. The VR signal is fed directly into the EDIS module, to indicate the crankshaft’s position. The EDIS module handles all VR signal processing. In fact, the EDIS module has a built-in VR signal hysteresis - when the VR signal is passing from negative to positive polarity (next tooth is approaching), the signal must reach +0.5 volts before the EDIS module will “arm”.
It then will “trigger” when the signal passes through zero on a positive to negative transition, which occurs when the VR sensor tip is aligned with the crank wheel tooth.
Using the VR signal and the ‘missing tooth’ wheel, the EDIS module can synchronize with the engine crankshaft.
When the EDIS module receives proper a VR signal, it generates a 12-volt square-wave signal with a period linked to the next cylinder to fire. In other words, when this signal (Ford calls it the PIP, for Profile Ignition Pick-up) goes from +12V to ground, one of the ignition coils is firing. This signal follows the ignition coils, not the VR sensor (as indicated on some incorrect documentation floating around).
For an EDIS-8 module, there will be four complete cycles of the PIP waveform for every 360 degrees crankshaft, or thirty-five VR signal cycles (not 36 because of the missing tooth). An EDIS-6 will yield three PIP cycles per every 360-degrees crank, and an EDIS-4 gives two.
For example, with an EDIS-8, we have 9 VR sensor cycles (or 8 if the ‘missing tooth is in that sector) for every 90° of engine rotation, and this corresponds to the period between coil firings (on two cylinders, one of which is wasted). So during this period, the coil has started low, gone to 12 volts to charged the coil, then gone low (grounded) to fire the plugs. The duration of the PIP signal is based on the desired coil dwell period, and is calculated internally by the EDIS module.
The spark advance is controlled by the Spark Angle Word (SAW) line on the EDIS module. The SAW is a pulse width of a specific duration that tells the EDIS system when to fire the spark plugs. It is calculated as follows:
SAW = ZTDC - (ST × T × 2.sup.x/CMI)
where:
- SAW is the calculated pulse width (in microseconds)
- ZTDC is the pulse width offset corresponding to the SAW pulse width for a spark advance of 0° TDC
- ST is spark advance in degrees, and is negative for spark angles after top dead center (ATDC)
- T is the pulse accumulator clock period (in microseconds)
- 2.sup.x is the number of steps between position signals for a desired spark resolution and x is a whole number and
- CMI is the engine crank marker interval, i.e., the number of degrees of crankshaft rotation between signals from the position sensor.
A top dead center offset value is selected as 1536 microseconds (i.e., ZTDC=1536). A clock period of four microseconds (4µsec) is used in the pulse accumulator, corresponding to a clock frequency of 250 KHz. The crank marker interval is 10° and a desired resolution within the 10° intervals is chosen as 64 discrete steps, i.e., x=6. The formula for determining SAW pulse width is thus:
SAW = 1536 - (25.6 × (desired spark advance in degrees)) (in µsec)
Range: 64 - 1792 µsec (57½° BTDC to 10° ATDC)
Resolution: 4 µsec (5/32 of a degree)
For example, for 36° of advance, we want MegaSquirt-II to send a SAW of:
SAW = 1536 - (25.6 × 36°) (in µsec)
= 1536 - (922) (µsec)
= 614 µsec
The width of the SAW word in degrees is related to the desired advance by the above equation. At first glance, it looks odd, but it does make sense (depending on the hardware generating the width). With a microcontroller timer peripheral, most timers use a counter 16-bits in length, and they have a mode known output-compare, which is used to make an output toggle when the counter reaches a comparison value. Using a 16-bit timer incrementing at a 1 microsecond rate, and a 16-bit comparison register to toggle the output, one can easily generate the required period. In fact, the numbers are quite easy to use - see the following table for example SAW advance widths and corresponding 16-bit timer compare values:
| Advance Degrees |
SAW Pulse Width (µsec) |
High-order 8-bits |
Low-order 8-bits |
| 10° | 1280 | 0×05 | 0×00 |
| 20° | 1024 | 0×04 | 0×00 |
| 25° | 896 | 0×03 | 0×80 |
| 30° | 768 | 0×03 | 0×00 |
| 40° | 512 | 0×02 | 0×00 |
| 50° | 256 | 0×01 | 0×00 |
| 55° | 128 | 0×00 | 0×80 |
The numbers now make a little more sense. The high-order of the 16-bit timer drives every 10 degrees, and the lower 8-bits drives the advance values in-between. This makes generation of advance widths very easy with a microcontroller. The Ford engineers knew what they were doing!
The PIP signal is used as a reference to synchronize the generation of the SAW pulse by MegaSquirt-II. The SAW signal is generated by MegaSquirt-II and is an input to the EDIS module. This signal is a +5V positive square wave pulse, and the width of this pulse determines the advance that the EDIS module will use for subsequent ignition events, up to a half second or so. If the SAW signal is lost for much longer than this, the ‘limp-home’ mode is enabled, and advance is set at 10° BTDC. So the SAW signal does not have to be sent on every PIP cycle - the EDIS module will remember the last SAW commanded advance and “remember” it for subsequent ignition advance values until a new pulse is received or until ‘limp-home’ mode is enabled.
Note that the SAW pulse must be synchronized with the PIP negative going pulse (i.e, when the PIP drops to zero). It cannot be applied asynchronously to the PIP signal, otherwise incorrect advance commands will be interpreted by the EDIS module. SAW should be initiated a short period after the falling edge of the PIP signal.
A significant part of the whole EDIS module is the multiple-coil drivers. First thing is that the EDIS module has the actual ignition coil driver built-in - the driver is not part of the Ford wasted-spark coil pack. The coil packs are just standard ignition coils, and could in theory be substituted with other coil-only packs. The EDIS-8 module has four coil drive channels - EDIS 6 has three, and the EDIS-4 has two. The EDIS module handles the dwell time automatically, depending on commanded advance and RPM - another feature which makes the EDIS one of the easiest to use DIY setups.
The ordering of coil drive fire for the EDIS-8 is coil A, B, C, D, A, B, C, D, A… - it just round-robins through each of the coil drives. This is important to know when setting up firing order for the destination engine. The EDIS ignition system is rugged. The module mounts under-hood and will survive engine-bay temperatures, water, freezing, etc. And with only two wires going back to the MegaSquirt-II box (PIP and SAW), wiring is extremely easy.
Installing the Ford EDIS System
The SAW signal from MegaSquirt-II to the module comes out on pin #17 of the 40 pin socket (labeled IGN), and is connected to the 5th hole of the JP1 socket (pin 8 of the MC9S12C32) on V2.2 boards (JS10 on V3.0 boards). The PIP signal goes to MegaSquirt-II via the DB37 pin 24. This is connected to pin 14 of the 40 pin socket (IRQ), and pin #1 of the MC9S12C32 processor.
To install EDIS with MegaSquirt-II, you connect:
V2.2 main board:
- the 5th hole of JP1 to the SAW pin (#3) on the EDIS module (which you can jumper to an unused DB37 pin, if you want)
- the PIP pin (#1 on the EDIS module) to DB37 pin #24.
Here are the EDIS pin-outs for the EDIS4:

- Trigger offset = 10° (this will vary, depending on the wheel/pickup configuration)
- Ignition Input Capture to ‘Falling Edge‘
- Cranking Trigger to ‘Trigger Return‘
- Coil Charging Scheme to ‘EDIS‘
- Spark Output to ‘Going High (Inverted)‘.