MicroSquirt® Embedded Code
MicroSquirt® can use the same embedded code as MegaSquirt-II, and you can use any of the V2 code versions intended for the C64 version (with CAN) of the processor. However, MicroSquirt® has a few of its own specialized hardware functions (dual spark is the main function) and these are only implemented in code version 2.8 and higher.
Unlike MegaSquirt-II, MicroSquirt® comes with the embedded code already loaded onto its processor. You can still upgrade to newer versions of the code as they are released, of course, but you won't have to load the code initially to get MicroSquirt® working.
The current 'release' code for the MicroSquirt® controller is V2.890.
The source code is here:
main_v2.890.c
The 'ready to load' .s19 file for uploading to MegaSquirt-II(CAN) is here:
Monitor_v2.890.abs.s19
(Right click and 'Save As')
For the V2.890 code, you will need to download and activate the latest megasquirt-II.ini.2.890 file (right click the link and 'save as' to your project folder, then rename it to 'megasquirt-II.ini').
You will also want to copy the settings.ini file to your project's \mtCfg\ folder (usually 'C:Program Files\MegaSquirt\Car1\mtCfg\'). It will solve the "Conditional check references undefined value n2o" and "Conditional check references undefined value 'EXPANDED_CLT_TEMP'" errors.
You can also get the latest code and INI using the V2.0 downloader, which will get the code from the internet, and load the code to MicroSquirt® as well as installing/activating the matching INI. There's more info here: www.megamanual.com/ms2/downl2.htm
V2.890 has the following improvements over earlier code for MegaSquirt-II:
- Scaled IAT-based spark retard to allow user to set rpm limiting on IAT correction. It has a Hi and Lo Rpm and goes from full IAT table retard at and above Hi rpm to no retard at and below Lo rpm, interpolate in between. The default rpms are Lo=800 and Hi=1500.
- Added option for dual spark cam inputs for 2 cyl., with Option = 6 same as 1 (2 ignition inputs and 2 outputs) except timing signal from 1 cam tooth, 2 cylinder only.
- Dual Spark: 2 cylinder COP (coil-on-plug)/ 4 cylinder wasted spark using cam sync and/or toothed wheel.
- When Prediction Option = "2nd Derivative at low Rpm; 1st Derivative at high Rpm", the 1st derivative prediction is also used when the rpm rate of change is slow - this reduces the fluctuation when the car is just idling or cruising, and the 2nd derivative over-corrects in response to the RPM jitter. This change and all others following apply to both MicroSquirt® and MS-II.
- Addition of MAF and also a combined MAF/ MAP mode. A major addition to the MicroSquirt® code is MAF (mass air flow) sensor capability and also a combined MAF/ MAP mode. Rather than calculating the air flow from the VE table and manifold pressure (MAP), the mass air flow sensor measure the amount of air directly.
When the MAF option is selected, the sensor would normally be wired to the MAP pin. If, however, the combined MAF/ MAP option is selected, then MAF MUST be moved to another pin. There are two choices: the barometric/ second EGO sensor pin and the knock sensor pin.
- The alpha-N blend logic was modified to allow alpha-N fuelling to be implemented at low rpm or at high rpm. The former is often used to maintain a more stable idle on an engine with, for example, independent runners and/or a really bad cam. The latter is often the preferred mode for bikes, since the MAP quickly saturates well before max throttle angle is achieved.
- We were told by Ben Strader (EFI University) that the VE, AFRTarget, and spark tables should be entered with an index of (MAP/ Baro) rather
than MAP, and we confirmed this from Heywood and Taylor, standard reference books for combustion engines. So this has been put in as an option. In theory this provides a better baro correction - but you can still use the existing corrections if you want, or set them all to 100%.
VEIXOptn; =1 means use (MAP*1000)/ Baro instead of MAP as the index into the VE, AFR, and spark tables.
When this is done, then the fuel pulse width is:
PW = Req_Fuel * .............. * MAP(kPa x10)/ Baro(kPa x10)...
instead of
PW = Req_Fuel *..............* MAP(kPa x10)/ 1000 ...
- There is an option to multiply pulse width by AFRStoich (new user input) / AFRTarget. This was requested to make tuning easier in the sense that the VE table can be left alone after a basic dyno tune, and then you can do further tuning by just changing the AFR Target table to make things slightly richer or leaner. It might be particularly useful for wide band EGO sensor users.
- Fuel pulse width, PW, is set to 0 whenever VE is set to 0. This eliminates a fuel dribble from the injector opening time (especially where this is not known and set accurately). It also eliminates current flow to the affected injectors when pulse width = 0.
To load the .S19 file to your MicroSquirt® over the serial port, you need to use Eric Fahlgren's latest MegaSquirt-II downloader program (click the link to download).
To use the downloader.exe:
- Power down MicroSquirt® EFI controller,
- Ground the bootloader wire (AMPSEAL connector pin 15, purple wire with a black stripe),
- Power up MegaSquirt.
- Start the downloader program, and select the appropriate COM port,
- Select the appropriate .S19 file, and the downloader will read, write and verify the code to the processor in about 10 seconds or so.
- The process ends with a message like "Verification succeeded, XXX records total (4 skipped)." (XXX is a number around 990).
- Shut down the downloader program.
- Remove power from MicroSquirt.
- Remove the boot jumper (or put it on just on pin for storage),
- Start MegaTune and set the COM port and speed (115200 for MicroSquirt) if necessary. (Make sure you have configured MegaTune to interface with MicroSquirt® using the mtCfg.exe utility in the MegaTune folder.)
- Since you have changed code version, you need to change the INI file. Download the code from the link above and save it in your project folder. The INI files have names like "megasquirt-II.ini.2.8", where 2.8 indicates the code it is to be used with. Find the appropriate numbered INI file, and rename it to "megasquirt-II.ini". MegaTune will then use that file for setting up, and everything should work fine.
See the readme file in the downloader package for more details.
You should recreate your settings file from scratch by entering the values by hand into MegaTune.
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.
©2005, 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.