Click on our menu buttons immediately below to find MegaSquirt® information quickly:


MicroSquirt®/Sequencer Embedded 'Beta' Code

The latest beta version of the MicroSquirt®/Sequencer code is V3.760 (released Jun.28/2011).

This code will not work on MegaSquirt-II™ or the early MicroSquirt™s (V1.0 with the red main boards). It will only work on V2 and higher MicroSquirt™s with the green main board. This is because a different serial monitor/bootloader is used on these MicroSquirt™'s that allow the newest code to be loaded. See (2) here for more information.

V3.430 code requires TunerStudioMS (0.999.8d+), MegaTune will not work properly with this code. This is because with 3.760 code the user can now burn MAF tables and configure automatic CAN messages, and these functions are not in MegaTune.

The 'ready to load' .s19 file for uploading to MicroSquirt®/Sequencer is here:

Monitor_v3.760.abs.s19
(Right click and 'Save As')

For the V3.760 code, you will need to download and activate the latest megasquirt-II_3760.ini file (right click the link and 'save as' to your project folder, then rename it to 'megasquirt-II.ini'). Note that this release initiates four digit (i.e., 3.760) code numbering for INIs.

You will also want to copy the settings.ini file to your project folder (usually 'C:Program Files\MegaSquirt\Car1\mtCfg\')

Note that for 3.760 Code, the first thing you must do is set the ECU Type (under 'Fuel Set-Up/General') to match your hardware (MicroSquirtTM, or the SequencerTM), TunerStudioMS will not let you change anything else until you do this. ECU Type setting was inserted to head off the potential MicroSquirt® problems due to the coils being turned on with the old default configuration. As of the 2.88 code, if ECU Type is not set, the code will put the ignition outputs in a safe state and wait until a known ECU type is put in by the user.


To load the .S19 file to your MicroSquirt®/Sequencer over the serial port, you need to use Eric Fahlgren's latest MegaSquirt-IITM downloader program (click the link to download).

To use the downloader.exe:

  1. Power down MicroSquirt®/Sequencer EFI Controller,
  2. Ground the boot pin on the MicroSquirt®/Sequencer,
  3. Power up MicroSquirt®/Sequencer controller. The LEDs on MicroSquirt®/Sequencer will flash very briefly (if installed), then go out. This is proper response for the LEDs when the MicroSquirt®/Sequencer goes into bootload mode (i.e. when the bootload jumper is on).
  4. Start the downloader program, and select the appropriate COM port,
  5. Select the appropriate .S19 file, and the downloader will read, write and verify the code to the processor in about 10 seconds or so.
  6. The process ends with a message like "Verification succeeded, XXX records total (4 skipped)."
    XXX can be any number, usually around 950.
  7. Shut down the downloader program.
  8. Remove power from the MicroSquirt®/Sequencer controller.
  9. Un-ground the boot pin and start the controller normally.
See the readme file in the downloader package for more details.

Please report any problems you experience with the beta code to the forums at: www.microsquirt.com


Code version 3.430 User Inputs

1. ECU Type = 3 for the Sequencer.

2. Cam_Tooth: This is a user specified tooth number on the crank wheel with the significance that the cam synch must come after this tooth and before tooth no. 1. The numbering of the crank wheel teeth is such that tooth no. 1 is the first tooth after the missing tooth section. This allows the user to place cam synch anywhere on the crank wheel. Normally you would want to place it in the last quadrant before the missing tooth section, with Cam_Tooth defining a sector large enough that it is easy to place the cam synch and it will remain in the sector even at high rpm/ hi acceleration with excessive cam twisting. On the other hand, the smaller the sector the less probability of noise triggering a false signal.

In setting the Cam_Tooth you must consider 2 cases. The first is when you have ECUType = 3 (Sequencer), Dual Spark option = rising/ falling edge cam synch, with a missing tooth crank wheel, on a 4, 6 or 8 cylinder engine. In this case set the Cam_Tooth as described, meaning a number from 1 to N - M. In this configuration, the ECU will start the engine off in a temporary wasted spark mode, meaning it fires 2 coils and 2 injectors after each cylinder tach event. After it has achieved 8 cam synch verifies, meaning one rev with cam synch, one rev without cam synch, consecutively for a total of 16 =crank revs, then the ECU switches to sequential mode - one spark, one injection per cylinder per 720 crank deg - and no longer looks at cam synch.

Note that in MicroSquirt® cam synch is done differently and Cam_Tooth does not apply. With MicroSquirt® , which gives sequential only for 1 and 2 cylinder engines, the cam synch must be placed to trigger somewhere within the missing tooth section, and the engine will be synched as soon as the missing tooth is detected, and whether a cam synch occurred in the missing tooth section or not determines which of the two outputs is fired first. So set Cam_Tooth = 0 if ECUType <= 2 or DualSpkOptn is NOT falling/ rising cam sync; otherwise, set it equal to a tooth from 1 to No_Teeth - Miss_Teeth.

The second case for setting Cam_Tooth is when you are not configured as above, for example, no missing teeth, or a cam wheel, or 3 or 5 cylinder engine. These are cases where temporary wasted spark can not be achieved - you must have a positive cam synch/ sequential mode before the engine is considered to be fully running. If this is the case, you MUST set Cam_Tooth = 0 and put the cam synch trigger in the missing tooth section. In this case a positive cam sync is required before engine synch. If there are no missing teeth, then tooth 1 is the tooth immediately after the cam synch occurs.

3. Fuel and Spark Trims: These will work for 1-8 cylinders and are meant to be trims, but they are 16-bit words, and they have been tested to fairly large values like 100% and 40 deg. The resolution is 0.1 % and 0.1 deg. A +/-5% fuel trim is implemented by adding/ subtracting 5% to/ from the normally calculated VE correction. (For pure MAF VE would be 100%.+/- the trim) The spark trim is added to the normally calculated spark advance, so a negative trim number will retard spark. NOTE: trims are not used in any wasted spark mode, since you don’t know which is the actual cylinder. In a wasted to sequential mode, for example, a mssing tooth crank wheel with cam synch, the trims won’t take effect until the processor declares cam/synch/ sequential mode. (This wasted to sequential indicator has been added to the engine bit and is displayed through the ini file.)

4. Spk_fuel_offset is the number of cylinders by which to offset fuel timing relative to the corresponding ignition cylinder. It must be a positive number from 0 to no. cylinders - 1. Using both this input and the existing injector % timing offset, one can start injection over all or most of the 720 deg engine cycle. It is intended for use only with sequential mode. Although it has been well tested, it is still a good idea to check the output fuel timing on a scope to make sure the timing is as you expect. The following shows an example for a 4-cylinder sequential engine. Sn and Fn denote the timing of the spark and fuel injection for cylinder n relative to a 12-1 toothed wheel. The start of fuel injection here is delayed relative to the spark by 1 tooth (30 deg) of 6 (16%) in the tach peroiod, and is specified by the user input InjStrt (as % of tach period). Then which cylinder gets injected is determined by the Spk_Fuel_Offset. The default is 0 so here cylinder 3 will get injected 30 deg after spark on cylinder 1. Selecting an offset of 3 would cause cylinder 2 to get injected instead. Note that the cylinder no. is the number in the ignition firing order, and that the Spk_Fuel_Offset does not change the fact that cylinder n still gets fuel trim n, even though its fuel injection order has been changed.

4-cylinder sequential


                              Figure 2.
                                                                         
                           Spk_Fuel_Offset = 0 
						          
  InjStrt= 0%-----------à InjStrt= 78%
          /____                    / 
          |----|-------------------|  2 ms  | 
Inj1  ____|    |___________________|________|______________________________________

Note that Spk_Fuel_Offset, in conjunction with Injector_Start_Time can also be used in MicroSquirt® with a 2 cylinder, sequential, alternating configuration to move injection start time across a tach cycle. This is shown in Figures 3A and 3B below.


                              InjStrt= 0%------------à InjStrt= 78%
                                       /____                    / 
                                       |----|-------------------| 2 ms  |
Inj2 __________________________________|    |___________________|_______|________
                                
------------|--------------------------|--------------------------------|--------------
------Tach 1------------------------Tach 2----------------------------Tach 3

                                                     Figure 3A.
This figure shows the same configuration, but with SpkFuelOffset = 1, which is the same as swapping the injector wires for channels 1 and 2. Injector 1 can now be made to cover the Tach 2 to Tach 3 region and Injector 2 covers Tach 1 to Tach 2
 
                                          Spk_Fuel_Offset = 1 
																			         
                               InjStrt= 0%-----------à InjStrt= 78%
                                       /____                    / 
                                       |----|-------------------|  2 ms  |
Inj 1 _________________________________|    |___________________|________|_______


   InjStrt= 0%----------- InjStrt= 78%
          /____                     / 
          |----|-------------------| 2 ms  | 
Inj 2 ____|    |___________________|_______|_____________________________________
                               
----------|--------------------------------|-----------------------------|--------------
------Tach 1-----------------------------Tach 2------------------------Tach 3

                                                     Figure 3B.

5. Cranking Pulsewidth option. There are 3 Cranking Pulsewidth options (nskipCPW) which appear under the Fuel Menu, Start/ Afterstart selection. These are:

Note that you must cycle power afterward if CPWOption is changed. Note also that there is no control of when injections begin during cranking when the simultaneous CPW option is used (because it makes no sense). Another thing to note is that fuel trim is not added into the cranking pulse width. Finally, when the mode changes from wasted to sequential during cranking, simultaneous CPW continues until past cranking rpm.

6. tie1_2cyl: option (=1) to tie Ign1,2 outputs together either direct at the FETS or through a logic chip, or(=0) leave them separate and ignore one. Only applies for Microsquirt in dual spark/ toothed wheel mode to 1 cylinder engines and 2 cylinder engines with wasted spark.

7. Acknowledgement. This does not appear in MT. It is NOT a user input and does not appear in the msq file. It is a flag that is sent via CAN from the Sequencer ECU to the router processor to signal that it is up and ready to go. It is a synch between the processors at startup.

8. Added another MAF option for the case where there is a MAF and a MAP installed. In this mode MAF is used for fueling, but MAP is retained for the load index in spark and AFR target tables.

Code version 3.430 (Preliminary Model Based Code)

The purpose of the model based code is to control the engine through physics-based models of the different subsystems. For example there has always been a model for the fuel injector that allows the user to input characteristics of the injector such as open time and flow rate, that can be accurately measured with fairly simple instruments. Given these inputs and a desired amount of fuel, the code can calculate the amount of time the injector needs to be turned on and the result is very accurate fuel delivery without tables or control loops that need to be tuned. This assumes of course that airflow is equally accurate, and ensuring this is perhaps the primary reason for expanding the model based code.

Warnings: The model based code/user parameters have not been tested in a vehicle. Use with great caution. Be sure to:

  • (1) get your car working without model based code first, and
  • (2) use caution if you want to try it as it hasn't been tested in-car.

    While the same thing can be done with air flow, it is a bit more complex. This version of the code includes options for three common engine configurations, MAF only, MAP only, and optimally MAF plus MAP.

    1. MAFOption: the last option in code version 3.343 was replaced by a model based, feed forward option which uses MAF for fueling and MAP for a transient correction to MAF airflow to compensate for manifold filling time lag. The current four options are in the table below.

    2. VE, Spark, x-tau, AFR table and AMC load index (VEIXOption). Options are as follows:

                   VEIXOpt       |  map only          map/maf-blend          maf only     map,maf-no blend
                   ------------  |  ------------     --------------------   -----------    -----------------------
                  0 = map        |     map            <--blend---->           load_43           map
                                 |
                  1 = map/baro   |   map/baro         <--blend---->           load_43         map/baro
                                 |
                  2 = load_43    |     N/A                 N/A                load_43          load_43
    
    ote: load_43 means the load is based on SAE PID 43 (applicable only with a maf sensor). This is an international automotive standard for calculating engine load based on airflow measurement and engine speed and displacement.

    3. maf_tlag: MAF lag time constant for cylinder filling Feed Forward model, ms x 10. This compensates for sensor delay.

    4. mafLF: coefficient for lag filter of the corrected MAF. Range is 1 - 100%, with 100% representing no filtering.

    5. fRate: steady state fuel flow rate of injectors (mg / sec).

    6. Vmfld: volume displacement of the intake manifold + ports, cc or (m^^3) x 1000000. Also includes volume of ducting downstream from throttle plates.

    Other Changes

    It should be noted that there were several other significant changes in this code version not all related to model based algorithms:

    (1) - expansion of the output display data stream (outpc) from 112 to 130 bytes. This was necessary to provide additional real-time display variables for the model based algorithms. It means you MUST use the correct ini file or you will see incorrect real time display outputs. New outputs include the following:

    (2) - a new flash memory page (0x38) was required to handle the memory expansion needed for the model based algorithms. This has broken the bootloader code which is installed into MS-II™ daughter boards. The consequence is that code versions 3.410 and above can only be loaded on newer (v2.0, green board) MicroSquirt® and Sequencer units, which do have the new bootloader. MS-II™ units would have to be reprogrammed with the new bootloader code by a dealer or someone who has access to a BDM downloader device.

    (3) - One of the idle air control timer pins was moved from PT7 to PT3 so that PT7, which has a pulse accumulator function, could be used to read the output from frequency-based MAF sensors. This change only affects the internal firmware, the Ampseal pinouts were not affected.

    (4) – Several bug fixes were made for CAN pass-through mode (uses Tuner Studio plus ECU to talk to CAN-enabled devices). Also fixed bugs and completed auto-transmit for the CAN out_message configuration code (allows a CAN device to request data variables arbitrarily located within the outpc message structure in the ECU). The auto-transmit can then be activated for any or all of 8 allowed configurable messages (up to 24 bytes per message group) by a new input, activate_xrate. These updates require Router code v1.2600.



    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, 2010 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.