Configuring MegaSquirt-II (or MicroSquirt)

Tuning Software

The software application you use to tune and configure your MegaSquirt-II (or MicroSquirt) is called MegaTune2.25+ by Eric Fahlgren.

Be sure to get the latest version of MegaTune 2.25+. Some earlier versions of MegaTune 2.25 will NOT work with the production releases of MegaSquirt-II (or MicroSquirt) - some important specifications were changed in beta testing. You can get the latest version (MT225) here:

http://www.megamanual.com/files/software/

You also need Windows 9X/ME/XP and a conventional serial port to communicate with MegaSquirt-II (or MicroSquirt). USB will may work, and many people have reported that they have been successful using a USB-serial adapter. Just about any computer that is capable of booting Windows 95 (or better) will be fast enough, but get the fastest laptop computer you think is reasonably priced.

To tune all the parameters of MegaSquirt-II (or MicroSquirt) so that your engine runs the best it can, you will need to do the following:

  1. First, install and learn to use MegaTune2.25 or higher,
  2. Next, set the constants,
  3. Get the engine started and idling,
  4. Then tune the PWM criteria,
  5. Then tune the cold start and warm-up enrichments,
  6. Then tune the VE table, the AFR table, and the spark advance table,
  7. Finally, set the acceleration enrichments,

This section of the manual covers the first two items. the remainder are covered in the Tuning MegaSquirt-II (or MicroSquirt) section. Before starting this section, be sure you have read and understood the information on the MegaSquirt-II (or MicroSquirt) Installation page.

Using MegaTune2.25+

General Advice and Operation

Some general principles to follow when setting the configuration parameters are:

Some Warnings

Note that it is possible to damage your engine and/or MegaSquirt® by choosing inappropriate tuning or set-up parameters in MegaTune. Be sure to read this document, and all associated tuning documents that apply to your engine, vehicle, and tuning circumstances. In particular, read the safety precautions.

Installing MegaTune

MegaTune has an 'automated' install package, similar to most other modern Windows software. You download the set-up file (see below), click on it, and the package installs itself. You may have to select some options, or you may chose to select all the defaults.

Files

Get the latest version of MegaTune from www.megamanual.com/files/software/.

To install the latest version of MegaTune on your computer:

  1. Click this link to go to the release site,

  2. Select the file MegaTune225p3_setup.exe and double click on it.

  3. Choose 'Run' or 'Run program from current location' when prompted.
  4. Choose all the defaults when installing the program, and it will create a folder called 'C:\Program files\MegaSquirt\MegaTune225' and subfolders 'mtCfg' and 'carMtCfg'. The install program also creates an icon on your desktop with the name MegaTune225..., DON'T click it yet, you need to set up MegaTune (see 'Using MegaTune225 below').

  5. The install program will also create a folder in 'C:\Program files\MegaSquirt\' called 'Car1', this is where all your vehicle specific information will go.

  6. Start up the MT Configurator (mtCfg.exe), which opens automatically during the installation process (it can be opened directly from the MegaTune folder at any later time). Open the MegaTune2.25bxxx tree item, and you'll see a number of megasquirt-II.ini.N.N files. Pick the one where N.N matches the version of embedded code you are running, highlight the .ini file version that you wish to use and execute File -> Activate. This will rename it to be "megasquirt-II.ini" (deleting the existing megasquirt-II.ini file first). It will then be used by MegaTune when it starts up.
    (Note that all 2.XY use the same 2.X INI file. For example, the 2.35 code uses the 2.3 INI file. This is the way the code upgrades are designed. Major revisions are incremented by +0.1 and require a new INI file, minor revisions (+0.01) use the same INI file.)

  7. You need to tell MegaTune which version of MegaSquirt® you have (MS, MS-II, MSnS-E, etc.), as well as the EGO type, etc. To do this, use the mtCfg program, which opens automatically during the installation process (it can be opened directly from the MegaTune folder at any later time). Look for the CODE_VARIANT variable, it will be in 'Car1/settings.ini/Settings/CODE_VARIANT' in the directory tree on the left side of the mtCfg window. Click on CODE_VARIANT. You can then use the drop box in the upper right section of the window to select your code variant.

    While you are in the setting.ini files, you can verify or change the EGO sensor option under LAMBDA_SENSOR if necessary.

    You can use mtCfg to change the color depth, temperature units (°F/C) and a large number of other parameters for MegaTune. See the documentation in the files displayed in mtCfg.

    Be sure to 'Save' the file.

  8. Increase the value of the interwrite delay from the default of 1. An interwrite delay value of 5 seems to cure most comm issues. You will find this value in the common.ini file, which is usually in the 'mtCommon' subfolder of the MegaSquirt® folder (i.e., C:\Program Files\MegaSquirt\mtCommon\common.ini). Make sure the preceeding line reads "writeBlocks = off", do not edit that line unless it says "on" (the comment is misleading, interwrite delay is still used if writeBlocks = off). You can open common.ini with Notepad, or copy it from this link: common.ini (right click and 'save as').

  9. You should now be able to launch MegaTune. Double-click the MegaTune icon (created above) on the desktop. In order to communicate with MegaSquirt-II (or MicroSquirt), you may need to set the serial port configuration. To do this, got to the Communications/Settings dialog on the MegaTune menu.

