LH2.3 MAF input
#1
Inventor
Rennlist Member
Rennlist Member
Thread Starter
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
LH2.3 converts the voltage from the MAF into two different digital inputs to be read by the (8051) processor.
Unfortunately, neither are very good for tuning.
The first A/D conversion is to a 8-bit (0-255) number.
It reads up to ~5 volts, or a reading of around 300 maf units (the calculated value for scaling).
It is used for cranking, idle, acceleration pump(?).
The second conversion is to a frequency which is read by the processor as a 16-bit (0-65535) number.
It can read up to the full ~6.5 volts from the MAF (648? maf units).
This number is used for most data work in the code. It is processed into the load frequency sent to the EZ.
It is very sensitive to voltage changes (or is just moody) with seemingly random peaks and valleys throughout.
Over 5400 rpm it is especially bad, making peak HP difficult to make consistent.
Note the 928 MAF is an oddball, with a voltage range of roughly 2~6.5 volts, instead of the more common 0-5V.
Lean spikes will often be accompanied by a knock. And it may not only be because the injector time is going up or down.
At cruise or if you are not using the EZ WOT map, IE. cruise only, then the ignition timing is going up/down, too.
The factory base fueling table goes up to 324 maf units.
Max S4 WOT reading at rpm limit is over 400 maf units.
300 happens before 3000 rpm at WOT, well before the first torque peak!
The last pic shows examples of factory code vs. additional (new) coding to smooth the MAF frequency by setting a maximum rate of change plus or minus.
This post is based on my reverse engineering of the code and logging runs.
I will update it as more information is available.
MAF volts (max ~5 volts, ~300 maf units)
![](http://members.rennlist.org/porken/MAF_volts.jpg)
MAF frequency from a typical WOT logging run (compare to the green line in the logs below)
![](http://members.rennlist.org/porken/MAF_freq.jpg)
Base fueling table combined with the MAF ideal table ('88 S4 with cat)
![](http://members.rennlist.org/porken/88S4_LH_Base.jpg)
AFR, MAF volts, Inj duty, RPM (3rd gear WOT 1500~6500)
Unfortunately, neither are very good for tuning.
The first A/D conversion is to a 8-bit (0-255) number.
It reads up to ~5 volts, or a reading of around 300 maf units (the calculated value for scaling).
It is used for cranking, idle, acceleration pump(?).
The second conversion is to a frequency which is read by the processor as a 16-bit (0-65535) number.
It can read up to the full ~6.5 volts from the MAF (648? maf units).
This number is used for most data work in the code. It is processed into the load frequency sent to the EZ.
It is very sensitive to voltage changes (or is just moody) with seemingly random peaks and valleys throughout.
Over 5400 rpm it is especially bad, making peak HP difficult to make consistent.
Note the 928 MAF is an oddball, with a voltage range of roughly 2~6.5 volts, instead of the more common 0-5V.
Lean spikes will often be accompanied by a knock. And it may not only be because the injector time is going up or down.
At cruise or if you are not using the EZ WOT map, IE. cruise only, then the ignition timing is going up/down, too.
The factory base fueling table goes up to 324 maf units.
Max S4 WOT reading at rpm limit is over 400 maf units.
300 happens before 3000 rpm at WOT, well before the first torque peak!
The last pic shows examples of factory code vs. additional (new) coding to smooth the MAF frequency by setting a maximum rate of change plus or minus.
This post is based on my reverse engineering of the code and logging runs.
I will update it as more information is available.
MAF volts (max ~5 volts, ~300 maf units)
![](http://members.rennlist.org/porken/MAF_volts.jpg)
MAF frequency from a typical WOT logging run (compare to the green line in the logs below)
![](http://members.rennlist.org/porken/MAF_freq.jpg)
Base fueling table combined with the MAF ideal table ('88 S4 with cat)
![](http://members.rennlist.org/porken/88S4_LH_Base.jpg)
AFR, MAF volts, Inj duty, RPM (3rd gear WOT 1500~6500)
![](http://members.rennlist.org/porken/88_24AFR_15.jpg)
Last edited by PorKen; 01-29-2014 at 02:29 PM.
#2
Inventor
Rennlist Member
Rennlist Member
Thread Starter
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
There is code to average/smooth the MAF signal, which helps cut down on the spikes, but it is not always used.
If the 8-bit MAF number is not changing much, there is no smoothing.
So at full throttle, over ~5 volts/3000 rpm, the 16-bit number is used directly, spikes and all.
Below is the code that sets the 16-bit MAF frequency number (from the timer which reads the A/D frequency).
It takes the new value, adds it to the old, then divides by two (right shift).
For folks using the 'SharkTuner', you can force smoothing all the time by making a one byte change in the code.
This will reduce the spikes/errors for both injector time and ignition at cruise and WOT somewhat.
With a hex editor, change the value at 056F and 456F from D2 to C2.
This changes the SET to a CLR for the flag which controls the smoothing.
(Two places to change as there are two banks of the same code, repeated.)
Example of free hex editor - (HXD hex editor)
File, Open the BIN file to modify.
Press Ctrl-G, type 56F, OK, type C.
Repeat for 456F, Save.
![](http://members.rennlist.org/porken/maf_avg_code.jpg)
Or, go the full monty with this patch, which could produce graphs like the last one above.![Big Grin](https://rennlist.com/forums/images/smilies/biggrin.gif)
Careful, you may be surprised how off your WOT tune is in places w/o all that noise! (Mine was.)
(Patch includes cruise averaging, so no need to do the above tweak.)
XDF - right click, save as, rename .txt to .xdf
MAF rate patch - TP5_LH23_PK_MAF.txt
TunerPro 5.0
download page
Make a backup of your BIN!
Open XDF, Open BIN, double click on 'MAF patch', click 'Apply Patch', click 'Apply' to close window, Save.
Change both (+) and/or (-) values to adjust the rate. Save.
If the 8-bit MAF number is not changing much, there is no smoothing.
So at full throttle, over ~5 volts/3000 rpm, the 16-bit number is used directly, spikes and all.
Below is the code that sets the 16-bit MAF frequency number (from the timer which reads the A/D frequency).
It takes the new value, adds it to the old, then divides by two (right shift).
For folks using the 'SharkTuner', you can force smoothing all the time by making a one byte change in the code.
This will reduce the spikes/errors for both injector time and ignition at cruise and WOT somewhat.
With a hex editor, change the value at 056F and 456F from D2 to C2.
This changes the SET to a CLR for the flag which controls the smoothing.
(Two places to change as there are two banks of the same code, repeated.)
Example of free hex editor - (HXD hex editor)
File, Open the BIN file to modify.
Press Ctrl-G, type 56F, OK, type C.
Repeat for 456F, Save.
![](http://members.rennlist.org/porken/maf_avg_code.jpg)
Or, go the full monty with this patch, which could produce graphs like the last one above.
![Big Grin](https://rennlist.com/forums/images/smilies/biggrin.gif)
Careful, you may be surprised how off your WOT tune is in places w/o all that noise! (Mine was.)
(Patch includes cruise averaging, so no need to do the above tweak.)
XDF - right click, save as, rename .txt to .xdf
MAF rate patch - TP5_LH23_PK_MAF.txt
TunerPro 5.0
download page
Make a backup of your BIN!
Open XDF, Open BIN, double click on 'MAF patch', click 'Apply Patch', click 'Apply' to close window, Save.
Change both (+) and/or (-) values to adjust the rate. Save.
![](http://members.rennlist.org/porken/maf_rate_code.jpg)
Last edited by PorKen; 01-29-2014 at 01:16 AM.
#3
Supercharged
Rennlist Member
Rennlist Member
Join Date: May 2002
Location: Back in Michigan - Full time!
Posts: 18,925
Likes: 0
Received 61 Likes
on
35 Posts
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
For folks using the 'SharkTuner', you can force smoothing all the time by making a one byte change in the code.
This will reduce the spikes/errors for both injector time and ignition at cruise and WOT somewhat.
With a hex editor, change the value at 056F and 456F from D2 to C2.
This changes the SET to a CLR for the flag which controls the smoothing.
(Two places to change as there are two banks of the same code, repeated.)
Example of free hex editor - (HXD hex editor)
File, Open the BIN file to modify.
Press Ctrl-G, type 56F, OK, type C.
Repeat for 456F, Save.
![](http://members.rennlist.org/porken/maf_avg_code.jpg)
This will reduce the spikes/errors for both injector time and ignition at cruise and WOT somewhat.
With a hex editor, change the value at 056F and 456F from D2 to C2.
This changes the SET to a CLR for the flag which controls the smoothing.
(Two places to change as there are two banks of the same code, repeated.)
Example of free hex editor - (HXD hex editor)
File, Open the BIN file to modify.
Press Ctrl-G, type 56F, OK, type C.
Repeat for 456F, Save.
![](http://members.rennlist.org/porken/maf_avg_code.jpg)
I don't know how you figured this stuff out, but it's pretty friggen cool you did. I attempted to decode the LH2.3 but don't have the chops to do it.
Cheers to you and all your crazy and not so crazy endeavors!
Man I love this crowd... even the ones that make me shake my head from time to time! (You know who you are... Hacker)
![cherrsagai](https://rennlist.com/forums/graemlins/drink.gif)
#4
Rennlist Member
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
Ken,
Brilliant stuff.
Not so sure I understand what you have written but is the implication that some of the knocks we see are a result of poor control or interpretation of data inputs rather than an acual knock event per se?
Rgds
Fred
Brilliant stuff.
Not so sure I understand what you have written but is the implication that some of the knocks we see are a result of poor control or interpretation of data inputs rather than an acual knock event per se?
Rgds
Fred
Last edited by FredR; 01-09-2014 at 12:42 AM.
#5
Inventor
Rennlist Member
Rennlist Member
Thread Starter
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
Knocks caused by random MAF conversion values causing lean spikes.
Also, a low MAF reading could translate to reduced load, which could raise the ignition advance suddenly at the same time.
Also, constant (sometimes huge) rich spikes above 5400 make it look like there's too much fuel in your WOT map there, so you end up taking out fuel.
Next run, no spike, too lean, knock, so you back off timing, HP drops.
You can see this in the after log, where it is a bit more lean above 5800.
With smoothing, the injector duty graph almost matches the WOT fuel map exactly.
There's still a little randomness in there, but it mostly makes for rich spikes, which are OK.
(In my smoothing code, I made the allowed rate for increasing MAF values larger than decreasing.)
Note, because of the way it is calculated, at WOT the load value the EZ sees is pretty much a straight line at full load at any RPM.
In looking for a different variable to send to the EZ at WOT, in place of the max'ed out load value, I came across the code above.
Now that I have figured out to how to mostly straightened out the MAF value, I may be able to make a load sensitive WOT map.
Also, a low MAF reading could translate to reduced load, which could raise the ignition advance suddenly at the same time.
Also, constant (sometimes huge) rich spikes above 5400 make it look like there's too much fuel in your WOT map there, so you end up taking out fuel.
Next run, no spike, too lean, knock, so you back off timing, HP drops.
You can see this in the after log, where it is a bit more lean above 5800.
With smoothing, the injector duty graph almost matches the WOT fuel map exactly.
There's still a little randomness in there, but it mostly makes for rich spikes, which are OK.
(In my smoothing code, I made the allowed rate for increasing MAF values larger than decreasing.)
Note, because of the way it is calculated, at WOT the load value the EZ sees is pretty much a straight line at full load at any RPM.
In looking for a different variable to send to the EZ at WOT, in place of the max'ed out load value, I came across the code above.
Now that I have figured out to how to mostly straightened out the MAF value, I may be able to make a load sensitive WOT map.
#6
Rennlist Member
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
Ken,
Fascinating. You may remember the dialogue we had wherein I was puzzled by the way the motor seemed to very inconsistently knock at around the 5300 rpm range. You may also note that I do not run on the WOT map because I had a problem with the icky WOT throttle switch- so by the sound of it perhaps that is not such a good idea after all given your observations that are sinking in now that I have had a cup of tea.
Something else I have also noticed recently that may or may not be connected is that the wiring loom insulation at the MAF connector was crumbling away leaving bare wires. I cut into the loom about 3 inches further back and did a "temporary" r/r job. Since then the motor has been running better [or so it feels] and interestingly, another problem I had- the tacho signal on the clock breaking down at around 5300 rpm also seems to have mysteriously "dissappeared". No idea why this has happened but all this makes me wonder if there is some commonality.
I could probably do to re-wire the entire engine bay and am continuously fire fighting having r/r'd injector plugs, MAF, the 14 point connector and hopefully will be fitting a new front harness soon.
Rgds
Fred
Fascinating. You may remember the dialogue we had wherein I was puzzled by the way the motor seemed to very inconsistently knock at around the 5300 rpm range. You may also note that I do not run on the WOT map because I had a problem with the icky WOT throttle switch- so by the sound of it perhaps that is not such a good idea after all given your observations that are sinking in now that I have had a cup of tea.
Something else I have also noticed recently that may or may not be connected is that the wiring loom insulation at the MAF connector was crumbling away leaving bare wires. I cut into the loom about 3 inches further back and did a "temporary" r/r job. Since then the motor has been running better [or so it feels] and interestingly, another problem I had- the tacho signal on the clock breaking down at around 5300 rpm also seems to have mysteriously "dissappeared". No idea why this has happened but all this makes me wonder if there is some commonality.
I could probably do to re-wire the entire engine bay and am continuously fire fighting having r/r'd injector plugs, MAF, the 14 point connector and hopefully will be fitting a new front harness soon.
Rgds
Fred
#7
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
Ken, is this the sort of amendment that could be made by you to otherwise stock EZK / LH PEMs / chips, is it the sort of change that would come with no downside, and is it the sort of change that you would recommend be made for a daily driver S4?
Thanks in advance
Dave
Thanks in advance
Dave
Trending Topics
#11
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
Many thanks Ken, that should be doable.. You forgot to mention about taking backup copy of LH bin-file before modifying![Smilie](https://rennlist.com/forums/images/smilies/smile.gif)
Is the MAF signal unstable before and after the A/D conversion? Just thinking about turbulence before MAF, it will happen in some specific cfm flow numbers as velocity will increase when flow is increasing.
Definitely something which needs to be tested,,,, in next summer.
![Smilie](https://rennlist.com/forums/images/smilies/smile.gif)
Is the MAF signal unstable before and after the A/D conversion? Just thinking about turbulence before MAF, it will happen in some specific cfm flow numbers as velocity will increase when flow is increasing.
Definitely something which needs to be tested,,,, in next summer.
#12
Inventor
Rennlist Member
Rennlist Member
Thread Starter
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
An unstable MAF voltage appears to be amplified by the frequency conversion.
Here is a graph made in the spring with the airbox lid off (for more power
).
Notice the green MAF voltage graph is bumpier than the lines above, with terrible injector duty and AFR spikes as a result.
I would imagine that a supercharged graph could look even worse?
AFR, MAF volts, Inj duty, RPM (3rd gear WOT 1500~6500)
Here is a graph made in the spring with the airbox lid off (for more power
![Embarrassment](https://rennlist.com/forums/images/smilies/redface.gif)
Notice the green MAF voltage graph is bumpier than the lines above, with terrible injector duty and AFR spikes as a result.
I would imagine that a supercharged graph could look even worse?
AFR, MAF volts, Inj duty, RPM (3rd gear WOT 1500~6500)
![](http://members.rennlist.org/porken/88_24AFR_15a.jpg)
#13
Inventor
Rennlist Member
Rennlist Member
Thread Starter
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
BTW, big props to Chris F. and his web page on the LH, because 'I don't know tech stuff'.
(928s4.com)
I could not have figured out the workings of the code without his circuit diagram of the LH board.
There are a couple of things which were incorrect which threw me for a loop, threw me for a loop (corrections annotated).
(928_lh5_new.pdf)
(928s4.com)
I could not have figured out the workings of the code without his circuit diagram of the LH board.
There are a couple of things which were incorrect which threw me for a loop, threw me for a loop (corrections annotated).
(928_lh5_new.pdf)
#15
Rennlist Member
![Default](https://rennlist.com/forums/images/icons/icon1.gif)
Well, it is easy enough to modify the bin file as you described with the software you linked.
Maybe I will try out this approach tomorrow. Presumably this implies one has to check/re-tune the AFR and then attempt to dial in more advance at full load conditions.
Rgds
Fred
Maybe I will try out this approach tomorrow. Presumably this implies one has to check/re-tune the AFR and then attempt to dial in more advance at full load conditions.
Rgds
Fred