MicroSquirt® Dual Spark

The major new feature in MicroSquirt® v2.8+ embedded code is the capability to use two inputs and two outputs for ignition. This allows a number of possibilities in addition to the tach input (one tach input pulse per ignition output pulse) and the missing tooth code that was already there. The new options allow independent dual outputs for odd fires engines (such as the V-twins in many motorcycles), as well as camshaft synchronization for crank wheels and dual outputs.

Note that Dual Spark usage precludes the use of Ford's EDIS ignition system, and trigger return cranking mode cannot be used either.

The hardware is based on MegaSquirt-II™ hardware. The processor is the same. However, two processor pins were 're-purposed' to become the second spark input and output. The additional ignition input #2 (VR2in on Ampseal pin #4) is taken from the injector driver 1 pulse width modulation (PWM) processor pin (PT2), and the second ignition output (IGN2 on Ampseal pin #11) comes from the Injector 2 PWM pin (PT4). The result is that for MicroSquirt® you can not have injector PWM current limiting control (since these ports are now performing the second ignition function). It is recommended that you add the appropriate current limiting injector resistors if you are running low impedance injectors.

The 'original' MS-II™ ignition I/O are on PT0/PT5, and they are designated "Input 1" and "Output 1".

Processor
Port
Ext. CircuitAKA.Ampseal
PT0
TachIC
VRIN+/-
OR
OPTIN+/-
Input 1Ampseal 32/33
OR
Ampseal 30/31
PT2
TachIC2
VR2IN+Input 2Ampseal 4
PT4
IGN2
IGNOUT2Output 2Ampseal 11
PT5
IGN
IGNOUTOutput 1Ampseal 12

