Archieve copy of Intitial config
The engine management firmware has quite a number of parameters, these are daunting to a newcomer, but vital if you want to extract the best performance from your engine.
Warning: every time you upload a new firmware, config and tables must be uploaded too
steps in short:
- save your config (mcd, mct) before the upgrade; I guess you always keep uptodate config.txt on hardisk anyway. Save mcd config when you get the board, but only pump_pw_zero is useful currently.
- upload the firmware (after you saved your config and tables)
- upload your config.txt config to the AVR: run make mtt and upload config.mtt with a TerminalProgram, see GenBoard/MenuSystem. This must happen after you uploaded the new firmware.
It is dangerous to attempt to start an engine without thorough review of the config and tables, and some OnlineCourse/OffEngineTesting (at the very minimum injector and ignition outputs must be tested, possibly with lightbulbs). Eg. too high dwell settings (that are absolutely valid for another ignition transformer) or misconfigured inputtrigger (that is valid for another setup) can fry the ignition coils.
The firmware and config that comes in the board: only useful for testing, not ment for production.
See If you're new to this and don't know how to upload firmware or config yet, go and read MembersPage/JohanEriksson/VerThreeFirmForDummies for a quick start.
- Information from this page is being moved to GenBoard/Manual (config column of the matrix) for easier searchability and more examples for particular types of installs
- To understand the parameters can follow the details that follow, at times you will need to consult the MegaManual (the basic, but most important fuel related paramenters are described very well), and for some of the most advanced ones you might need to consult the code (struct config_t comments in global.h that also appears on LCD during mttc, and comments in the functions).
- Basics/HexaDecimal if you are not familiar with hexadecimal number system
- Basics/ElectronicEngineManagement if you are horrified by the number of parameters that can be set (which is a nice feature, actually: you are not stick with default values if you want to tinker)
How many settings are there?
- mcd output from GenBoard matches config.txt, and config_t in global.h. More than 250 variables. If the config.txt has less (or more) variables than global.h suggests, make mtt (make_conf.pl) will warn about the differences. Large sections can often be disabled (the variables are still there, but with no effect). Eg. with ego_lean_limit and ego_rich_limit=00 the other ego parameters take no effect at all.
- mct shows the tables: up to about 4x16x8 table elements
The file config.txt contains the settings that define the operation of the GenBoard, the following section details each setting.
- Priming pulse at -40 F [100 usec] eg. 0x40 * 100uS = 6400uS
- Priming pulse scaling at 170 F (0x80=half, 0xFF=same as cold) 0xA0 = ~63%
- Cranking pulsewidth [x100 usec] at -40F eg. 0xE0 * 100uS = 22400uS
- Cranking pulsewidth [x100 usec] at 170F eg. 0x40 * 100uS = 6400uS
Be aware: sematics have changed in firmware versions after 14/08/2004, before all injectors were fired during cranking. Now the injectors are fired in the sequence defined in h table. If you have tuned these before and are moving to a more recent firmware your cwl/cwh values might need adjusting. Tip: found [Matt Dupuis cranking pulsewith calculator xls sheet], might come in handy.
- Cranking threshold, if you set this to 0x03 cwl/cwh values will be used till 399 rpm [x100 rpm] eg. 0x03 * 100rpm = 300rpm
- Afterstart warmup enrichment (%added value) 0x50 = 80%
- Afterstart warmup scaling at 170 F (0x80=half, 0xFF=same as cold) 0xA0 = ~63%
- Afterstart number of engine cycles, NOTE: This is not ignition events anymore
Warmup temperature defines temperature steps for the following tables, these are pretty constant across most installations
- warmup_clt_range=00 eg. -40.0 C
- warmup_clt_range=14 eg. -28.8 C
- warmup_clt_range=28 eg. -17.7 C
- warmup_clt_range=3C eg. -6.6 C
- warmup_clt_range=50 eg. 4.4 C
- warmup_clt_range=64 eg. 15.5 C
- warmup_clt_range=78 eg. 26.6 C
- warmup_clt_range=8C eg. 37.7 C
- warmup_clt_range=AA eg. 54.4 C
- warmup_clt_range=C8 eg. 71.1 C
Warm up enrichment as function of temperature, biased at 100 (0x64)
- warmup_clt=8D enrichment @-40.0C
- warmup_clt=64 no enrichment (0x64==100 which is *1.0) @71.1C and above
Warm up enrichment as a function of RPM, biased at 100 (0x64)
The injector pulse width, in milliseconds, required to supply the fuel for a single injection event at stoichiometric combustion, 100% volumetric efficiency and standard temperature .
To calculate this you can use the MegaSquirt [ Configurator] program, you may also need to convert your injector rate from cc/min to lb/hr the equations at [Edelbrock] will help although the equation is:
- (CC/MIN = LBS/HR X 9.71 OR LBS/HR = CC/MIN X .103)''
Explained in MegaManual. You might not want injection on each of the input pulses. Input pulse is directly the InputTrigger pulse in case of coil-type trigger, and at the missing tooth detected - precisely: first tooth after it - in case of multitooth wheel. If you set to N, you will get quirt on every Nth input pulse
See GenBoard/Manual/Config/InjectorOpening for injector opening related configuration.
- Constant for calculating, rpm = 12,000/ncyl (0: high byte)
- 3 Cylinder (12000/3) = 4000 (0x0FA0)
- 4 Cylinder (12000/4) = 3000 (0x0BB8)
- 6 Cylinder (12000/6) = 2000 (0x07D0)
- 8 Cylinder (12000/8) = 1500 (0x05DC)
Accel TPSDOT threshold (throttle sensitivity), this specifies the minimum rate of change to enable any acceleration enrichment
Rate of change bins for use with tps_thresh. If 14 =< actual delta(throttle position) < 28 then tpsdotrate is the active bin.
TPS acceleration amount (fn TPSDOT) [100 usec]. This is the acceleration enrichment pulsewidth, the active bin is determined by tpsdotrate.
Deacceleration fuel cut, 100(0x64) means no fuelcut because of sudden tps-release. This can cause lean condition, misfire, kill-the-cat etc, so take care. 00 would be rough behaviour, other value under 96% (0x60) is dangerous, I'd leave it at 100%:
Overrun fuelcut: injectors disabled above this [x100 rpm] eg. 17(0x11) x 100 = 1700rpm when engine.tps <= config.iac_tps_thres (TPS fully released). Care should be taken here with any automatic transmission car. There should be at least 400RPM between overrun_fuelcut and overrun_fuelresume
Rev limit (hard) [x100 rpm] eg. 0x46 * 100rpm = 7000rpm
Fake airdensity low limit (low rpm only), 0==disable eg. 0x62 (98)
Use to avoid enleaning of AFR when idling due to increased intake air temperature. A value of 98 (decimal) will limit the leaning of AFR at idle to 98% at 25C degress.
- config13=.. read FuelPage
mt_unused is the most silly variable of all. Some MegaTune versions ruined a few bytes, so we reserved this for such naughty megatune. All the ruined variables are mapped to just 1-byte. Write anything: eg. your favorite number and you'll see if your megatune still trashes it.
Calibration of the voltage divider (VBatt)
the calibration is downscale only, if you use the v3.0 voltage divider resitors (100k, 20k -> ADC0 = VBatt / 6 ), a good starting value would be FF, if you have the new v3.1 voltage divider (75k, 22k -> ADC0 = VBatt / 4.409) BB would be a good starting value (BB = FF / ( 6 / 4.409)). Please calibrate yourself, the values above are only a rough estimate
Fast idle temperature, open solenoid valve under (fastidle - 40 Fahrenheit): if you want 88F, set 88+40 = 128 = 0x80
mean barometric pressure
tps, min adc-count
Radiator Fan Configuration
Temperature when fan will turn on, in degrees F, -40F offset, if you want 185F(85degC), set 185+40 = 225 = 0xE1
IAC Configuration See GenBoard/Manual/Config/IdleControl
EGO Configuration See NarrowBand
unused bits are ignored, but set them high by tradition - eg 11111xxx
0xFE coil type trigger, falling edge (EDIS)
TODO: explain direct ignition settings, igncount=.. and h=.. and give examples - DummyIgnition page looks good for it
turn off fuelpump after inactivity time [262msec] 0x08 * 262 = 2096mS
minimum time to leave fuelpump on at startup [262msec] 0x0F * 262 = 3930
Mik's Example files
Note that even this configuration might work for Mik, it might destroy your engine.
You must know what you are doing, that's very important.
See also GenBoard/MenuSystem for
- how to use these files (make mtt and send the mtt files with SoftwarePage/TerminalProgram?) and
- how to save your config and tables into files like this (mcd and mct commands and cutn'paste)
- or how to quickly set individual parameters in the ECM SRAM and EEPROM (without files involved, in the mtt menu, mcs needed to copy to EEPROM)
Once you get the above files you need to do a couple of things (which are also described in GenBoard/MenuSystem as noted above):
- Copy the files to the etc/ directory of your firmware directory.
- Open the config.txt and tables.txt and make needed changes to fit your setup.
- Save the changes
- Open command prompt, navigate to firmware directory and type "make mtt"(this adds config.mtt and tables.mtt to etc/ )
- Download the firmware to AVR
The above steps need only be used once as long as firmware version changes are not made. After you have done these steps, you can use the following to make changes:
- Open your favorite SoftwarePage/TerminalProgram?
- Connect(9600 baud)
- Type "Man" and send
- Type "mcd" and send to print config in the terminal window. Copy/Paste contents of the terminal window to text editor for changes.
- Save changes.
- Now repeat the above two steps for table changes except use "mct" in place of "mcd" to get the contents of the tables in the terminal window.
- Open command prompt and navigate to firmware directory and type "make mtt"(this adds config.mtt and tables.mtt to etc/
- Download config.mtt and/or tables.mtt through terminal window by navigating to the config.mtt file in your firmware.
=== global.h walkthrough=== This is a terrible place here. Info should be (scattered) on the relevant pages, because people want to find them by function (eg. when reading GenBoard/Manual/ThrottlePositionSensor? ). If someone wants to go through them according to global.h order, he should see in the firmware. Insert comments in the global.h if you think it is necessery. Please take action.
#define TRIGGER_REENABLE_MAX 25
#define TRIGGER_REENABLE_MIN 3
These function as a debounce circuit in software. As an example, let's take a 4 stroke 4 cylinder engine, which will never rev beyond 6000 RPM. At 2 sparks per revolution (4 cylinders remember), this gives 6000 / 60 * 2 = 200 sparks (TACH pulses) per second. Each spark is thus 5ms apart. What this means is that after receiving a TACH pulse, it is considered wrong to receive another pulse within reenable_time, which is generally 1/2 of the previous period (2.5ms in the above case). TRIGGER_REENABLE_MIN and ...MAX are lower and upper limits for reenable_time (see reenable.c). For higher rev engines, or higher cylinder-count, TRIGGER_REENABLE_MIN must be set lower (like 2, which means reenable after 1..2msec), or even better, use a clean trigger and set config.crank_ic3dis=FF (or alternatively eventqueue reenable).
Note: this is only used if config.crank_ic3dis == 0 (see timing.c)
#define O2_MAX_TPS 180 // WOT, disable closed loop
#define O2_MAX_KPA 110 // Turbo, disable closed loop
O2_MAX_TPS is a threshold value, it represents how far you are allowed to press down on the accelerator before deciding you are now reaching WOT where the engine will want to run richer than stoich. This is tuned most easily "live" since it depends on the resistance of the TPS sensor and it's relation to the throttle plates.
O2_MAX_KPA is a threshold value, it represents the Manifold Absolute Pressure above which the engine is running under boost. Ambient (atmospheric) pressure can be simplified as 100 KPa (1 bar), fluctuating a bit depending on the weather. The intake manifold pressure is always lower than this, unless the engine is severely loaded down (going uphill flooring it in 5th gear at 35km/h) or you are using a turbo which is providing boost. Either way, it's a bad time to run closed loop, so it is disabled under these conditions.
#define FLOOD_CLEAR 155
When an engine is flooded it means the sparkplugs have so much fuel on them the spark energy just conducts through this fuel without creating a spark and igniting the fuel. This is bad because cranking the engine only makes it worse (adding fuel). Since you never play with the accelerator to start a fuel injected car (like with carbs), the ECU decides that if you are flooring the accelerator while starting, you are trying to clear the engine of the flooded condition, and it will not inject any fuel.
Note: FLOOD_CLEAR is compared against engine.tps (see fuelcalc.c), not the TPS ADC reading directly, so it means throttle is 155/256 pressed between config.tps_low and config.tps_high ?
#define INJ_PER_REV 2
Here are some tidbits about the various pulsewidth modifiers that might give you something to work from. Feel free to order it and add config.variable names and units.
1) Priming pulse is a fixed-width, pre-start shot performed at MS boot.
Pulse is scaled to coolant temp, interpolated between eg. primep=30 means 48*100 usec pulse (hexadeciman 0x30==48). Priming pulse is normally downscaled for higher coolant temp, using linear interpolation: primep_temp_scaling=80 means scaled to 50% (== 0x80 / 0x100) at 170 F (80=half, ff=same as cold).
2) ASE is strictly time dependent and should turn on ever time you start the engine. The amount of fuel it adds is computed using the coolant temp, higher temps mean less enrichment, but the duration of the ASE is the same every time.
3) WUE duration and magnitude are both determined by coolant temperature. As long as coolant temp stays below the top bin temperature in the table, you have WUE enabled (although if you have set the bins to 100%, then you get no additional enrichments...).
4) The "normal" pulse width is scaled by absolute manifold air temperature, so if the MAT sensor is heat soaked (Per's problem described a while back), then you will be way lean when you start. Could this be the one that is causing your problems?
I was trying upload config.mtt with bray terminal and by mistake I've selected config.txt instead of config.mtt end send it to ms avr's eeprom and receved strange signs in terminal. Ather that I've uploaded config.mtt and everithing worked fine. Now I am wondering if config.txt that I have sent is going to make some trouble, do I need to erese my eeprom and upload config.mtt and tables again, and if I do how can I do that?
Verify if your flash is what you used to write in (vems.hex: bootloader prog.pl verifies it in a sec or or avrprog in a minute...). The problem is that if you happen to activate the bootloader (mcbffmcb) with the dummy strings you send to AVR, there is some chance you can hurt the flashcontent (atmel used very simple commands in the protocol...). The chance is very small, but still there. So verify. If you don't have the vems.hex, which you uploaded (you made another mistake there too, then!!) just upload a new.
Got tired of doing HEX-conversions and figured, that others felt the same.
Created a small Win32 app to do it for me (Yeah, I know i'm supposed to do a nifty Perl-hack, but thought that the not-so-nerdy-ones should have a go at it too...).
Get it here: http://18.104.22.168/install/InitialTables.zip
I improved bin/make_table.pl so anyone can use decimal numbers and even real-world units in the tables.txt file, after
numberformat=10 or numberformat=real
- You can switch numberformat after each line if you like
- Default (everything in the file before an explicite numberformat=.. statement) is numberformat=16 (which is for hexa) so old tables.txt files are not broken.
- numberformat=real multiplies by 4 n (ignition) table values, so the crankdegree unit is converted to ECM's internal 1/4 degree representation. numberformat=real gives undefined result (don't use) for j and l tables
- support other number-system (eg binary: numberformat=2)
- add same to config.pl
- allow 0x.. and %.... format even if default is decimal (to input hexa or binary numbers without changing back and forth)
TODO: this page should be splitted to sections:
- PortInjected (injection parameters)
- DummyIgnition or EdisIgnition, (IgnitionPage)
- WideBand, NarrowBand
Following some complete docs structure (Autronics?) would be a good idea. Mostof these are started, but unorganized. Finally all these texts will be integrated into jtune, the new experimental tuning software (so it must be splitted to individual parameters and flags)...
There is no "standard default" config.txt file. The shipped config and firmware is just for testing, it should not be used for production. The only value that makes sense is WBO2 1st channel pump_pw_zero that is recently calibrated according to the onboard components (for appr. 0 mA output pump-current) - but even that must be verified during the GenBoard/Manual/WBSensorControllerTesting.
The production config will depend on trigger tooth-count, trigger position, ignition advance and other factors. Maybe start from config of MembersPage/MichaelKristensen (which is one of the first config that gets updated to utilize new features). But don't use anything without verification.
The firmware itself will be standardized (feel free to make dist of the version recommended on GenBoard/UnderDevelopment/FirmwareChanges) (with the usual disclaimer, of course). This is possible, since board HW is largely standardized now. But we can't standardize engines - there is support for too many kinds. We explain different types (eg. of ignition) in different lines of GenBoard/Manual matrix (for easier readibility) even if this makes some redundancy.
- - Yes, the included config.txt should not be used to control Genboard while in a vehicle.
- GenBoard/Manual is the new matrix that we use for explaining config parameters. Please move config parameter info into the page referred from Config column (make up the link and even the page if needed, try to reuse existing pages)