Tuning Manual

Only for use with the MS2-Extra code (HC9S12C64 based microprocessor - MS2 Daughter Board)

NOTE: Please ensure you have one of these daughter boards inside your ECU before continuing. If you have a standard black microprocessor, then you have an MS1 and these manuals are NOT for MS1 see here for MS1-Extra Manuals

Warning for E-Bay buyers!!
Please see the Official Suppliers list before buying through E-Bay.
This is there for your protection.

Please Note:

All of these instructions / diagrams are to be used at your own risk, like most things there is more than one way to do the same thing, what we have tried to do is to offer a method that we have tested or that others have tested for us. No warranty expressed or implied.

Use at your own risk.
If you do have any suggestions or settings that work please let me know Philip.Ringwood(at)

Getting the Engine Started -- Setting the PWM for injectors -- Setting the Cold Start and Warmup enrichments -- Idle Control

Tuning the VE table -- Rescaling the VE Table -- Tuning the AFR Table -- Tuning Issues -- Resets

Tuning for Economy -- Tuning for Emission -- Spark Map Tuning

Acceleration Enrichments -- EAE Acceleration Enrichment Tuning -- VEXME Tuning software -- MSLVV Log Viewing and Tuning Software

Before starting, make sure to:

Get the Engine Started and Idling

