A. Version 2.98 is a "beta" version for MegaSquirt, which has been re-released as version 3.000. The changes to version 2.98/3.000 over 2.00 are:
;-----------------------
; Version 2.98
;-----------------------
; Modified boot_r12 file to raise the LVI trip point.
; Fill unused RAM locations with $32, an illegal opcode to force a reset. Done
; to prevent flash erasure if code ever gets into a runaway state - for protection only.
; Put in interlocks to prevent VE/Constant section flash erasure unless specifically
; invoked by a flash burn command.
; Put in Odd-fire RPM averaging (Willette) for odd-fire engines.
; Added new calculation structure to code - same calculation as HI-RES code, but results
; are in 0.1 millisecond units. Calculation overflow fixed.
; Flyback damping code installed - jumper port X0 for INJ1 and jumper port X1 for INJ2.
; Fixed display of WARMCOR variable (no flickering).
; Inhibit PWM mode while cranking.
; Made "ADC" into "ADD in ADC interrupt section (Tom D) to properly perform the sum
; without a carry.
; Perform 12 ms time compare for re-enabling of tach IRQ interrupt (fix for random tach problem) -
; original trial time of 20 ms too long (Magnus Bjelk fix - also for high/low byte check).
; Moved after-start enrichment to increment after "N" tach pulses have occurred,
; with N being the number of cylinders. This will lengthen the afterstart enrichment
; time by an amount scaled by the number of cylinders (Tom).
; Fix display of barometer correction (no screen flicker if 100% barometer is selected).
; Fixed IRQ counter to work properly for NCYL above 8 cylinders.
;
The version 2.98 code is at:
http://www.bgsoflex.com/v2.98/megasquirt.asm
http://www.bgsoflex.com/v2.98/megasquirt.h
http://www.bgsoflex.com/v2.98/boot_r12.asm
http://www.bgsoflex.com/v2.98/megasquirt.s19
You really only need the last file (megasquirt.s19) if you are not modifying the code.
Then grab Eric's program
download.exe, included in the file tools.zip in the Files section of the MegaSquirt Forums.
Unzip the file to a convenient directory. Instructions for using download.exe are in DOWNLOAD.TXT in the zip file.
Note that V2.98 is required if you are using the new FlyBack Board.
There are a number of other specialized versions of embedded code for MegaSquirt. See Colin Gebhart's guide for compatibility and files.
MegaSquirt-II has it's own code, and there are two version, depending on your particular MS-II. Find out more here.
A. Find it here: www.megamanual.com/ms2/code.htm
A. If you get into Mini-Term in MegaTune (or hyperterm), and type "S" (must be upper case) with MegaSquirt® running and connected, you should get the 'signature' returned that tells you the code version.
A. To communicate with MegaSquirt-I, you need to set the serial port parameters to 9600, No Parity, 8 bit, 1 stopbit (i.e. 9600,N,8,1). This is done automatically by MegaTune. For MegaSquirt-II, the parameters are (115200,N,8,1) Look at the MegaSquirt assembly code near the section below for complete details on the mode commands.
***************************************************************************
**
** SCI Communications
**
** Communications is established when the PC communications program sends
** a command character - the particular character sets the mode:
**
** "A" = send all of the realtime variables via txport.
** "V" = send the VE table and constants via txport (128 bytes)
** "W"+{offset}+{newbyte} = receive new VE or constant
byte value and
** store in offset location
** "B" = jump to flash burner routine and burn VE/constant values
in RAM into flash
** "C" = Test communications - echo back SECL
** "Q" = Send over Embedded Code Revision Number (divide number by
10 - i.e. $21T is rev 2.1)
**
***************************************************************************
A. Yes. See the Code section of the manual for details on how to upgrade the firmware.
A. Unless you want to edit and recompile the source code, you can upgrade to any version of the code by uploading the corresponding .s19 file.
The .asm file is the human readable source code. Open it up with Notepad and look it over. You may not understand it but it is very well commented.
The .inc files are included by the compiler directed by command in the .asm file. In this case it is used to load tables. This can be read with notepad.
The .h file is called a header file. It contains 'defines' and 'equates' (constants). Open it up with Notepad.
The .s19 is called the 'source record' or S record for short. This is the result of running the .asm through the compiler. This is not the program in binary form but it is a text format that tells the loader where and what to write to the device's memory. You can read this file if you understand Hex and op-codes.
All you really have to know is that you have to upload the .s19 file. See the Code section of the manual for details on how to upgrade the firmware.
A.
Then you might want to look at the manual at http://www.freescale.comfiles/microcontrollers/doc/ref_manual/CPU08RM.pdf. (Note that this link may change. Search the Motorola site if you get a dead link.) This document covers the architecture, resets and interrupts, addressing modes, and instruction sets for the MegaSquirt processor.
An absolutely outstanding book on micros is entitled Embedded Microprocessor Systems, by Jonathan Valvano, ISBN 0-534-36642-2.
It was one of the best books Bruce has seen in years - it ranks up there with Horowitz/Hill "Art of Electronics" and "Numerical Recipes". This one is destined to be a classic. It has info on programming Mot HC05/HC08/HC11/12 processors, and all of the hardware that people like us are interested (stepper motor driver circuits, sensor interfaces, etc). Not a lot of theory, just meat. Also there is a lot of info on algorithms like PID loops, how to make a real-time scheduler, etc. - things we are all interested in. In the front and rear cover, it has charts and tables on practical items (like different capacitor types, popular transistor types with relevant info, etc).
Get this book and you will be able to make MegaSquirt circuit and software changes yourself. Expensive at $107.00 but worth every dollar.
The MegaSquirt processor is clocked at 8 MHz. Here are some comparisons:
1) GM ECUs use the HC11 processor, running at either 1 or 2 MHz bus speeds (not crystal, but instruction clock speed). The MegaSquirt 68HC908 processor clocks at either 4 or 8 times faster. The MegaSquirt embedded code is about 1/3 the size of the GM code. In addition, the GM code maintains three timer loops. And, it does ignition function as well.
2) Chrysler systems use 1 MHz HC11 as well. FI, ignition, and alternator control.
3) Electromotive uses the 2 MHz HC11 (they use an ASIC for timing and spark).
4) This one is interesting: the PerfectPower MIC3 computer uses a Microchip PIC17C42, which is a nice part. The clock it at 25 MHz external (crystal) *but* the frequency is divided by 4 (internal) to yield a bus frequency of 6.24 MHz. The MIC3 computer does FI and 4-channel DIS ignition control (wasted spark).
Here is the interesting part - looking at their schematic (which they put in their manual), the ignition triggers come directly off of port pins 7, 15, 18, and 30 (for each channel). If you look at the datasheet for the 17C42, you will see that these are not output-compare ports, but regular I/O ports. So, these triggers must be controlled using software - a timer loop of some sort. A while back on-list, we went over the feasibility of bit-banging ignition triggers, and the resultant accuracy - it wasn't very good with a 0.1 ms timer control at higher RPMs. We don't know what loop rate the MIC3 is running for the timer - but imagine that it is higher than 0.1 ms.
A. Yes. Use a normally open push button switch connected across R6, so you can simply enter the bootloader by holding the button and applying power to the MegaSquirt. Since MegaSquirt only watches the voltage across R6 at boot up (for this purpose, anyhow), releasing the button leaves it in bootloader mode until you type "X" to enter to MegaSquirt controller code.
You may want to use a locking toggle switch - just to make sure you do not accidentally flip the switch while in the car. The software only checks for bootloader mode at power up, but if you had the switch closed and did not know it, you may spend a lot of time hunting down a problem that is due to a switch closure.
A. Those of you wanting to do staged injection you have also got an alternative way, using the standard MegaSquirt® hardware and code. 'Kurt staging' (named after the originator, Kurt Heintz) is a method of improving the dynamic range of a set of injectors. It takes advantage of the fact that the injectors timers are independent, and thus they can overlap. This means that one injection event does not have to finish before the next starts.
To implement Kurt staging, you can use a second set of identical injectors that feed each cylinder and hook the INJ driver #1 to the first set and INJ driver #2 to the second set. What will happen is at idle the injectors will alternate their pulses but as your VE values increase they will start to overlap pulses and allow full flow from both injectors at the same time. In essence, you progress from alternating to simultaneous as pulse widths increase.
The available time, in seconds, to inject (for a 4 stroke cycle) is:
Whenever the pulse width is greater than ½ of this, Kurt staging will be in effect.
For example, at 6,000 RPM on a with port injection you have a maximum of 85% of 720° to inject, or 17 milliseconds. If you change this to 2 squirts you have 8.5ms per squirt (ignore inj_on). For example, if you had two 19lb injectors per cylinder and suppose VE=100 when the pulswidth was 8.5ms. Up to this point each injector is on separately, i.e. one squirts for 8.5ms, then the other squirts for 8.5 ms. Above this they start overlapping, up to the point that, at VE=200 you have 17ms of injection at 38Lbs. Kurt staging gives twice the dynamic range of a single large injector on standard code.
The main criteria is that the engine must be set up so that it could conceivably run on either bank. For port injection, you must use two injectors per cylinder. For throttle body injection, you don't have any special hardware requirements. All injectors must have the same flow rating. They are then wired up, half to INJ1 bank, and the other half to INJ2 bank.
The injectors are set up to run alternately with the 'injector staging' parameter in MegaTune. For example, on an independent runner 4 cylinder engine you set the MegaSquirt® to 1 squirt/alternating. Each runner will have 1 injector from each bank squirting into it. This will in effect squirt once per cycle into each runner, first from one injector, then from the other on the next cycle. But, these squirts can overlap, so at higher revs, you can have both injectors squirting during the same cycle, injecting more fuel than one injector could.
Kurt staging works with the MegaSquirt® as is, requiring no additional coding. You will need to have all the same size injectors placed as close as you can get them to each other and might need to alternate the injector banks for each INJ driver to get a smooth idle (IE. INJ driver #1 drives "A" injector for cyl #1, drives B injector for cyl #2, drives A injector for cyl #3 and drives B injector for cyl #4; INJ driver #2 would drive the opposite injector as the first INJ driver).
So if you have two equal injectors feeding the same cylinder (with a port injection set-up - TBI are almost always the same size injectors) you can use the above mentioned method, if you are running an extra set of different injectors or up stream injector/injectors you will need to use the dual table code, rather than Kurt staging.
Kurt staging is useful for turbos and also for high revving motors, as well as when it is more convenient to get another set of small injectors to get desired fuel flow (IE. Doubled up 19# injectors on a high powered 351W might be more cost effective than a set of 40#'ers.
A. You may be cranking faster than the 'cranking enrichment' cut-off speed of 300 rpm, and running off of the VE table while cranking. This can make it difficult to start your engine.
The cranking speed can be changed in the code to suit your application quite easily. MegaSquirt-II allows you to do this as a user setting in MegaTune ('Settings/General Settings' from the main menu).
For the standard MegaSquirt-I code, you need to edit and recompile the code. Find the section of the code that has the following lines:
CHK_FOR_WENRCH:
cmp #$03 ; Check if we are cranking
bhi WARM_UP_ENRICH
This is where the cranking rpm check occurs. If rpm exceeds 300 (indicated by #$03), then it branches to the warmup enrichment calculations, and assumes the engine is running. Change the $03 number to suit your cranking speed, and you've got your own custom code version with a higher cranking/running transition point.
A. With MegaSquirt-II, you can set this with the 'Settings/EGO Control/Active Below MAP' parameter. For the standard MegaSquirt-I, if you know how to mess around in the .ASM and recompile, here's what you do:
Find the section entitled "MAE"
remark out the following lines by including the semicolon before it:
;lda tps
;cmp #$B2
;bhi SKIPO2
directly under that, add the following 3 lines:
lda kpa
cmp #90T
bhi SkipO2
Recompile the code, load it onto your processor and go...