MembersPage/GrmRacer/Notes (2005-03-22 02:09:55)

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:

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.


Readings

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.


How many settings are there?

See GenBoard/Manual/Tables

Config File

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
primep=40
Priming pulse scaling at 170 F (0x80=half, 0xFF=same as cold) 0xA0 = ~63%
primep_temp_scaling=A0
Cranking pulsewidth [x100 usec] at -40F eg. 0xE0 * 100uS = 22400uS
cwl=E0
Cranking pulsewidth [x100 usec] at 170F eg. 0x40 * 100uS = 6400uS
cwh=40

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
cranking_thres=03
Afterstart warmup enrichment (%added value) 0x50 = 80%
awev=20
Afterstart warmup scaling at 170 F (0x80=half, 0xFF=same as cold) 0xA0 = ~63%
awev_temp_scaling=A0
Afterstart number of engine cycles, NOTE: This is not ignition events anymore
awc=D2

Warmup temperature defines temperature steps for the following tables, these are pretty constant across most installations

warmup_clt_range[0]=00 eg. -40.0 C
warmup_clt_range[1]=14 eg. -28.8 C
warmup_clt_range[2]=28 eg. -17.7 C
warmup_clt_range[3]=3C eg. -6.6 C
warmup_clt_range[4]=50 eg. 4.4 C
warmup_clt_range[5]=64 eg. 15.5 C
warmup_clt_range[6]=78 eg. 26.6 C
warmup_clt_range[7]=8C eg. 37.7 C
warmup_clt_range[8]=AA eg. 54.4 C
warmup_clt_range[9]=C8 eg. 71.1 C

Warm up enrichment as function of temperature, biased at 100 (0x64)

warmup_clt[0]=8D enrichment @-40.0C
warmup_clt[1]=8D
warmup_clt[2]=8D
warmup_clt[3]=8A
warmup_clt[4]=87
warmup_clt[5]=7C
warmup_clt[6]=76
warmup_clt[7]=69
warmup_clt[8]=67
warmup_clt[9]=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)

warmup_rpm[0]=64
warmup_rpm[1]=64
warmup_rpm[2]=64
warmup_rpm[3]=64
warmup_rpm[4]=64
warmup_rpm[5]=64
warmup_rpm[6]=64
warmup_rpm[7]=64

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)''
My calculations resulted in a figure of 10.63, which is apparently units of 100usec so the figure gets changed to 106 (0x6A)
req_fuel=6A

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

divider=01
Explained in MegaManual. Switches on alternating (the 2 banks), as opposed to 00 which is simultanous
alternate=01

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)
rpmk[0]=0B
rpmk[1]=B8

Accel TPSDOT threshold (throttle sensitivity), this specifies the minimum rate of change to enable any acceleration enrichment

tps_thresh=04
Acceleration duration [0.1 sec] eg. 0x0A * 0.1 = 1 second
tpsasync=0A
Acceleration cold multiplication factor, biased at 0x64 eg. 0x64 - bias = 0
acmult=64
Cold acceleration added amount (at -40 F degrees) [x100 usec]. eg. 0x14 * 100uS = 2000uS
tpsacold=14

Rate of change bins for use with tps_thresh. If 14 =< actual delta(throttle position) < 28 then tpsdotrate[1] is the active bin.

tpsdotrate[0]=05
tpsdotrate[1]=14
tpsdotrate[2]=28
tpsdotrate[3]=4D

TPS acceleration amount (fn TPSDOT) [100 usec]. This is the acceleration enrichment pulsewidth, the active bin is determined by tpsdotrate[].

tpsaq[0]=14
tpsaq[1]=28
tpsaq[2]=50
tpsaq[3]=6E

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%:

tpsdq=64
Decel fuelcut enabled above threshold [x100 rpm] eg. 0x0F * 100 = 1500rmp
decel_fuelcut_thres=0F

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

overrun_fuelcut=11
Overrun fuelresume, injectors reenabled below this [x100 rpm] eg. 16 (0x10) x 100 = 1600rpm. Must be lower than overrun_fuelcut.
overrun_fuelresume=10

Rev limit (hard) [x100 rpm] eg. 0x46 * 100rpm = 7000rpm

rev_limit=46

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.

airden_ignore=62

Not very descriptive config11..13 names inherited from motorola ms (and kept for MegaTune and MegaManual compatibility)

upper half: number of cyls-1, bit0 0:mpx4115ap, 1:mpx4250ap

config11=39
config12 currently not used, see above for details. AFAIK it was never used in mot ms either.
config12=30
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.

mt_unused=2a

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

batt_cal=BB

