After a few months of staring at letters and numbers (and a few fights with the girl over obsessing with the computer screen), and thanks to Merlins EVO tuning guide, I think I finally have a good grasp on how the ECU calculates KnockSum and uses the Octane value. There are many similarities between the code logic in our cars and the EVOs, but ours is a bit more primitive.

We start off with the KnockBase which is the the ground filter for tuning out frequencies. When a signal spike from the knock sensor exceeds this Base filter, it’s regarded as knock. This filter level is derived from the knock sensor RAW value (signals from the knock sensor itself) then is passed thru 2 amplifiers which are called the single and triple gain amplifiers. What these amplifiers do is they filter out background noise and amplify low level signals. The ECU has an analog to digital converter (ADC) which takes these signals and multiplies them by something called the Knock Multiplier value with the single/triple gain adders applied.

This multiplier is used to multiply the difference between the filtered knock and the long term average knock. The result is divided by the long term average knock.

Knock_Muliplier * (KnockBase – Average_LT_Knock)/Average_LT_Knock

Basically all this does is it gives the code the ability to learn the engine noises during various RPMs. The 3/S has 2 multipliers. One for low load and one for high load conditions. For some reason, they made both these multiplier values the same in the code… I labeled these as “Knock Sensitivity” in the ECUFlash XML.

The code uses RPM to switch between the single and triple gain adders. I labeled these as “Background Noise Switch Points” in the XML.

The KnockBase is updated by taking the old value * 7 then adds the latest knock free noise level and divides all that by 8. So it takes 8 ignition events to fully update the KnockBase.


*Ignition Retard*

The ECU has a safety feature coded where it will reduce timing advance when knock is detected. It does this by taking the current timing value and divided it by 90 then subtracts 231 from the result and stores this for later. Knocksum is then added to this value.

So, here’s the formula the ECU uses to reducing ignition timing:


In other words, every knock count takes about .32 degrees of timing away from advancement!

*Fuel Enrichment*

The ECU also has a safety feature coded where it will enrichen the fuel mixture when a knocksum > 6 is detected. It takes your current AFR value from your fuel table, divides it by 160. There also appears to be a table look up which I *think* is just a maximum enrichment based on coolant temp (all the values are the same and the AFR value translated from hex the values is 8.7). All this means is the farthest the ECU will enrichen your mixture is an AFR of 8.7.

Let me give an example:

Lets say in your High Octane fuel table, you have the value of 11.8 in the cell the ECU is currently looking up and you have a knock count of 12.

(12-6)*160/256 = 3 (rounded down)

The AFR values in the table comes from this equasion: 14.7*128/x
So in this case AFR of 11.8 in the table converts to 159.

Add 4 to that and we have 161.

Converting 161 back to AFR is 11.6. This this 11.6 is your new AFR number.

Keep in mind, a knock sum of 12 will bring down the octane number which will interpolate between your High & Low Octane Tables. These 2 functions are completely separate from the Octane function which simply interpolates between the High and Low octane tables.


Another area of our code which is a bit primitive to the EVO are the conditions which the ECU uses this value:

Coolant temp > 178 degF
Load > 70 (temperature and barometric compensated)
RPMs must be between 1812rpms and 7500rpms

Those of you who wish to run a higher redline might want to extend the high value! The max you can set it to is only 7900 though… This is the 1 byte limitation.

Just like the DSM and EVO, a knock count of < 3 adds to the Octane value and a knock count > 5 takes away from it. Give me some more time to figure out what the hex values mean and I can tell you how quickly and how much it adds or takes away from this value.

This page was posted on Wednesday, April 17th, 2013 at 12:16 am by bfarnam and last modified on Friday, April 19th, 2013 at 11:34 pm by bfarnam

Donate for Chrome and receive a coupon code for the amount of your donation (up to $50.00 US)! Dismiss