You start, naturally enough, by getting your engine started. (Be sure you have configured your MS2-Extra ECU first, following the instructions in the Convertion Manual

Be sure to set your base timing before starting your car (if it has not been previously been set). And verify that you have entered the base timing value into the 'Advance Offset (deg)' field of the dialog at 'Settings/Ignition Options'. See the Ignition Manual

Note that the prime pulse is NOT meant to provide starting fuel (it is meant to clear any air that might have leaked into the fuel system while the engine was shut down). Supplying fuel for starting is what the cranking pulses are for (as they are both rpm and temperature dependent, and thus much more likely to give the fuel you need). Generally, keep the prime pulse as short as possible (typically around 2.0 milliseconds is a good starting point), and tune the starting using the cranking pulse widths instead.

Typically, the first time someone tries to start their engine with MegaSquirt, it starts after about 5 minutes of alternating various cranking pulse widths numbers to get started (on the Enrichments page), and changing the:


If you have been trying to start your engine for more than 15 to 20 minutes, you ought to investigate other sources of problems before continuing to try to start the engine.

Properly tuned, MegaSquirt will start your engine quickly and reliably. If you have trouble with starting, either hot or cold starts (or both):

Setting the PWM for the injectors

To tune the PWM [pulse width modulation] values for your engine, you need to know what kind of injectors you have low-impedance or high-impedance. If you are running high-impedance injectors (greater than 10 Ohms), then set the PWM time to a number like 25.4, in essence you are disabling the PWM mode. This allows full voltage to the injectors throughout the pulse width.

For low-impedance injectors (less than 3 Ohms), you need to limit the current to avoid overheating the injectors. To do this, there is a period of time that you apply full battery voltage [peak] current, then switch over to a lower current-averaged [hold] current, i.e. peak and hold. Alternatively, you can add resistors in series with the injectors. See the Injectors and Fuel Supply section of the MegaSquirt manual for more details.

To run low-impedance injectors with the PWM current limit mode, you need to set two parameters - the "PWM Current Limit %" and the "Time Threshold for PWM Mode" - both are on the “Constants” page. The current limit % is the percent duty cycle when the current limit is invoked. The time threshold is the amount of time from when the injector is first opened until the current limit is activated.

If you are running high-impedance injectors (greater than 10 Ohms), then set the:

PWM Time Threshold to 25.4 mSec, and the
PWM Current Limit (%) to 100%.

If you have low impedance injectors (less than 4 Ohms), set the:

PWM Time Threshold to 1.0 mSec, and
PWM Current Limit to 75% (30% if you have installed the 'Flyback Board' daughter card).
You will tune these after getting the engine running. See “Setting the PWM Criteria” in the tuning section of this manual. Failure to perform the tuning steps can result in damage to your injectors. If you have high-impedance injectors, set these values to 25.4 ms and 100%, and you do not need to tune them further.

Setting the Cold Start and Warmup Enrichments

If it is cold out, you may have to figure out the cold start enrichments/warm up enrichments right away to keep the engine running until it warms up. If it is reasonably warm out, the default values may be sufficient and you may be able leave the cold start enrichments until you have the VE table and other parameters in a reasonable state of tune.

During cranking mode (defined as when the RPM is less than the Cranking RPM), MegaSquirt produces cranking pulse widths that are calculated by a linear interpolation of two end-point values defined by the user, one at -40F and one at 170F. these are set in the warm-up wizard under 'Tuning' in MegaTune. They are called Pulsewidth at -40F (ms) (CWU) and Pulsewidth at 170F (ms) (CWH).

A typical setting for a Chevrolet 350 small block V8 with a Tuned Port Injection set-up and 30 lb/hr injectors is 2.0 milliseconds at 170F and 10.0 milliseconds at -40F. The optimal values for your combination are likely different, though generally should follow a similar pattern.

During cranking, MegaSquirt-II injects one pulse for every ignition event or every two ignition pulses depending on the setting in Start and Idle Settings. So when set to one ignition pulse for an 8-cylinder it shoots out 8 times for 720 degrees crankshaft, with all injectors squirting. So with the above values, at 170 degrees, the effective amount of fuel per cylinder is 8 2 = 16 milliseconds. For -40F it is 10 8 = 80 milliseconds.

Note that even in a 'piggy-back' application, do not set MegaSquirt's cranking pulse widths to zero. This will cause unpredictable pulse widths up to 13 milliseconds. Instead, set them to 0.1 milliseconds in that application. This allows very little fuel to flow.

Once the engine fires up (defined by engine RPM greater than the setting for Cranking RPM), the engine goes into after start enrichment (ASE). The after start enrichment starts out at a user-defined percentage enrichment value (typically around 20%), and ramps down to 0% after so many ignition trigger events, which is user-defined (use about 200 for this number to start). This is an enrichment above the normal warm-up enrichment, which is temperature dependent.


Idle Control

The MS2 daughter board has a built in stepper motor controller and it also retains the FIdle output if its needed. If you had an FIdle output using the MS1-Extra code then you will need to set this up as PWM, if you have a stepper motor wired in then you can set this up as a IAC Stepper, but remember the 2 programmable IAC outputs (programmable to switch on at xxRPM, or xxxTPS, etc) can not be used when using them as a stepper controller.

If you have an IAC stepper motor, you will have to choose between 'moving only' and 'always active'. If you set your stepper to 'always on' for 15 min or so and it doesn't feel too hot to you, then you can leave it that way. Apparently this is what General Motors does. But if you want to be safe you can test it on the bench for 15 min or so. It will get right warm, but it shouldn't burn your fingers just touching it. If it gets too hot, use 'moving only' instead.

Algorithm (IdleCtl): If you have a:
Fast Idle Valve (FIdle):
For an on/off fast idle valve, set the algorithm to 'Solenoid'. You can also set your Fast Idle Threshold if you have installed a fast idle solenoid. Enter a coolant temperature to turn on the fast idle solenoid. A typical value is 145 Fahrenheit. The Fast Idle valve will be activated below this temperature (145F) and turned off above 145F. The Fast idle Threshold is independent of any warm-up enrichment. Fast idle valves generally have one or two wires.
PWM Warmup: This is for the Ford or Bosch pulse width modulated idle air valves. Ten temperature dependent levels of PWM are user specifiable if this option is selected (see 'Idle PWM Dutycycle' under 'Tables'). Modifications to the board are required, see this link for more details.

Idle Air Controller (IAC): If you have a stepper motor IAC, you can set the IAC Start position, as well as ten intermediate positions based on the coolant temperature to allow a decreasing amount of "extra air" as the engine warms up. These are set under 'Tables/Idle Steps' in MegaTune. Stepper motor IACs usually have four wires.
IAC Stepper Moving Only: Powers the stepper only when changes in pintle position are requested. This is the most common type, it holds its position if not powered, and is difficult to turn by hand.
IAC Stepper Always On: Powers the stepper at all times. Required if your stepper 'free wheels' when you spin its pintle un-powered with your hand.
15 Minute IAC: This operates the IAC stepper motor as 'always on' for 15 minutes, then switches to 'moving only'. This can be useful in some situations in which the stepper moves unreliably if moving only at the lower voltages of cranking and warming up, etc.

To select the appropriate 'Idle Control/Algorithm' for stepper motor control in MegaTune you may need to do some testing. In some cases setting the stepper motor to "IAC Stepper Always On" will cause the IAC to get hot. However setting it to "IAC Stepper Moving Only", might cause a problem with idle speed changing from one start to another.

You can test if your IAC is suitable for 'always on' by leaving your stepper powered on the bench for 15 min or so. If it doesn't feel too hot to you, then set it to "Always On". Apparently this is what GM does. But if you want to be safe they should test it on the bench for 15 min or so, or monitor it closely in the car while not moving for at least 15 minutes, checking the IAC temperature frequently with your fingers. It may get warm, but it shouldn't burn your fingers just touching it.

Leave the other values (below) alone, you can experiment with them when you get the engine running.

Time Step Size (ms) (IACtstep): IAC stepper motor nominal time between steps (i.e., 2.5 milliseconds gives pulse frequency of 400 Hz).

Acceleration Step Size (ms) (IACaccstep): not currently used.

Number of Acceleration Steps (IACnaccstep): not currently used.

Start Value (IACStart): The number of steps applied to retract the IAC pintle to 'wide open' at power up.

Cranking Position (IACcrankpos): During cranking, extra air may be useful in the same way as extra fuel in cranking pulses. The table value for the starting temperature may be fine after the engine has started up, but during cranking more power may be needed, especially if the starting temperature is cold. To provide this, you can input a step position that provides a larger than normal air opening during cranking. So, if in cranking and 'Cranking Position' < table value, then the IAC motor position (or PWM%) is set to 'Cranking Position', and when cranking is done, the motor position starts tapering (over the 'crank to run taper time') up to the table value over a user input period, typically a few seconds. (See the diagram below) If this feature is not desired, Just set 'Cranking Position' to a value higher than any table value. Then the table value will always be used since it provides more opening.

Crank-to-Run Taper Time (IACcrankpos): This is the time over which the cranking position of the idle (either the stepper steps or the PWM%) is moved to match the table value (see diagram below). Higher values give a higher idle for longer periods, which can improve starting performance.

Hysteresis () (IdleHyst): This input can be used to avoid continuous motor motion (and wear) for small coolant temperature changes. Changes to the motor are only made when new coolant temperature> coolant temperature on the last move, or, new coolant temperature < (coolant temperature on the last move - Hysteresis temperature). What this does is allow constant motor motion while the coolant temperature is rising, but when it peaks, there will be no further motion unless things cool back down - which is unlikely.

Time Based After Start (extended warm-up): You should NOT use the Time Based After Start (extended warmup) option unless you find you need it, and very few will. Disable it by setting the 'cold temperature to -40F. Then this feature will not be used unless the coolant temperature at startup (ECU first powered on) is below -40F. This feature is used toward the end of the warmup sequence when the coolant temperature is close to its final operating temperature. In this case, fast idle will normally come off, but SOME cars (very few) may need extended fast idle. An example is a car that uses heavy weight oil, which is nowhere near at operating temp when the coolant gets there, plus a hot cam with not enough idle torque to overcome the oil drag.
This feature is implemented by inputting a 'Cold Position' that is the step position at start of extended warmup, typically about 80% of the final, fully closed step position. The IAC behaves normally until the step position commanded from the table just exceeds this Cold position value (either PWM or stepper). From that point on, the steps are tapered in so as to reach the last step value in the table over the 'cold taper time' period. (see the diagram). This slows the reduction in idle air as the engine continues to warm up (increasing the idle speed for longer than the coolant temperature alone would do).

When using the PWM mode it has a table to set the Duty Cycle. In MS1-Extra there were 2 set points, one for hot, one for cold and the code would interpole the value from those points. The original values used in MS1-Extra can be converted over to MS2-Extra:

MS1-Extra Settings
MS2-Extra Settings



Tuning the VE Table

The VE Table in MS2-Extra has the option to use a 16x16 or a 12x12 VE table. Select which table size you wish to use in "Basic Setup - General, lags"

Before starting to tune the VE Table it is recommended that you turn the Acceleration Enrichment (AE) off so you can see whats happening to the mixture as a direct result of the table rather than having fuel added from Acel Enrichment. To do this set the thresholds to 30V/S or 5000KPa/S see HERE for more details on AE. You may find that you’ll need to be light on the throttle as the AE is needed to fill 'holes' that occur when the throttle opens quickly. Remember to tune the AE when you have a tuned VE Table.

Another item to turn off during tuning is the Overrun settings as the PW may drop to 0.0mS causing lean spots. See HERE for more details

Tuning the VE table involves richening (by increasing the VE) or leaning (be decreasing VE) at each point in the VE table. Most of your driving will occur in a diagonal strip of the VE table, from low rpm, low kPa (i.e. idle) to high rpm, high kPa (i.e. WOT). You can adjust these values using the O2 sensor, data logs and MSTweak, and/or the seat of your pants. Low rpm and low kPa (say less than half of the max rpm and max kPa) might be able to use stoichiometric or leaner. Richer mixtures would be used at high rpm and high kPa.

However, the low rpm/high kPa and high rpm/low kPa are not seen as often driving your vehicle. Basically, if the engine never runs in certain parts of the MAP, then the numbers there should not matter. However, since you may not be able to guess where you will run under every possible set of conditions, you put estimated VE numbers that make sense into the little used areas.

From this frequently used diagonal strip of the VE table, you will be able to see how much the VE rises from one rpm bin to the next, and use these differences to estimate the low rpm, very high kPa numbers and the high rpm, very low kPa numbers. Since you rarely (if ever) run in these parts of the table, the actual numbers will not make much difference, but they will be there "just in case". You are looking to create a smooth VE map wherever possible.


To set the VE table entries near idle, you should try to achieve the lowest MAP (in kPa) that you possibly can, at your chosen idle speed. This will give the highest idle vacuum and the most efficient idle. Don't try to get to a target idle mixture (stoichiometric, or some other number), instead adjust the VE table entries around your idle rpm and kPa to achieve the lowest MAP reading as seen in MegaTune. As you work to lower the MAP, the rpm will likely rise, and you'll have to reset the throttle stop to lower the rpm to your desired idle speed. When you have it set so that either raising or lowering the VE table entries increases the MAP, then you have the best idle mixture for your engine (it will require the smallest throttle opening).

To alter the VE table values using MegaTune, go into Tuning - VE Table 1. Here you will see a green ball floating around the 3D map, this is the current area of the map that the engine is running in. Use the arrow keys on your keyboard to take the red cross hatch to the area of the green ball. You will find that the green ball will probably end up between the cross hatches as below, that means youll need to alter the 4 areas around it to tune that area, as shown. Adjust them all by the same amount by pressing "W" to weaken (reduces the VE table value at that point by 1) or "Q" to Richen (adds 1 to that VE value), simply go to all 4 points and press W or Q once or twice and see what the reaction is on the O2 meter. Press "F1" for more help on this screen.

The 4 points to alter when between cells.


Once the engine idles smoothly, keeping in the Tuning VE Table screen, go to File - BURN TO ECU (or Alt and B) this will ensure the settings are kept in the ECU or the settings will be lost once the power is turned off.

Setting the KPa values in the Table

Note that the scale in MS2-Extra is in %, so 100% = atmosphere (100KPa) in MAP mode, or 100% TPS in Alpha-N, etc.
So obviously a boosted engine will go over 100%.

It is a good idea to set either the second or third row of KPa bins in the VE Table to the idle MAP value. So, for example, if you idle at 35KPa set the first to say 20KPa or even a little lower (this can be used for fuel saving during over run, the second can then either be 35KPa or a value between 20 and 35 then the next could be 35. The reason is it is always easier to tune idle if the point of idle is on a cross hatch, then theres only really 2 points that influence it rather than 4, this may not be possible with a varying idle map, but its worth trying if you can.
The rest of the KPa values will depend on where your engine cruises and what boost pressure you run, remember 1PSI of boost is aproximately 7KPa (6.8), so for 8psi of boost your max KPa value will be 8psi x 7KPa = 56KPa above atmosphere, so 100KPa (atmosphere) + 56KPa of boost = 156KPa (round that off too 160KPa)
Lets take a NA engine into concideration; Idle is 30KPa and cruise is also around 30-50KPa. At cruising KPa there will need to be more rows than at any other to get the engine to maintain a nice smooth AFR through out that area. In a race engine this section wont matter so that rule doesn't apply. Wide open throttle on a NA will be 100KPa (depending on where you live but 100KPa should be fine) I would set this engine up like this:

KPa Scale for VE Table


100-95 will be wide open throttle (depending on atmosphere and intake restrictions)


45- 70 would be for light to mid acceleration areas.


20 - 45will be tuned for crusing, this needs quite a few rows to get a good smooth, economic cruise.

  500 700 1000 1300 1500 2000 2500 3000 ----- ----- ----- ----- -----


Setting the RPM values in the Table
It is a good idea to set the first RPM row so it is lower than idle, this allows you to set a richer area than at idle so if the engine starts to stall or slow then it picks up a little when it goes to the richer area. So, for example, if you idle at 800RPM then set the first row to 500 and the next to 700. The 700 RPM row will be the one that tunes the idle AFR, if it drops below 700 it will be richened by the 500RPM row, but only if it drops below 700, which is 100 below your idle speed. The next few rows should be around your cruiseing area, this again, allows for better tuning of the AFR at cruise allowing a smoother, more efficient drive and a better ride around town where slow engine speeds are necassary.

Setting the TPS values in the Table for Alpha_N setup
If running Alpha_N you will need lots of bins set around your cruising area and a few around the idle (foot off the throttle). The next few values should be very close to each other up to around 25% opening as this is the area that will need more tuning at low RPM. One thing you have to always remember with alpha-N is that you don't actually know where the effective WOT is anymore (i.e., when you have enough throttle that opening it further doesn't affect the amount of air being ingested). At low RPM WOT could be only 20% throttle. It is worth setting 5-8 of the total TPS bins (load on the VE Table) to cover the first 20% - 30% of the throttle opening to make tuning easier. This will help you end up with a driveable car, as most driving on the road is done in the first 30% of the throttle. The rest of the bins can fill in the gaps between 30% and WOT. (Wide Open Throttle).

TPS Scale for VE Table



>85 will be wide open throttle (depending on engine speed)

30- 60 would be for light to mid acceleration areas.



0 - 30 will be tuned for crusing, this needs quite a few rows to get a good smooth, economic cruise.


  500 700 1000 1300 1500 2000 2500 3000 ----- ----- ----- ----- -----


At non idle areas of the VE table, you will generally run lean (low loads and speeds) or rich (high loads and speeds). High loads are associated with high kPa MAP values. Deciding exactly when (and how much) you should run rich is mostly a "seat of the pants" thing. When tuning, you will find the engine will surge (at low loads) and "coughs" at higher loads if it is run lean. Adjust the VE at the point where this happens so the this does not occur. Check the plugs for detonation (tiny black and white flecks) when tuning at high loads and rpms if you suspect detonation at all. A narrow band should read at least 0.8 volts under full throttle, at least for a starting point in tuning WOT. There are more details later in this section.

If you get the injector opening time correct, and the REQ_FUEL accurately represents the flow rate of your injectors, then the VE entries will be close to the VE*gamma. However, if your opening time is not right, or your REQ_FUEL is not, then the numbers will be skewed by the percentage the values are in error. In general, except for when you are first trying to get your engine started, use the calculated value for REQ_FUEL and do not change it.

Tuning the AFR Table

Air/Fuel Ratio (AFR) entries in the 1212 MS2-Extra AFR table are expressed as a ratio of air to fuel by volume (for example 14.7:1 represents a chemically correct ("stoichiometric") ratio for gasoline. A ratio of ~16.5:1 gives good fuel economy at low engine speeds and loads, while a ratio of ~12.5:1 gives maximum power at high loads and rpms. These entries are used only to adjust the oxygen sensor target voltage, and only if you have a wide band sensor.

MS2-Extra uses one or two 1212 Air Fuel Ratio (AFR) tables for tuning. MS2-Extra uses the AFR table in different ways, depending on the EGO feedback option you have selected:

Note the EGO feedback does not operate if any of the following are true:

  1. MS2-Extra has not been running for 30 seconds,
  2. The coolant temperature sensor has not reached the Active Above Coolant Temp () (EgoTemp),
  3. The TPS is above the 'Active Below TPS (v)' setting, and
  4. The MAP sensor reading is above the 'Active Below MAP (kPa)' setting, and
  5. Either or both of the 'Controller Step Size' (EgoStep) or 'Controller Authority (%)' (EgoLimit) are zero.

These are set in the 'Settings/EGO Control' dialog. In particular, unless your 'Active Below MAP' is higher than your baro reading, you will not generate EGO feedback on the stimulator without applying a vacuum to the MAP sensor.

If you do not have a wide band sensor installed, you can calculated the VE value required to produce any other AFR:

newVE% = oldVE% * (stoich(14.7) / desired AFR)

For example, if you have a stoichiometric mixture (NB02 = 0.50 volts) with 65% VE at a certain RPM and kPa, then to lean the mix to 16.0:1 you need:

65% * (14.7 / 16.0) = 60%

To richen an 80% VE entry to 12.5:1 from stoichiometric:

80% * (14.7 / 12.5) = 94%

However, you cannot use the narrow band signal to determine a stoichiometric ratio at high engine speeds and loads - this will damaged your engine if you try! A wide band sensor and controller can be used under these conditions for feedback control.

With wide band sensors, simply set the desired AFR (and type), and adjust the VE table to minimize the EGO correction at all engine speeds and loads.

With a narrow band sensor, you have more work to do. Have someone ride with you and bring up the tuning page. See where the dot hangs around when you are under moderate load - this is where you need to focus on tuning. Later you will try to estimate the higher load numbers from those you determine under lesser loads.

Use the up-arrow + shift to richen the VE values - enrich (with increased VE number) the four corners around where the dot is - give each corner five up-arrow-shifts, and see if this helps. Be sure to turn on EGO correction, and then tune using the EGO correction gauge rather than the EGO voltage gauge. If correction is below 100%, then raise VE to raise correction and so on.

You can also datalog the engine parameters (including O2 volts) and inspect the resulting file to see where the VE needs to be raised or lowered according to the MAP, rpm, and AFR (if you have a wideband O2 sensor).

Here is a table showing you what AFR to run within your engines working range. Note that the engine rpm range is from 600 rpm to 6000 rpm, and the MAP values range from 15 to 100 kPa (telling us that this is a naturally aspirated engine). Beyond these values, MegaSquirt will use the last value from the “edge” of the table. (It does not “shut down” by substituting zero values.) In theory, at stoichiometric mixtures, the values at 100kPa would reflect the torque curve of the engine at WOT, assuming a constant AFR level.

idle and cruise - lean

~stoichiometric - 14.7:1 AFR

WOT and acceleration - rich 12.5:1 -13.5:1 AFR

not normally seen

Idle can vary, but its usually a little richer than 14.7:1 AFR







































































































































































































Having an O2 sensor makes the driving part of the setting up much easier, as you can datalog and use MSLVV or VEXME to get the VE table set up with a few easy drives up and down the street, a bit more tuning, and you are ready to go a bit harder. You do not go harder if there are any problems [typically a back fire means too lean, sluggish revving means too [rich]. Read the “Datalog” section for more information.

Have someone ride with you and bring up the VE table1 tuning page. Drive at a sensible speed and start with low rpm and low KPa areas (crusing, etc) See where the " Green dot" hangs around when you are under load - this is where you need to focus on tuning. Use the Q and W keys to richen / weaken the VE values - enrich (with increased VE number) the four corners around where the dot is - give each corner (section) two to five Q button presses (W for weakening) , and see if this helps. Turn off the O2 closed-loop mode by setting the step size to zero in Exhaust Gas Settings. Watch the Air:Fuel gauge on the tuning page and use this as feedback for rich and lean. The AFR (02) gauge may move too fast from rich to lean to be able to tune. Another strategy that works is to turn on EGO correction, and then tune using the EGO correction gauge rather than the EGO voltage gauge. (ensure you have ego correction turned on by setting at least a 1 in the step size in Exhaust Gas Settings) If correction is below 100%, then lower the VE ("W" button) if its higher than 100% then increase the VE values (Q button) around the area the green dot is, and so on. Remember to burn the values every so often (Alt and B).It is also a good idea to save the file every so often too, try numbering them as you go so you can recall where you were, e.g. Drive1 Drive2, etc.


Re-Scaling the VE and Req_Fuel

If you have already started tuning but feel your Req_fuel is making the VE table too big or small then you can change the Req_Fuel but you will need to re-scale the VE Table too or the whole table will be out by the percentage of the change in req_fuel so your engine will no run like it used to. Re-Scaling is acheived by going into Basic Settings - Fuel Table 1 then select Tools - VE Specific - Reset Req_Fuel

e.g. VE table full of very low numbers (idle is around 15 and WOT is around 60-70) but drives well and AFR's are correct, then try decreasing the req_fuel value.
In this example we have dropped the req fuel from 14.7 to 12.2, this is roughly a 18% decrease in size, so the whole VE table will be increased by 18% to compensate.

Click OK then MegaTune will ask if you want to burn, I always select NO and then go into File - Burn to ECU


Tuning Issues

If you have a very long duration cam in your motor, and it idles poorly, you might be able to get it to idle better through careful tuning with MegaSquirt. Often a rough idle may be caused by lean air/fuel ratios. This is really is more of a cam issue than a fueling issue. The exhaust valve is held open later into the intake stroke and the intake opens earlier near the end of the exhaust stroke. At low speeds and relatively high intake vacuum you get more exhaust contamination of the fresh air/fuel charge. As you get more contamination of the air/fuel charge you typically need a richer mixture to get it to ignite and burn properly.

This means you probably cannot run a stoichiometric [chemically correct] mixture of 14.7:1 with your long duration cam. You need to run richer. So you tune your idle by ear rather than with a narrow band EGO [oxygen] sensor. And make sure you are not allowing EGO correction at idle if you have a rowdy cam! It will be trying to “correct” your mixture back to a lousy idle. If your engine will not idle well at stoichiometric mixtures, set the EGO Active Above RPM to a few hundred RPM above your idle speed. This will ensure that MegaSquirt does not try to lean the mixture back to stoichiometric to compensate for your adjustments.Remember that O2 sensors give wrong readings on a missfiring engine, big cams drive O2's nuts at idle too, so dont rely on their readings at idle.

Another tip you can try if you have a large overlap cam is to pinch off the MAP hose slightly while the engine is idling, and see if the idle quality improves. If so, then try a restriction in the MAP vacuum line. This has the effect of damping the vacuum pulses that the MAP sensor sees. Start with a ~0.040" (1.0mm) hole in the line. You may have to experiment with restrictor sizes to see what works best for your system.




A reset can be seen in Megatune in the bottom right hand corner. Some resets can be the USB adaptor (if being used) simply overflowing. If the engine runs smoothly but you are seeing resets and your using a USB adaptor try setting the Received and Transmitted buffers as low as they will go. If the engine is stumbling and there are resets on the Megatune screen (bottom right corner) then these are probably real resets, but to confirm this unplug the laptop if using a USB adaptor and see it if cures it. In datalogs you can see them as massive spikes in all of the logged variables.

NOTE: First, be sure that all the grounds from your engine, alternator, and frame are in good shape and tight.

If you have coil packs driven directly from the MS ECU then you should try fitting resistive spark plugs and new resistive plug leads. Even cleaning the plugs if the engine has been going through a tuning stage, can cure reset problems. If this still doesn't fix it fit a 20-25uF capacitor between the +12V feed that's on the coil pack and a good chassis ground. Get the capacitor as close to the coil pack as possible. These are fitted to Ford coil packs in the engine bay and should be easy to get from a scrap yard. They are also fitted to Peugeot engines, bolted to the coil pack in a small black package, I would think vertually all coil packs will have them fitted somewhere near by if you can't find a Ford or a Peugeot. See the 2 pictures below:

Another suggestion is to swap over the VR sensor cables. I have had an engine that simply reset all the time during cranking, swapping the VR sensor cables cured it. On the Ford 2 pinned sensors pin1 is the signal, pin2 is the ground.

It should be noted that your wiring for the VR sensor should be a screened cable back to the ECU to sheild it from any noise, earthed only at the ECU end to an earthing pin on the 37 pin plug (e.g. pin8). The main ground wire from the ECU should really connect to 2 or 3 pins of the 37 pin plug (e.g. pins 9 and 10) and be around 3-4mm thick if possible, especially when using direct drive coils! Something like this cable HERE.


Position of Caps on Vehicles:

Tuning for Economy

To get maximum fuel economy, you want the engine to run as slowly as you can (hence the proliferation of overdrive transmissions in the last 15 years), and to run an Air/Fuel ratio (AFR) of about 14.7:1 to 17:1.

To tune for economy with a wide band oxygen sensor is relatively easy. Look up the sensor output at ~16.5:1 for your sensor (~2.65 volts for the DIY-WBO2, for example). Put that value as your EGO trigger point in MegaTune, and if your EGO Limit (%) is sufficient (given the state of tune of your VE table), you should be getting good economy.

You can try mixtures leaner than 16.5:1, however you may get a lean 'surge' that feels like someone is pushing the car forwards, then pulling it backwards. Generally, this is a sign that you are too lean.

With a narrow band, it's a bit tougher to set it for maximum economy. You can adjust the VE table, but the EGO correction tries to bring it back to a stoichiometric AFR.

You could raise your EGO_RPM_limit to just above your cruise rpm, but depending on where that is, it might not be all that workable. A better method, if you have a narrow band oxygen sensor, is:

new VE = {56% (14.7 16.5)} - 5% = 45%

Do this for all the values in the VE table you actually cruise at, but not the higher rpm, higher load areas of the VE table.

That keeps the EGO at 16.5:1 at cruise, but lets you set it anywhere else in the rest of the table.


Tuning for Emissions

To tune your engine for minimal emissions using MegaSquirt properly requires expensive test equipment. However, as a start, you can:

Here is an example of how a few changes affected one engine:



Retarded 10

Advanced 10





















Not usually tested






Not usually tested






You can see that retarding the timing and leaning the mixture slightly gives the best possible compromise, increasing only the NOx slightly among the regulated emissions. (The above was without a catalytic converter. With a converter, emissions would have been best at stoichiometric mixtures and the timing retarded somewhat.)

Spark Map Tuning

Before tuning the spark table ensure the Trigger Angle has been checked and set using a timing strobe, see HERE

Tuning the spark map may not seem the easiest thing in the world to do and it can be difficult to know where to start. Here is a base map that is for a Boosted engine (>100KPa = Boost)

Spark Map Tuning Basics - The idea is that the idle and low speed area's are retarded to around 8-20deg, usually idle will be around 8-12deg, but this depends on your engine's design. If you set the first row in the RPM range as a little under your usual idle (e.g.600 if your engine idles at 800ish) and add some advance here, so if the engine stumbles into this area the slight increase in advance will help it to speed up a little so it doesn't stall. The cruising area of the map should have a reasonably high advance, (low to high 30's) as the mixture will be reasonably lean and therefore will give a slower burn. The overrun area can have an even greater advance, this will allow you to run lean in that section. At Wide Open Throttle (WOT) the spark map needs to be RPM based (analogous to centrifugal advance on an old style distributor) coming in at the right rate relative to engine RPM. Typically, you want it "all in" by about 2800-3200 RPMs for a street performance motor.

Note the the optimum amount of total advance is not necessarily the most that doesn't cause detonation. For example, with a modern cylinder head design, you might get maximum power at 32BTDC, but might not experience any detonation until 38- 40. However you will still want the advance to come in as quickly as possible (without knocking) up to 32. For example, my Rover based V8 produces max power around 30BTDC at WOT, but even at 36 at WOT, I have no detonation.
As the Kpa increases (load increase) the spark map should retard as the mixture will be richer and the chances of detonation will also increase with the load. When going into boost the advance table values will need to be lower than when out of boost (>100KPa = boost) and as the boost level increases the advance will need to decrease with it, as detonation is more likely. It has been said that 1deg of advance should be removed for every 2PSI of boost; this is simply a rough guide and lots of things can depend on how much to remove including compression ratio. Detonation Cans are a great option for tuning in boost, use a piece of copper pipe flattened at one end with a flexible tube connected to it. Bolt the flattened end to the cylinder head. Get an old set of ear defenders and drill a hole into the side of them, push the other end or the tube into the hole youve just drilled in the defenders and you should be able to hear any detonation as it occurs.

Crusing is probably the hardest part of the spark map to tune, so this will need several rows set up around that area, see setting the KPa and RPM rows for fuel HERE as it follows the same theory. Shunting in the crusing area is usually down to too much advance, or too weak a mixture. If the mixture is correct (14.7 to 13.5 depending on your cam) then it may be worth removing advance untill the shunting subsides. Too little advance will reduce throttle responce so don't go too far, too little advance can also create higher exhaust gas temperatures. Go back and check the AFR after tuning this area, as the spark angle will effect the AFR readings.

There is a thread on the MSExtra forum discussing spark tuning further that can be found HERE.

One thing to bear in mind is that altering the spark table WILL effect the AFR. So you will have to re-visit the VE table after tuning the spark table.

If you experience detonation in your engine, then either:

* Your mixture is too lean. Increase the numbers in the VE table at the point the engine detonates (or increase the Req_Fuel if the detonation occurs at all points). Also make sure your fuel pump is operating well. It may be supplying enough fuel at idle, but not supplying enough when the demand rises. Use the oxygen sensor readings to determine if you are lean,
* You have oil leakage into the combustion chamber (check the plugs for signs of oil). This could come past the rings or seals (possibly worn, or from something that was forgotten during assembly, or there are blocked drain back passages in the head, or the rings have been damaged by detonation or over-revving), a 'leaky' PVC system, or from a poor intake manifold gasket seal allowing oil into the runners (on push rod V-engines),
* Your spark advance may come in too far and/or too fast. Edit the spark advance table to lower the rate at which advance is added. You may also need to limit the total advance. Most engines will not require more than ~36 at WOT (possibly more for a flathead design, or a large open chamber, large piston dome design). Newer cylinder head designs and 4 valve/cylinders heads generally don't require a lot of advance,
* You have spark plugs that are too hot (get a range or two colder), or they are incorrectly torqued (if they are loose, they over-heat because of poor thermal contact with the head),
* Your thermostat is too hot (you can try as low as a 160F thermostat for street use),


Setting the Acceleration Enrichments

In addition to the 'regular' acceleration enrichments, also check the X-Tau enrichments.

MS2-Extra has blended MAPdot/TPSdot abilities for acceleration enrichment. You can select the proportion of each using the slider in the 'Tuning/Acceleration' dialog in MegaTune (the variable is called Tps_acc_wght in the code). If you choose 100%, you get accel enrichment based on TPS only, if you choose 0%, you get accel enrichment based on MAP only. Of course you can set it to any integer between these (99%, 98%, 97%, ... 3%, 2%, 1%, etc.) and get 'blended' accel enrichment.

The ‘regular’ acceleration enrichment is selected by default or when Enhanced Accel Enrichment is set to off.

The amount of acceleration enrichment is scaled from 100% down to 0 in the range from the Low RPM Threshold (100%) to the High RPM Threshold (0%). To defeat this scaling, set both Low RPM and High RPM Thresholds to a very large RPM value (greater than your redline).

The default values are a good place to start (especially if your req_fuel is somewhere between 10 and 20 milliseconds). (To convert v/s (used with older versions of MegaTune) to %/s, assume that 0%=0 Volts and 100% = 5 Volts (which isn't quite true, but it is a start), then 1.0 v/s = 20 %/s, etc.)

The values on the upper right are the TPS based values (as noted by the heading above them), those on the upper left are the MAP based values.

The two vertical columns show the current TPSdot and MAPdot values, with the recent peaks 'tell-taled' in red.

Larger values in the "Value (ms)" entries increase the amount of accel enrichment. Smaller values decrease the amount of accel enrichment.

The slider chooses the percentage of MAP versus TPS, somewhere between 30% and 60% is good for most installations. Some installations may need to use values outside this range to solve specific issues.

MS2-Extra also has user configurable accel taper tuning:

The accel time is time during which the full accel enrichment is added to the injector pulse width (in seconds not milliseconds). The accel taper time allows you to have the accel enrichment taper from the set value to the end pulse width gradually, rather than having the accel enrichment end abruptly.

Each of these accel enrichments schemes has it's own threshold (the rate below which no accel enrichment is applied). For MAPdot this is the MAPdot Threshold (kPa/s) (MapThresh), for TPSdot it is the TPSdot threshold (v/s) (TpsThresh).

By watching the bar graphs in the accel wizard, you can see how much noise there is in the respective sensor signals. try to set you threshold(s) above these levels to avoid unwanted accel enrichment, which can make you engine run very poorly.

After you have the VE table dialed in, then start adjusting the acceleration enrichment. You may want to try a short acceleration shot time (like 0.2 seconds) and increase the accel enrichment bins.

If the car does not buck under acceleration, you are close to correct settings. If it bucks and stumbles, then it is going too lean and you need to richen that part of the table. Before tuning decel [or accel], make sure you have your VE table close to correct first! One way to do this is to get the VE table set up by setting the TPSdot threshold setting very high (250 kpa/sec or 250 %/s, something like that) so that TPS enrich/enlean never kicks in. Then, (in steady state) set up VE table.

To adjust the accel bins, start with them high, then reduce the lowest bin value by 0.1 milliseconds at a time until the engine stumbles or coughs under gentle opening of the throttle. If it never stumbles, increase the rate at which you open the throttle and try again. If it stumbles even with the above values, double them and try again.

Then repeat with the next higher bin and slightly faster throttle movement. Continue with each higher bin and more aggressive throttle application until all the bin are satisfactory.

The Decel fuel amount (%) (TPSDQ) enrichment can be used to improve the economy of your vehicle. It reduces the amount of fuel injected when the TPS (and/or MAP) are decreasing. A decel fuel amount setting of 100% means no cut. 1% means reduce the pulse width by 99%, to 1% of what it normally would be. Note that decel 'enrichment' is ONLY applied above 1500 rpm.


EAE Tuning guide

1. Introduction
Enhanced Acceleration Enrichment is a wall-wetting algorithm which tries to account for the fact that a significant portion of the fuel squirted into an engine gets stuck on the intake ports or manifold. Additionally, it also tries to account for the amount of fuel getting pulled off the walls of the intake ports or manifold.

2. Beginning to tune
One thing to keep in mind is that the algorithm EAE employs was designed to try to get the "commanded" amount of fuel to enter the engine. This means it tries to get the calculated amount of fuel from the VE table lookup, warmup enrichments, and other calculations into the engine, while accounting for the amount of fuel that will get stuck on the walls of the intake ports and other surfaces. This means that in order for EAE to work its best, it must be used with a well-tuned VE table.

With that in mind, the default settings are usually sufficient to get started. There are currently four tables, with a fifth to help with throttle response:

a) EAE Adhere-to-walls Constant (should be Coefficient):

This is the amount of each squirt that gets stuck to the walls of the intake port (and valves). Values from 20% at low kPa (high vacuum) to 60-70% at high kPa (low vacuum or into boost) are common. The minimum and maximum should not change very much, but the shape of the curve will vary from engine to engine.

b) EAE Sucked-from-walls Constant (should be Coefficient):

This is the amount of fuel that is sucked from the walls of the intake port during each intake event. In this curve, values range from around 2% at low kPa (high vacuum) to 6-15% at high kPa (low vacuum). Again, the shape of this curve should change more than the min and max values.

c) EAE Adhere-to-walls RPM correction:

This table is used to adjust the Adhere-to-walls Constant for different RPMs. The lower RPMS, the more fuel will accumulate. As RPMs rise, less fuel will accumulate.

d) EAE Sucked-from-walls RPM correction:
EAE Sucked From Wall RPM