Fast idle temperature, open solenoid valve under (fastidle - 40 Fahrenheit): if you want 88F, set 88+40 = 128 = 0x80

fastidle=80

mean barometric pressure

baro=64
max difference in barometric pressure
dbaro=0C

tps, min adc-count

tps_low=00
max adc-count
tps_high=FF

Radiator Fan Configuration

Temperature when fan will turn on, in degrees F, -40F offset, if you want 185F(85degC), set 185+40 = 225 = 0xE1

fan_temp=E1
fan_temp - fan_hyst=temp when fan will turn off, 0xE1 - 0x09 = 0xD8=216 -> 176degF(80C)
fan_hyst=09

IAC Configuration See GenBoard/Manual/Config/IdleControl


EGO Configuration See NarrowBand


LCD Setup

lcd_c0=FF
bit0=0 (lcd_c0=FE) will turn on busy-polling of the LCD: that way more things can go wrong (because communication is bidirectional), but it should work both ways.
lcd_delay=FF
lcd_backlight=FF
lcd_offs[0]=FF
lcd_offs[1]=FF
lcd_offs[2]=FF
lcd_offs[3]=FF
lcd_default_view=00

Ignition Settings

unused bits are ignored, but set them high by tradition - eg 11111xxx

bit2 0:no filtering/1:filtering, bit1 0:toothwheel/1:coil, bit0 0:falling/1:rising

0xFE coil type trigger, falling edge (EDIS)

primary_trigger=FE
bit2 0:no filtering/1:filtering, bit1 0:enable/1:disable, bit0 0:falling/1:rising
secondary_trigger=FF
number of teeth on the wheel eg. 0x24 = 36 teeth; not used in case of coil-type trigger

TODO: explain direct ignition settings, igncount=.. and h[2]=.. and give examples - DummyIgnition page looks good for it

tooth_wheel=24
chose which tooth is the trigger tooth. A value of 00 means the missing tooth will act as the trigger
trigger_tooth=00
Cranktigger period minimum (*16 usec) eg. 0x80 * 16 = 2048uS
crank_minper=80
TDC after the trigger(0.5crankdeg) eg. 0xFF * 0.5 = 127.5deg
ign_tdcdelay=FF
dwell length above 14V (64usec) 0x26 * 64 = 2432uS. Only used for dummyignition, since in case of EDIS, the pulselength is the function of the ignition advance
ign_dwell14=26
added dwell time at 6V (27usec) eg. 0x5A * 27 = 2430uS. This is the slope of the dwell increase, as VBatt decreases. Typical dwell6 time would be: dwell6 = dwell14 * 2
ign_dwell6=5A
ignition advance at cranking [0.25crankdeg] 0x0F x 0.25 = 3.75deg
ign_crank_advance=0F
ignition type: dummy:70/EDIS:00/none:FF add +01 for inverted output (assuming GenBoard v2: inverted means that PORTB7 rising edge is spark, which is falling edge after MISC NPN.
ign_out=70
Fuel Pump Controll

turn off fuelpump after inactivity time [262msec] 0x08 * 262 = 2096mS

engine_off_delay=08

minimum time to leave fuelpump on at startup [262msec] 0x0F * 262 = 3930

pump_on_mintime=0F


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

[etc/config.txt]
[etc/tables.txt]

Once you get the above files you need to do a couple of things (which are also described in GenBoard/MenuSystem as noted above):

  1. Copy the files to the etc/ directory of your firmware directory.
  2. Open the config.txt and tables.txt and make needed changes to fit your setup.
  3. Save the changes
  4. Open command prompt, navigate to firmware directory and type "make mtt"(this adds config.mtt and tables.mtt to etc/ )
  5. 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:

  1. Open your favorite SoftwarePage/TerminalProgram
  2. Connect(9600 baud)
  3. Type "Man" and send
  4. Type "mcd" and send to print config in the terminal window. Copy/Paste contents of the terminal window to text editor for changes.
  5. Save changes.
  6. 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.
  7. Open command prompt and navigate to firmware directory and type "make mtt"(this adds config.mtt and tables.mtt to etc/
  8. 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?

Eric


Question:

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?

Answer:

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://80.196.115.45/install/InitialTables.zip

/Nolan

I improved bin/make_table.pl so anyone can use decimal numbers and even real-world units in the tables.txt file, after\n

numberformat=10
or 
numberformat=real

TODO:


TODO: this page should be splitted to sections:

PortInjected (injection parameters)
DummyIgnition or EdisIgnition, (IgnitionPage)
IdleControl
WideBand, NarrowBand
GenBoard/LcdFaQ
GenBoard/KeyBoard

Misc...

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)...


Standard default

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.


See also