If you use a USB adapter, be SURE to set the buffer size to ZERO (0). You can change this in the Control Panel, look under 'System, Hardware, Device Manager'. The default buffer size for these adapters is typically 14 bytes. If this is the case with yours and you left the default, you would have no control over the data flow no matter what else you do.

When MegaSquirt® is loaded and communicating with MegaSquirt-II (or MicroSquirt), the first thing you will see is the front page, which shows eight of the more useful gauges:

A number of the sensor readings are displayed, as well as some outputs. For example, the injector pulse width is the measure in milliseconds of how long the injector is opened for each pulse, regardless of how many times it is opened in a cycle. Duty cycle gives the percentage of time the injector is open irrespective of individual pulse duration.

There is a bar gauge across the bottom of the window shows the oxygen sensor reading. The scale is determined by egoGauge value in the Tuning section of the MegaTune2.25+.ini file. This same setting controls the analog and bar gauges on the tuning page. The first value of this setting controls the lowest voltage displayed on the gauges, the second number controls the highest and the optional third value specifies the “alert” value, above which the LEDs are red. The bottom of the front page contains a status bar. The current file name (used for Save operations) is displayed in the left part of the status bar, followed by “saved” status. When the memory image has been modified since the last Open or Save operation, this entry shows “SAVED” in bold face.

However the front page is limited to eight gauges, which may not be enough, especially when you are learning to use MegaTune. If you go to the 'Tuning/Realtime Display', you can see many more at once:

This is a good page to monitor while experimenting with the stimulator and MegaSquirt-II (or MicroSquirt).

MegaTune2.25+ allows you to save and restore configurations as disk files (they have an .msq extension). Use the Open, Save and Save As menu items to do this.

Setting the General Parameters

Note that as the code develops, some advanced options may not be documented here. To find information on these advanced options, see the MegaTune help file.

Some general principles to follow when setting the configuration parameters are:

Now we are ready to start configuring MegaSquirt-II (or MicroSquirt)!

On the main MegaTune2.25+ menu is an item called 'Settings/General'.

You can set these as follows:

If you are using a knock sensor, separate baro sensor, or non-standard MAP sensor, you can configure MegaSquirt-II (or MicroSquirt) to work with them using the 'Sensor Calibration' dialog under 'Tools'.

The MegaSquirt-II code is set up for the standard General Motors temperature sensors. If you are using other sensors, you can use the 'Calibrate Thermistor Tables' dialog under 'Tools'. You enter the bias resistor value and three temperature/resistance points, and the table is created and downloaded to MegaSquirt-II (or MicroSquirt) for you.

IMPORTANT NOTE: Do NOT burn tables ('Calibrate AFR Table' or 'Calibrate Thermistor Tables') on a running engine. Even idle is NOT allowed, because these tables ONLY exist in flash, so once a table is erased, there is nothing but garbage in there until it is re-programmed, one word at a time. Until that reprogramming is complete, operating the engine is unsafe.

Idle Control Settings