This table is used to adjust the Sucked-from-walls Constant for different RPMs. At lower RPMs, less fuel will be pulled from the walls, and at higher RPMs, more fuel will be pulled from the walls.

e) EAE Lag Compensation: 

Engines using small number of injections can suffer from poor throttle response. During quick throttle movements, load can change significantly between injection events, so both basic fueling (Gve) and EAE contributions are not updated often enough for good, crisp throttle response.
EAE with lag compensation can help this problem by adding additional injection events when throttle or manifold pressure changes quickly. All the injections during this lag compensation event are smaller, so the total amount of fuel per revolution should be the same as a normal injection event. 

EAE Lag Compensation Settings Window

The trigger for lag compensation can be from either MAPdot or TPSdot. Additionally, the threshold in  either %TPS/second or kPa/second and max rpm can be selected in the EAE Lag Compensation Settings menu, which is available if Enhanced Accel Enrichment is set to ON with lag compensation in the Accel enrich settings window (above).

3) Tuning steps
Keep in mind that the minimum and maximum points on the EAE Adhere-to-walls and Sucked-from-walls tables should only be adjusted a little at a time, but the shape of each curve will make a large difference in how the engine responds to throttle movement. Any recommended adjustments below should follow this. Increasing the Adhere-to-walls values will cause the pulse-widths to increase when opening the throttle. This is because the amount of fuel sticking to the walls increases. The code compensates for the larger percentage of each squirt getting stuck to the walls by increasing the pulse-width to try to make sure that the commanded amount of fuel actually enters the engine. Increasing the Sucked-from-walls values tells the code that more fuel is getting pulled from the walls, so less fuel needs to be injected to achieve the same net amount of fuel going into the engine. With these guidelines in mind, the following steps are a good way to begin tuning EAE.