The Dual Spark option in v2.8+ code allows:

  • 1 or 2 cylinder COP or wasted spark, and
  • 4 cylinder wasted spark from the following possibilities:

    MegaTune Option
    under 'Advanced Ign./Dual Spark'
    Total TeethMissing TeethCrank InputCam InputOutput PatternTypical Usage (others possible)
    Single Spark
    (MS-II™ and MicroSquirt®)
    Tach InputNo dual sparkSet M=0n/aInput 1n/aOutput 1 onlydistributor
    Missing ToothNo dual sparkMNInput 1n/aOutput 1 onlydistributor with missing tooth crank wheel

    MegaTune Option
    under 'Advanced Ign./Dual Spark'
    Total TeethMissing TeethCrank InputCam InputOutput PatternTypical Usage (others possible)
    Dual Spark
    (MicroSquirt®;
    MS-II™ requires modifications - see below)
    1. Independent Dual Ignition
      a. Dual Crank SensorsDual tach inputsSet M=0n/aInput 1 & Input 2n/a
  • Output 1 driven by Input 1
  • Output 2 driven by Input 2
  • V-Twin odd-fire, 2 crank triggers
      b. Dual Cam SensorsDual tach inputsSet M=0n/an/aInput 1 & Input 2
  • Output 1 driven by Input 1
  • Output 2 driven by Input 2
  • V-Twin odd-fire, 2 cam triggers
    2. Normal Crank Trigger w/ Cam Synch (cam sync can be set to rising or falling edge)
      a. Tach trigger
  • Rising cam sync w/tach or wheel,
  • Falling cam sync with tach or wheel
  • M=cyl/2N=0Input 1Input 2Output 1/2 alternate2-cylinder COP with distributor trigger (or crank teeth = number of cyl/2) + cam trigger
      b. M-0 crank wheel
  • M-0 Wheel w/ Falling Cam Signal,
  • M-0 Wheel w/ Rising Cam Signal
  • M (≠0)N=0Input 1Input 2Output 1/2 alternate1 or 2-cylinder COP with flywheel trigger + 1 tooth cam trigger
      c. M-N crank wheel
  • Rising cam sync w/tach or wheel,
  • Falling cam sync with tach or wheel
  • M (≠0)N (≠0)Input 1Input 2Output 1/2 alternate1 or 2-cylinder COP with crank wheel + cam trigger
    3. M-N Crank Wheel w/ No Cam Synch
      a. M-N crank wheelSingle crank wheel inputM (≠0)N (≠0)Input 1n/aOutput 1/2 alternate1, 2 or 4-cylinder wasted spark, crank trigger and no cam trigger
      b. M-N crank wheelTwo crank wheel inputsM (≠0)N=0Input 1Input 2Output 1/2 alternate1, 2 or 4-cylinder wasted spark, crank wheel and 1 tooth crank trigger
    4. M-N Cam Wheel Only (no crank wheel)
      a. M-N cam wheelSingle cam wheel inputM (≠0)N (≠0)n/aInput 1Output 1/2 alternate1 or 2-cylinder COP, cam synch but no crank signal
    MegaTune Option
    under 'Advanced Ign./Dual Spark'
    Total TeethMissing TeethCrank InputCam InputOutput PatternTypical Usage (others possible)

    Dual Spark Option Notes:


    1.Independent dual ignition: This would typically be used for a two cylinder motor, but also can be used with a 4 cylinder engine and wasted spark. It uses two independent tach inputs on VRin1 and VRin2 (NOT a wheel input in the sense that there are not many teeth, just one per cylinder). It is intended primarily for 2 cylinder 'odd-fire' engines. Such engines include the Harley-Davidson (45°), MotoGuzzi (90°), Ducati (90°), Suzuki (75°), and Honda (52°) V-twins.

    Alternating tach pulses from two crank or cam wheel sensors (which are physically offset with respect to each other) are fed to the two ignition input circuits and they produce two ignition outputs to separate coils. This can be odd or even fire - it doesn't matter because the pairs of input/outputs are independent.

    Input 1 triggers one injection channel (INJ1) and one ignition channel (Output 1), the other input (Input 2) triggers the other coil (Output 2) and injector bank (INJ2). Global things like RPM, etc. are computed from the channel 1 input. Since they are independent, the crank degree spacing between them (i.e. delta T between channel one and channel 2) does not matter. So the unit supports odd-fire, and it also injects based on which input (Input 1 fires injector 1, Input 2 fires injector 2).

    If you have an even fire engine, then try to make the input sensors 180° apart (i.e. directly opposite). With independent dual inputs and outputs, the odd-fire angle is generally built into the sensor location from the factory to reflect the offset in firing of the two cylinder banks. If this is the case, do NOT set the second output offset (odd angle) under Advanced Ignition menu. Otherwise the offset would be applied twice, which would not be correct.

    In this mode you cannot set the 'toothed wheel', 'trigger return', or 'EDIS' options - they won't work. Also, set the ignition ISR time mask, and the percent mask the same as in non-Dual Spark mode.

    a. Crank trigger: This is for dual independent crankshaft sensors. The number of teeth on the crank wheel must be the one-half (½) the number of cylinders. For a V-twin, this single tooth results in two tach signals per revolution, one from each sensor. This will run the coils in 'wasted spark' mode (for a 4 stoke engine), where they will fire on the compression and exhaust strokes.

    This option is like having 2 independent 1 cylinder engines with coil or magneto driven ignition. They can be odd fire because you set the tach inputs physical sensor phasing to match the odd fire angle, but leave Odd angle as 0. This setup is wasted spark since the tach signal comes once per crank revolution - that is it is a crank mounted signal. If you have the signals coming from a cam so that each is once per 2 revs, then you choose option 1.b.

    Also, note that when calibrating the timing with a timing light, you should first use the trigger wizard to calibrate the timing of Output 1 to the value shown in the trigger wizard in MegaTune, then adjust the 'Offset (advance) of Output #2' until the timing reported in MegaTune for sparks from the coil(s) hooked to Output 2 matches what you measure with the timing light.

    Toothed wheels (M-N, or M-0 where M > tach pulses) are not allowed (and no EDIS, no trigger return cranking mode). So the number of teeth must be set to 0 (zero).

    b. Cam trigger: This is for dual independent camshaft sensors. The number of teeth on the cam wheel must be the same as the number of cylinders. For example, for a 2 cylinder engine this can be two teeth on a single cam wheel, or one tooth on each of two cam wheels in an overhead cam configuration.

    Toothed wheels (M-N, or M-0 where M > tach pulses) are not allowed (and no EDIS, no trigger return cranking mode). So the number of teeth must be set to 0 (zero).

    Since there are only two outputs, 2-cylinder COP is the normal application for this, but driving 2 coils for 4-cylinder wasted spark is also possible in this mode.


    2. Normal trigger on input 1 with rising/falling edge cam synch on Input 2. The edge for the first trigger is selected in the usual way and there is an independent edge selection for the cam synch. With this setup there are 3 possibilities:
    a.Tach trigger on Input 1. A 'tach input' is an input that occurs once for every spark event that needs to happen. For a 4 stoke cycle engine, and 8 cylinders, this is 4x per revolution. For a 4-stroke, 4 cylinder, it is 2x per rev, etc. Typically, such a signal comes from a distributor, but it can also come from a crank wheel (2 teeth for a 4 stroke/4cyl, 4 teeth for a 4stroke/8cyl, etc.). Output 1 is fired on the first tach pulse after the cam pulse is sensed. The next tach pulse fires output 2, and they continue alternating thereafter. If the cam does not continue to come in between the last and first cylinder tach pulses, then a resynch occurs.

    b. M - 0 toothed wheel (no missing teeth - for example a flywheel) on input 1 and a rising or falling edge 1 tooth cam synch is on input 2. This is handled the same as in (a), except the first tooth after cam synch starts the action and the appropriate number of 'skip teeth' thereafter are ignored (except for time error checking/ correction) until the next 'tach' tooth.

    M, the total number of teeth, must be such that MegaSquirt-II will be able to 'skip' a certain number of teeth so the only the right number of teeth are counted as 'tach signals' per revolution. In general, this is:

    • 4-strokes: skip_teeth = (2 Χ M) / #cylinders
    • 2-strokes: skip_teeth = (M) / #cylinders

    Alternatively, the total number of teeth must be a multiple of one half the number of cylinders for a 4 stroke (a multiple of the number of cylinders for a two stroke). So an 8 cylinder engine could use M = 4 (this is the tach input in 2.a.), 8, 12, 16, 20, 24, 28, 32, 36, ...

    Some permissible combinations are:

    Skip Teeth Setting
    Wheel
    12-024-036-060-0
    cylinders
    (4-stroke)
    1244872120
    212243660
    46121830
    6481220
    836915
    10n/an/an/a12
    1224610

    n/a - cannot be used

    See the missing tooth page for more information.

    Note the cam synch must be physically located so that it occurs just before the reference crank wheel tooth (and after the previous tooth), otherwise timing will be one tooth off.

    c. M-N toothed wheel on input 1. The cam synch on input 2 must be placed so that it occurs during the missing teeth. Ignition starts on the tooth after the missing tooth. If a cam synch has occurred just before this tooth, it fires on Output 1, otherwise it starts with Output 2. Thereafter the outputs alternate. This setup provides the fastest startup because you don't have to wait for cam synch. Note that the cam detection polarity (aka. "input edge capture") is independent of the crank detection polarity, and you must specify both.

    For this option there can be no trigger return and no EDIS. Also, note that while having both a crank and cam signal gives us the information we need to control one coil per cylinder (COP), and sequential fuel injection, we only have 2 ignition outputs (and 2 injector outputs) so this is not possible with more than 2 cylinders on MicroSquirt® controllers.

    M, the total number of teeth, must be such that MegaSquirt-II will be able to 'skip' a certain number of teeth so the only the right number of teeth are counted as 'tach signals' per revolution. In general, this is:

    • 4-strokes: skip_teeth = (2 Χ M) / #cylinders
    • 2-strokes: skip_teeth = (M) / #cylinders

    Alternatively, the total number of teeth must be a multiple of one half the number of cylinders for a 4 stroke (a multiple of the number of cylinders for a two stroke). However, the missing tooth(s) cannot be one of the 'tach' teeth, so you would have to have at least 8 teeth (i.e., a 8-1 wheel). So an 8 cylinder engine could use M = 8, 12, 16, 20, 24, 28, 32, 36, ...

    Some permissible combinations are:

    Skip Teeth Setting
    Wheel
    12-124-136-160-2
    cylinders
    (4-stroke)
    1244872120
    212243660
    46121830
    6481220
    836915
    10n/an/an/a12
    1224610

    n/a - cannot be used

    See the missing tooth page for more information.


    3. M-N toothed wheel comes in on Input 1 and there is no Input 2. The first tooth after the missing tooth starts the firing sequence on Output 1, then fires Output 2 after Skip teeth (= next tach), and alternates thereafter. This option provides 'wasted spark' coil firing for 1, 2 or 4 cylinders. For a 1 or 2 cylinder engine the two outputs must be tied to the single coil.

    You can also do 2 or 4 cylinder wasted spark with this crank wheel only option. There are 2 flavors of this: Odd angle = 0 and != 0. The difference is that pure wasted only has one coil - and you have 2 outputs, so you have to tie them both together using a logic OR gate. Or you could ignore one output, but then MegaTune would display double or half the actual rpm. This setup has symmetric inputs and outputs - that is you fire each output every 180 deg and it is even fire. With odd-fire, you have to fire non-symmetrically, so you MUST have 2 separate coils which are fired separately every 180°, with the offset put into Odd Angle.


    4. M-N Cam Wheel Only This option provides for a cam driven M-N wheel (1 input) which gives 2 cyl COP and is very like the M-N crank + cam synch setup (2.c.).

    Input Notes:

    To view the actual input signals from your vehicle, as seen by the processor, use the tooth analyzer package. You can download the code and corresponding Windows application here: www.microsquirt.info/tachref.htm

    The code incorporates an 'odd-fire offset angle' for any of the dual spark modes. The offset advance is added to the 2nd output to advance(+) or retard(-) it relative to output 2 from an even fire engine. This should work for a 2 cylinder odd-fire engine with a missing tooth wheel mounted on the cam, and probably even for a crank mounted wheel in wasted spark mode.

    Because there are two ignition outputs, there is more time for coil charging, but the code is more complex. The ignition triggering must be set up to follow a sequence of: tach in, wait to charge, charge, spark before next tach in. You can have ATDC timing by trigger offsetting everything, but then timing range is lost BTDC. This presents no problem on a 2 or 4 cylinder engine.

    With the Dual Spark function enabled, the trigger offset should be set 'negative'. That is, there are always two choices for trigger offset. The timing looks as follows:

      
                ...----|<------ degrees between firings -------------->|----...                         
                ...----|--------------|--------------------------------|----...                                           
                ...- tach1-----------TDC-----------------------------tach2 -... 
                ...----|<--(+)x deg-->|<------(-)y deg---------------->|----... 
    
    So in theory you can normally pick either +x° (BTDC) or -y° ATDC.

    For non-Dual Spark function, it doesn't matter which offset you choose because the dwell + spark sequence for a cylinder can be anywhere in the cycle, and we have generally used positive (+) degrees in the documents. But for Dual Spark, because it is too complicated and there is not enough RAM or CPU time, you must start and finish both dwell and spark within the time between 2 consecutive tach pulses. In this case we always want to use the negative y degrees, or else the math ends up coming out incorrect in the code.

    For example, if tach1 occurs at a trigger offset of +40° BTDC, tach2 occurs -320° ATDC. For dual spark mode we always want a negative trigger offset, so you would use -320° instead of +40°.

    The -320° offset seems unusual, but there is a reason for it. The original code started with a very robust triggering system where people could put their sensors anywhere and use any kind of advance with any kind of offset. This was a nightmare to code and impossible to maintain with the dual spark system, which was based on a strictly next cylinder firing setup. In fact it sets up to fire 2 cylinders before the actual spark occurs. This allows plenty of time for dwell at high rpm. To maintain the previous terminology for users as well as keeping the code consistent, the advance offset was left as it was, but whereas for the original (non-dual spark) system it was best to use a positive trig offset (but negative offsets would also work), while dual spark requires a 0° to negative (ATDC) advance offset.

    If you try to put in -320° offset in some older MegaTune ini files, it won't allow it, so use the latest ini file which opens up the limits to +/359°.

    Let's take the more specific case of a two cylinder sequential COP setup. This is illustrated in the figure below. Ignition output 1 (IGN1) is set up for dwell and sparking on the first tach pulse after cam synch is sensed. The output will then fire 'advance' degrees relative to the downstream cylinder 1 TDC (compression). The next tach pulse causes the processor to again set up for a dwell spark cycle 2 cylinders down, where cylinder 2 is at TDC. Note that if the cam signal does not continue to arrive between the same two teeth, then a resynch occurs.

    With only minor modifications this same setup can be used for a 4 cylinder, wasted spark, even fire engine. Just replace the cam synch with the first tooth after the missing tooth interval signifying the tach event. This assumes Delay_Teeth is 0. If it is one, it occurs one tooth later, etc. The same Delay_teeth variable can also be applied for cam synch/COP. The missing tooth also occurs every tach interval instead of only once every other, as does cam synch. For this wasted spark, even fire case, a 'wasted spark' coil is used to be used, so this compensates for the doubling of the cylinders to 4, and the rest of the timing and skip pulses will stay the same.

    For 2 cylinder sequential fuel injection you must set 'alternating' injections. If you set 'simultaneous' you will defeat the whole purpose of sequential injection, as each cylinder will be injected twice instead of once per 720 crank degrees. The trim will work on the vehicle, but pulse width1 (pw1) in MegaTune will jump between trimmed and non-trimmed unless both are trimmed to the same value.

    Output Notes:

    IMPORTANT! You can directly drive a maximum of one coil per ignition driver with MicroSquirt! This is because the coil driver (the VB921) can only sink enough current for one coil. That one coil can be a double ended 'wasted spark' type coil for two cylinders/coil (ex. the Ford EDIS4 coil pack with each coil driven by a separate driver), and it will be fine. But you CANNOT 'direct drive' two separate coils in wasted spark configuration driven directly off of one ignition driver (see below).

    If you want to drive more than 2 coils, you might look at the 4-coil Bosch 211 igniter or the LSx series of coils with their built in igniters (and logic level signals on the ignition outputs).

    Dual Spark and MS-II

    The same pin routing as on the MicroSquirt® controller could be made on the MegaSquirt-II™ daughter board to enable dual inputs/outputs. You would do this by cutting the PWM traces into the logic chip and routing them to the appropriate output connector pins. The same software will then work in the same way on MegaSquirt-II™ and MicroSquirt®. It's not a difficult job for someone experienced in this, and would only take a few minutes to do. But it's not something you want to try without practice and the proper soldering iron and solder. If you don't make the mod to MS-II™, then do NOT set any of the Dual Spark options - they will not work. But you can use the v2.83+ code with the unmodified MS-II™ controller to get all the other features of this code.

    To make the dual code spark mods on an MS-II™, the MM74HC00 NAND gate needs to stay in place on MegaSquirt-II™, but with some mods.

    1. Lift pin #1 on the NAND gate and connect to pin #2. This in effect makes a simple inverter,
    2. Lift pin #4 on the NAND gate and connect to pin #5. At this point there is nothing on pad #1 and pad #4,
    3. Pad #1 is used for the second tach input (Input 2), so we solder a wire to it to bring the second ignition input signal into the processor (be careful not to bridge to adjacent pins),
    4. Pad #4 is for the second ignition output channel (Output 2). Solder a wire to it for the second ignition output signal (be careful not to bridge to adjacent pins).

    You can jumper the 2nd tach output and 2nd ignition output to come out externally through the DB37 if you like, using the SPR3 and SPR4 jumpers to DB37 pins 5 and 6. Output 1 will still be DB37 pin #36, Input 1 will be DB37 pin number 24 (i.e. the standard tach input and ignition output circuits/pins).

    The ignition output will be a logic level driver. If you wish to control a coil with it, you will need to duplicate MicroSquirt®'s IGN2 VB921 output circuit shown here: www.microsquirt.info/us_hardware.htm from Pad #4.

    For the second ignition input, you can duplicate either of the optoisolator or VR input circuits, with the resulting signal fed to Pad #1.

    Note: The bootloader code (the code burned inside a virgin HCS12 to allow you to download new code) used for all MS-IIs to date turned off the injectors by turning off the PWM line going into the NAND gate along with the injector signal. Either one of these or both being 0 will turn off the injector. That's why everything has been working correctly. In MicroSquirt® there are no PWM lines so there is no NAND gate, nor is there a FET driver, and the B/L code was modified to turn off the injector signals at load time.

    However, when the hack is made to the NAND gate for the Dual option mode, the PWM lines are disconnected, and the injector lines are high. So when the original PWM pin and injector pin are tied together, you get 2 highs going into the NAND gate. This doesn't happen in non-bootloader mode because the normal software turns the injectors off as required.

    This means that if you make the Dual Spark modification on an MS-II™, you must unplug your injectors (or the injector fuses) or fuel pump during a bootload.

    There is another solution to the injector lockup on bootloader problem. It is only viable if you're only using one of the ignition inputs, like a single 36-1 wheel; if you are using two different tach inputs for sync you cannot do the following.

    The second fix is to rewire PWM1 output to the input of both NAND gates. So rather than unhooking PWM1 and PWM2, you unhook PWM2 (to use its output) and hook PWM1 where it was before. Instead of the modifications listed above, do the following:

    1. Don't lift pin #1 off the NAND gate (leave the PWM1 output from the processor in place).
    2. Lift pin #4 off the board (this was the PWM2 channel for the MS-II™ processor that we will use for the 2nd ignition output), and jumper it to pin 1 with a wire so that the PWM1 pin is connected to both pins 1 and 4.
    3. Use the former pin #4 pad for the 2nd ignition output (IGN2) channel as above.

    Obviously you still can't use PWM. However with these modifications, when the bootstrap code pulls PWM1 low on boot, it will pull pins 1 and 4 on the NAND low, disabling both of the injector outputs. This means users do not need to pull fuses every time they use the bootloader to load new code.

    MicroSquirt® One and Two Cylinder Dual Spark Ignition Options
    (for MicroSquirt® code version 3.230 or higher)

    One and two-cylinder engines, while seemingly simpler than those with more cylinders, pose some problems because of the way MicroSquirt®'s Dual Spark software handles the 2 ignition and 2 injector outputs that are capable of driving up to 2 banks of 4 cylinders each. The dual outputs are used because there are only 8 timer ports on the MS-II™ processor. As a minimum, 4 are needed for 2 ignition and 2 injection outputs and another 2 are needed for crank and cam inputs, leaving 2 spares for things like idle air stepper motor drivers. (With unlimited processor resources one would have 8 timer outputs for ignition and 8 for fuel and 2 for synch inputs.) The timing of the 6 engine position and control signals is the most critical task for an ECU. The times between the input signals and the timing of the output signals must be exact if the engine is to have peak performance. This precision is best achieved by using timer ports, which are I/O ports with small independent pseudo-processors attached to them. These processors, once properly configured, handle the calculation of tach input times and time-triggering of spark and fuel outputs independent of the main processor, so they are always very accurate regardless of the main load.

    Operation of the software in dual spark mode has been described elsewhere, but in summary, when the tach input corresponding to the first spark/ injector bank arrives, the processor sets up dwell duration and spark timing for the cylinder event 2 tach pulses in the future. This allows 2 full tach durations minus spark advance deg in which to dwell before sparking. This amount of dwell time is needed at the very high rpms which many smaller motors are capable of running. When the tach pulse for the second bank arrives, the same dwell/ spark setup is performed for this bank, again referenced to 2 tach pulses into the future. So each ignition output fires once every 2 tach events.

    This is shown in the below timing diagram in which T1 is the first tooth after the missing one and Tach1 is how you specify the first tach pulse. There needs to be a tach pulse each time you want an ignition output to be fired. The first tach pulse will occur Delay Teeth after T1, and subsequent tach pulses occur every Skip Teeth thereafter. Delay Teeth should be chosen so that Tach1 occurs shortly after TDC1. So if T1 occurs shortly after TDC1, you can use Delay Teeth = 0. The idea is to make the tach pulses be close to the TDCs so you have max time to dwell over two tach cycles if you need it. The dwell is limited by the fact that it must start after a tach pulse and end when you spark or when 2 tach cycles have elapsed. So if you start dwell at any point after Tach1 you must spark on IGN1 output before Tach3 or a spark will be forced. Note that at Tach1 the processor sets up to fire IGN1, at Tach2 it sets up to fire IGN2, at Tach3, IGN1 and so forth alternating.

    The label 'TO' in the figure is the trigger offset. It tells the processor where TDC is relative to the tach pulse in degrees. Since Tach1 occurs after TDC1, it is a negative number and must be entered as negative. This is needed because the table spark advance is referenced to TDC, not to the tach pulse.

    ----------|--Dly Teeth-|----------Skip Teeth------------------|-----------Skip Teeth------------------|     
    ----------T1-----TDC1-Tach1----------------------------TDC2-Tach2------------------------------TDC3-Tach3
    ----------|-------|----|---------------------------------|----|----------------------------------|----|
    ------------------|-TO-|
    

      Two-Cylinder Engines

    1. Configuration 1 is for:
      • 2 cylinder, 4-stroke engine,
      • even or odd fire,
      • sequential ignition (i.e. not wasted spark),
      • 2 ignition coils

      The following illustrates a common setup for a 2 cylinder, 4-stroke engine configured for sequential ignition with 2 separate ignition coils. The dual spark mode is Falling/ Rising Cam sync, with an M-N toothed crank wheel, N=0 or >0. Skip Teeth, which is the number of teeth between tach events, should be set to M (360 degrees for a crank wheel). Each Ignition output fires every 720 deg and they alternate. Fuel may be set so each injector fires every 720 degrees and they alternate, or they may be set Simultaneous, so both cylinders get injected at the same time every 360 degrees. Odd angle (output 2 ignition and fuel timing offset for odd-fire engines) may be 0 or non-zero.

      Wiring:

                            
      ECU IGN1 ----> Driver1 ------> Coil1 -------> Cyl 1 Plug
      
      ECU IGN2 ----> Driver2 ------> Coil2 -------> Cyl 2 Plug
      
      ECU INJ1 ----> Driver1 ------> Cyl 1 Injector
      
      ECU INJ2 ----> Driver2 ------> Cyl 2 Injector
      

    2. Configuration 2 is for:
      • 2 cylinder, 4-stroke,
      • odd-fire, wasted spark,
      • 2 separate ignition coils

      This is wasted spark mode with single crank synch from M-N wheel or with M-0 crank wheel and separate crank synch on Input 2. This mode is meant for odd-fire engines (Odd angle != 0) which can not use a single wasted spark coil because the required wasted spark timing does not coincide with the same crank position on both cylinders. So a total of 4 time-separated spark firings is required over the 720 degrees engine cycle.

      Skip Teeth = M / 2. Each Ignition output fires every 360 degrees and they alternate. Likewise for the injectors, which squirt immediately following the tach pulse, unless an Injector Start Delay as a percent of the tach interval is specified. If Alternate injections is set, only 1 injector squirts per tach pulse, just like the ignition outputs; if Simultaneous fuel injection is set, both injectors would squirt at the same time, and this would make each cylinder get injected 4 times per 720 degrees – which could be a problem for large injectors at low rpm or small injectors at high rpm.

      Note from the below timing diagram that if it is desired to use 2 coils with an even fire engine, even though this is a wasted spark mode (for example as a temporary configuration until a cam synch is installed) then one could set the Odd Angle to 0.1 deg, just enough to cause this 2-coil wasted configuration to be implemented, but producing a negligible timing difference between the outputs.

              -----|---- = tach pulse;    x1,2 = start spark for cyl 1,2;     f1,2 = start injection for cyl 1,2
      
             0-------------------------------------------------------360 deg--------------------------------------------------720 deg
             0-------------------------------------------------------M Teeth--------------------------------------------------2M Teeth
             |-------------------------------|--------------------------|----------------------------|---------------------------|
             |-------------------------------|-------------------x1-----|----------------------------|---------------------x1----|
             |--f1---------------------------|--------------------------|--f1------------------------|---------------------------| 
                               
           Odd ang = 0
             |----------------------x2-------|--------------------------|--------------------x2------|---------------------------|
             |-------------------------------|--f2----------------------|----------------------------|--f2-----------------------|
               (The above shows the effects of a small Injector Start Delay on f1, f2.)
      

      (The diagram below show the effects of non-zero Odd Angle on spark, and the effects of a small Injector Start Delay + Odd Ang on f2.)

                                   
           Odd ang > 0  (more spark advance, less injector delay)
             |---------------x2-------------|--------------------------|-------------x2-------------|---------------------------|
             |------------------------------|f2------------------------|----------------------------|f2------------------------| 
      
       
           Odd ang < 0 (less spark advance, more injector delay)
             |--------------------------x2--|--------------------------|------------------------x2--|---------------------------|  
             |------------------------------|-----f2-------------------|----------------------------|-----f2--------------------|                          
      

      Wiring:

      ECU IGN1 ----> Driver1------> Coil1 -------> Cyl 1 Plug
      
      ECU IGN2 ----> Driver2------> Coil2 -------> Cyl 2 Plug
      
      ECU INJ1 ----> Driver1------> Cyl 1 Injector
      
      ECU INJ2 ----> Driver2------> Cyl 2 Injector
      

    3. Configuration 3 is for:
      • 2 cylinder, 4-stroke,
      • even fire,
      • 1 wasted spark coil

      Wasted spark mode with crank synch from M-N wheel or with M-0 wheel and separate crank synch input. This mode is meant for non odd-fire engines (Odd angle = 0, i.e. even fire) which can use a single wasted spark coil because the required wasted spark timing coincides with the same crank position on both cylinders. So a total of 2 time-separated dual spark firings are required over the 720 degrees engine cycle.

      Now we come to a problem. There is only one (dual wasted spark) coil, but 2 ignition outputs. What do we do with the extra output?

      1. Tie the 2 output FET drivers together and use Skip Teeth = M: Each Ignition output fires every 720 degrees and they alternate, so cylinder 1 gets spark every 360 degrees, but one is wasted; same for cylinder 2. The cylinder offset must be zero (Odd Angle = 0); or "even-fire" in other words.

        Wiring:

        ECU IGN1 ----> FET driver1 \                          /---- Cyl 1 Plug
                                    \----> Wasted Coil ----->/
        ECU IGN2 ----> FET driver2  /                        \ ---- Cyl 2 Plug
        
        The FET drivers are in a wired-or configuration and can be tied directly together. NEVER join the 2 processor outputs directly. If you don't have or want drivers, you can use IGN1 and IGN2 as inputs to an “AND” or ‘OR’ logic chip, and take the single output from it as the input to the wasted spark coil. If a High (5 V) signal is required at the coil for dwell, then use an 'AND' chip. (An 'OR' chip can cause permanent dwell and a burned out coil, but it is the correct chip if Low (0 V) is required at the coil for dwell.)

        The fuel injectors can be left untied, as in configurations 1 and 2, so, for Alternate setting, INJ1 injects cylinder 1 every 720 deg and similarly for INJ2, cylinder 2. Setting Simultaneous will cause each cylinder to be injected every 360 degrees.

      2. Leave the 2 ignition outputs separate, use Skip Teeth = M/2 and ignore IGN2 output: IGN1 output now fires the dual coil every 360 degrees, so cylinders 1 and 2 each get spark simultaneously every 360 degrees, but one is wasted. Odd Angle = 0.

        Wiring:

                                                            /---- Cyl 1 Plug
        ECU IGN1 ----> FET driver1 ----> Wasted Coil ----->/
                                                           \ ---- Cyl 2 Plug
        
        ECU IGN2 ----> Output generated but Not Used
        

        The fuel injectors can again best be left untied, as in configurations 1 and 2, and, for Alternate setting, INJ1 injects cyl 1 every 360 deg and similarly for INJ2, cyl 2. Setting Simultaneous will cause each cylinder to be injected every 180 degrees, which is probably not desirable.

      Which is better – configuration 3a or 3b? Here are the things that must be considered in making the tradeoffs:

      1. Which method provides max dwell time at high rpm. This turns out to not be a significant factor because there really is no difference. This can be seen from the following timing diagrams, which show how each ignition channel operates over two tach cycles, but offset in phase:

        • (3a) – tied together, Skip Teeth = M
                                 -----|---- = tach pulse;     x = start spark
          
          IGN1  __                          _________                          __________
                  |                        |         |                        |          |
                  |________________________|         |________________________|          |____
          |-------------------|-----------x----|-----------------|----------x------|----------
          
           IGN2           __________                          __________
                         |          |                        |          |                   
          _______________|          |________________________|          |_____________________                       
          |-------------x-----|----------------|------------x----|-----------------|----------
          
          ‘OR’ IGN signal together:
          
           IGN2 __        __________        _________          _________        _________
                  |      |          |      |         |        |         |      |         |    
                  |______|          |______|         |________|         |______|         |____                    
          |-------------x-----|-----------x----|-------------x---|------------x----|----------
          

        • (3b) – IGN1 only, Skip Teeth = M / 2
          IGN1 ___         _________         _________         _________        _________
                  |       |         |       |         |       |         |      |         |
                  |_______|         |_______|         |_______|         |______|         |____
          |---------|----x----|-------|----x----|-------|----x----|-------|---x-----|-------|-
          
          IGN2 -   Unused
          

      2. You can see from the above timing diagram that the dwell capability is the same, but note that there are twice as many vertical tics in the 3b IGN1 as there are in the 'OR'ed 3b output. This is because Skip Teeth, which defines the tach interval, is M / 2 (180 degrees) instead of M (360 deg). You have to generate twice as many sparks if you are not going to use the second channel. Since tach pulses trigger the processor to begin calculating spark and fuel for the next cylinder event, the processor is doing twice as many calculations as it needs to. While there is still headroom, those who want 20000+ rpm might want to consider tying the outputs together.

      3. Configuration 3a provides a longer (double) interval between fuel injections. This makes more efficient use of the time for injecting at high rpm, since very little fuel is injected during topen, and if you have 2 topen times, that gives less total time for injecting. This extra time at high rpm would allow you to use smaller injectors, and so get better fuel control at idle. The choices are: 3a allows injecting each cylinder every 720 (360) degrees with alternating (simultaneous) injection mode; 3b allows injecting each cylinder every 360 (180) degrees with alternating (simultaneous) injection mode. Although it could be done, there is no sense in wiring injectors together – it is done far easier in the software by selecting Simultaneous mode. Also, if this is done, the x-tau calculation will be off, since the code will not know they are tied and will not calculate the correct time between cylinder squirts. To correct it would require tau to be halved when injector drivers are tied together.

    4. One-Cylinder Engines

    5. Configuration 4 is for:
      • 1 cylinder, 4-stroke,
      • 1 coil, sequential ignition,
      • Cam synch

      Sequential ignition mode with Falling/ Rising Cam sync, M-N wheel, N=0 or >0. Odd Angle = 0 always for 1 cylinder. The ignition timing for the two possible configurations below looks identical to 3a and 3b above, except the tach intervals are 2M (720 degrees) and M (360 degrees) instead of M (360 degrees) and M/2 (180 degrees).

      1. Skip Teeth = 2M: Each Ignition output fires every 1440 degrees and they alternate. Since they are tied together, cylinder 1 gets spark every 720 degrees.

        Wiring:

        
        ECU IGN1 ----> FET driver1 \                                                                          
                                    \----> Coil -----> Cyl 1 Plug
        ECU IGN2 ----> FET driver2  /
        
        NEVER join the 2 processor outputs directly together. If you need to join the signals, connect the outputs from the FET drivers, or use a logic AND or OR chip.

        Fuel requires more thought for the one cylinder because there is only one injector, but two fuel outputs. There are two possibilities:

        1. If Alternating injections is selected, INJ1 1 will follow IGN1 and will inject cylinder 1 every 1440 deg. To get injections every 720 degrees you would have to tie the INJ1, INJ2 drivers together. This is not recommended nor necessary.

        2. If Simultaneous injections is selected, INJ1 will inject cylinder 1 every 720 degrees and INJ2 can be left unconnected. This is the recommended option for sequential.

      2. Skip Teeth = M: Each Ignition output fires every 720 degrees and they alternate. Since only one output is used, cylinder 1 again gets spark every 720 degrees.

        Wiring:

        ECU IGN1 ----> FET driver1 ----> Coil-----> Cyl 1 Plug
         
        ECU IGN2 ----> Output generated but Not Used
        

        The fuel possibilities here are again:

        1. If Alternating injections is selected, INJ1 1 will follow IGN1 and will inject cylinder 1 every 720 degrees. Thus INJ2 can be left unconnected. This is the recommended option for sequential in this case.

        2. If Simultaneous injections is selected, INJ1 will inject cylinder 1 every 360 degrees and INJ2 should be left unconnected.

    6. Configuration 5 is for:
      • 1 cylinder, 4-stroke,
      • 1 coil, wasted spark ignition

      Wasted spark ignition mode with single crank synch from M-N wheel or with M-0 wheel and separate crank synch input. The ignition timing for the two possible configurations below looks identical to 3a and 3b above, including tach intervals of M (360 degrees) and M/2 (180 degrees).

      1. Skip Teeth = M: Each Ignition output fires every 720 degrees and they alternate. Since they are tied together, cylinder 1 gets spark every 360 degrees, 1 of which is wasted.

        Wiring:

           
                 ECU IGN1 ----> FET driver1 \                                                                          
                                             \----> Coil -----> Cyl 1 Plug
                 ECU IGN2 ----> FET driver2  /
        
        NEVER join the 2 processor outputs directly together. If you need to join the signals, connect the outputs from the FET drivers, or use a logic AND or OR chip.

        The fuel possibilities are:

        1. If Alternating injections is selected, INJ1 1 will follow IGN1 and will inject cylinder 1 every 720 degrees. INJ2 can be left unconnected. If it is desired to obtain an injection every 360 degrees, you could connect the injection drivers, but this is not necessary nor recommended.
        2. If Simultaneous injections is selected, INJ1 will inject cylinder 1 every 360 degrees and INJ2 can and should be left unconnected.

      2. Skip Teeth = M / 2: Each Ignition output fires every 360 degrees and they alternate. Since only one output is used, cylinder 1 gets spark every 360 degrees.

        Wiring:

        ECU IGN1----> FET driver1 ----> Coil-----> Cyl 1 Plug
         
        ECU IGN2----> Output generated but Not Used
        
        The fuel possibilities are:

        1. If Alternating injections is selected, INJ1 will follow IGN1 and will inject cylinder 1 every 360 degrees. Thus INJ2 can be left unconnected. This is the recommended option for wasted in this case.

        2. If Simultaneous injections is selected, INJ1 will inject cylinder 1 every 180 degrees and INJ2 should be left unconnected. Unless multiple injections per engine cycle are needed, this option is not recommended.

    7. Configuration 6 is for:
      • Cam-Mounted Wheel (1 and 2 Cylinder),
      • 4-stroke,

      Use with engines equipped with a cam mounted M-N toothed wheel, so the mode is sequential. There are 3 sub-configurations here:

      1. 2 cylinders, 2 coils, Skip Teeth = M / 2: Since this is a sequential mode, there is no reason to tie IGN1 and 2 together. Each generates one spark every 360 degrees of the cam wheel, and they are phase offset, which means each of the two cylinders is fired once per cam revolution, which is what is desired.

        Using Alternating for fuel gives the same injection pattern as the ignition. Simultaneous would give 4 total injections per 360 cam degrees.

      2. 1 cylinder, 1 coil, Skip Teeth = M: Although this is a sequential mode, there is only one coil, so it is allowed to tie IGN1 and INJ2 together. Each then generates one spark every 720 degrees of the cam wheel, and they are phase offset, which means the connected IGN1 and IGN2 fire the single cylinder once per 360 degrees cam revolution, which is what is desired.

        Using Alternating without tying INJ1 and INJ2 together would only give fuel to the single cylinder every 720 cam degrees. This is not recommended; instead, using Simultaneous means INJ1 and INJ2 fire simultaneously every 360 cam deg, so attaching only INJ1 to the single injector is all that is needed.

      3. 1 cylinder, 1 coil, Skip Teeth = M / 2: Although this is a sequential mode, there is only one coil, so it is also allowed to use only IGN1 and ignore IGN2 output. With M / 2 Skip Teeth, IGN1 then generates one spark every 360 degrees of the cam wheel, which is what is desired.

        Using Alternating and only using INJ1 (INJ2 is ignored) would give fuel to the single cylinder every 360 cam degrees, as desired. Simultaneous would give a squirt to the one cylinder every 180 cam degrees, which is generally not needed.


      Two-Stroke Engines

    8. Configuration 7 is for:
      • 2-stroke,
      • either a cam or crank mounted M-N toothed wheel

      This mode is sequential. There are again 3 sub-configurations here, but selection of single cam or crank mounted wheel results in exactly the same behavior for each. In fact the 3 sub-configurations have exactly the same inputs and the output behavior is also exactly the same as for configurations 6a through 6c above. The only difference that would be observed on the bench would be that if the wheel input was spinning at the same rpm, the rpm in configuration 6 would be double that in configurations 1-5 and 7. This is correct behavior and the reason is that the cam wheel for a 4-stroke turns half as fast as the crank, but for a 2-stroke, cam and crank turn at the same speed.

    Tie Ignition Outputs Option

    The program option to tie ignition outputs is only used for 1 and 2 cylinder engines. The ini file limits it more specifically to the following configurations:

    In the code itself, the above conditions are applied for 4-stroke engines, but for a 2-stroke, only the 1 cylinder conditions are applied. This just means that the 'tie ignition outputs' option has no effect on 2-stroke engines, which are always sequential, unless they are 1 cylinder. The latter has only 1 coil regardless of configuration, so it can make sense to tie the outputs together whether wasted or sequential.

    It is to be emphasized that in all cases where outputs are tied together, you must join only the outputs from the FET drivers, which are in a wired-or configuration. NEVER join the 2 processor outputs directly together. If this is ever necessary, they must go into a logic AND or OR chip.

    Note also, if rpm is half or double what it should be, something is wrong with your input configuration. Go over the documentation, make timing diagrams, use a scope or stimulator and try to understand why the original configuration did not give you what you wanted. Don't just change inputs until the rpm comes out right – this may not give you the optimum setup.

    For more information on dual spark concepts and the meaning and setting of the associated user parameters, see: www.megamanual.com/seq/multichannel.htm.



    MegaSquirt® and MicroSquirt® controllers are experimental devices intended for educational purposes.
    MegaSquirt® and MicroSquirt® controllers are not for sale or use on pollution controlled vehicles. Check the laws that apply in your locality to determine if using a MegaSquirt® or MicroSquirt® controller is legal for your application.
    ©2006, 2009 Bruce Bowling and Al Grippo. All rights reserved. MegaSquirt® and MicroSquirt® are registered trademarks. This document is solely for the support of MegaSquirt® boards from Bowling and Grippo.