The basic idea of IAC is that the motor or PWM solenoid starts out with a large opening of the air valve at cold startup, then gradually closes as the coolant temperature rises. The basic motor position at any given time is determined from the input table of step position versus coolant temperature. To this basic control algorithm, several features have been added as described below. You need to set MegaSquirt-II (or MicroSquirt) to tell it if you have a fast idle "solenoid type" valve or a stepper motor IAC, or neither. These are selected under Settings/Idle Control in MegaTune:

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.

Setting the Injector Criteria

Before attempting to start your MegaSquirt-II (or MicroSquirt) equipped engine, you will need to set a number of parameters that determine how MegaSquirt® injects fuel. These include the injector open time, Req_Fuel, injector control criteria, PWM criteria, EGO characteristics, etc. These constants are either calculated, or based on the configuration of your system. For the most part, these are very similar to those from MegaSquirt.

Note that for a Wankel rotary engine (Mazda 13B, etc.), see the MegaSquirt & Rotary Engines document for settings and other advice.

On the Settings/Injector Characteristics page:

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.

High impedance injectors can run on 12 Volts without problems. Low-impedance injectors require some form of current limiting. MegaSquirt® has pulse width modulation to limit the current. You need to set the PWM parameters to match your injectors:

Note that most distributors are shipping the V3 main board with the flyback circuit installed. If you are not sure, look for the presence of Q3 and Q11 on the heat sink (3rd and 7th from the left), or ask the distributor.

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.

On the 'Settings/Injector Control' page:

Note that for release 1.000, odd-fire is only in the code as a placeholder, there is no code supporting it at this time.

On the 'EGO Control' page:

Note that after you select your EGO sensor type, you should go to the 'Tools/Calibrate AFR Table' dialog and select the sensor output curve.

For example, if you have a narrow band sensor, select that; or if you have a DIY-WB controller select that, etc. Then click on the 'OK' button and a file will be create and downloaded to MegaSquirt-II (or MicroSquirt) that indicates the corresponding air/fuel ratio for various sensor/controller output voltages.

You can also create your own custom table by entering two point on the output curve.

There is more information on how to use these settings while tuning in the Tuning section.

IMPORTANT NOTE: Do NOT burn tables ('Calibrate AFR Table' or 'Calibrate Thermistor Tables') on a running engine. Even idle is NOT allowed, because these tables ONLY exist in flash, so once a table is erased, there is nothing but garbage in there until it is re-programmed, one word at a time. Until that reprogramming is complete, operating the engine is unsafe.

Setting the Tables:

Before starting your engine, you need to populate three types of tables: the VE table(s), the AFR table(s), and the ignition advance table.

Advance numbers can be specified in tenths of a degree (1/10°)

Setting the Ignition Options

MegaSquirt has a number of options:

If you are not entirely sure about your ignition settings, check the supported list for the settings you should use:

If your module isn't on the 'officially supported' list yet, you'll need to understand the relationship between the trigger offset, the input capture (falling or rising edge), and the spark out (going high or going low). There are some tip on setting these parameters in the tuning section of the MS-II manual.

In the 'Settings/Ignition Options' dialog you can select the:

Dwell Setting

Dwell is the length of time the coil charges to make each spark. It has to be long enough to make a decent spark, but too long heats the coil unnecessarily. It is in milliseconds, since the time between spark is typically a few dozen or less milliseconds. For example, for a V8 at 600 rpm, the time between sparks is 25 milliseconds. At 6000 rpm the time is just 2.5 milliseconds.

In general, use the default options and values unless you have a reason to do otherwise. You can calculate the appropriate times using the formula above and substituting different values for E.

MAP Sensor

If you have a non-standard MAP sensor (i.e., not the default MPX4250AP), then you need to do a calibration under 'Tools/Sensor Calibration'. You need to set both the MAP and barometer sensor to match the sensor(s) you are using. Press F1 while in the sensor calibration dialog to see values for some common sensors. Do NOT change the barometric correction, just the MAP and barometer sensor. You may need to edit the MegaTune ini files to show the full range of your sensor.



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.
©2004, 2008 Bruce Bowling and Al Grippo. All rights reserved. MegaSquirt® and MicroSquirt® are registered trademarks.