a) The best place to start is to adjust the Adhere-to-walls and Sucked-from-walls curves at a mid-range RPM, with the RPM correction tables at 100% across the board.
Get the engine to respond well under load, with minimal variation in AFR, and get it to behave well during quick throttle blips in this range.

b) Then, from idle, adjust the RPM-correction curves until you can get good off-idle response, no lean tip-in, and no stalls after a quick stab. Keep in mind the guidelines from earlier in this document. At lower rpms, more fuel adheres to the walls, and less fuel gets pulled from the walls.

c) Finally, do some full-throttle pulls to the redline, and make sure that on shifts, and on any slight throttle movement, the AFRs still react as expected. They should remain relatively smooth.

4) If you have trouble getting good throttle response on quick blips, then you may want to use EAE Lag Compensation. 

That should be enough to get a good tune with EAE.

For those interested in the math that this feature uses (similar to X-tau's math), the code is located in ms2_extra_main.c in release 1.0.0 starting on line number 1643, and in ms2_extra_ign_in.c, starting on line number 732.


VE Table Tuning Software

VEXME is a great peice of tuning software that is mainly for use with wideband lambda sensors. It can be used in EGO mode or AFR mode. Basically EGO mode looks at the correction that the ECU has been making during the datalog and averages out all of the points that cross your VE table. So it is important to have the Steps in Exhaust Gas Settings set to 1 or more (1 is usually enough). In AFR mode it compares the AFR from a 12x12 grid (this is generated in VEXME) to the AFR from the datalog. From there it can generate a new VE table based on the difference in the AFR's.

For more info on this software please see HERE

The critical settings are O2 step% and ignition events per step.

For fine tuning, keep the O2 adjustments per second between 3 and 5. For roughing in VE maps, set the O2adjustments between 5 and 10 per second (depending on how good the O2 sensor is, if it is old, go lower).

Once the map is tuned in, set the:

You can calculate your:

O2 adjustments per second = ((rpm/120) * cylinders) / ignition events per step

MSLVV Log Viewing Software and VE TableTuning Software

With MSLVV you can view your datalog files in graphical form using Megalog Viewer by Phil Tobin. This can be set for either narrow-band or wide-band oxygen sensor readings. Megalog Viewer is very configurable so it is highly recommended for the MSnS-Extra code. Using this viewer, you can see the trends in your datalog, and spot trouble areas more easily than viewing the numbers in a spreadsheet or punching the log through VEXME or MSTweak. When using Megalog Viewer the VE table and the spark table can be loaded into the screen, this makes tuning and reviewing the log much easier, as the running area of the log that your looking at is highlighted in the tables, (see the yellow highlights) so it is easy to see where you need to adjust the maps. Adjustment of the tables is easy too, as there are buttons to increment / decrement the values directly. The file can then be saved ready to be loaded into the ECU via Megatune. This program is well worth a look and is highly recommended for all to try, as it can make tuning a lot easier!

If you have a question, comment, or suggestion for this FAQ please post it on the forum.
Last Updated: 01/22/2008 18:23:33

No part of this manual may be reproduced or changed without written permission from James Murrey, Ken Culver and Philip Ringwood.

Based on the original MegaSquirt tuning guide: 2008 Bowling and Grippo. Used with permission.