Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Disassembly: Knock and Octane code

  1. #1
    I lack color... verified

    Join Date
    Sep 2010
    Owner Since
    Aug 1998

    Posts
    3,589
    Thanks
    104
    Thanked 498 Times in 241 Posts

    Disassembly: Knock and Octane code

    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 Flashable ECUs calculate KnockSum and use 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...

    The code uses RPM to switch between the single and triple gain adders.

    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:

    knocksum*90/256

    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.



    *Octane*

    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.


    ...my brain hurts.

    2014 Exomotive Exocet - #101 "shocker yellow" - 1.8L 5-speed 3.9 torsen FMII powered
    Read more: http://mevowners.proboards.com/threa.../greg-pa-build

    99 Solano Black VR4 - #16 of 287 - ground up restoration - sold
    98 Pearl White VR4 #54 of 231 - 12.84@105mph - 93 Octane 12.50@107mph - 100 Octane with Chromed ECU - sold
    99 Pearl White VR4 #108 of 287 - 3RD place stock car class ECG 11 - Sold
    98 Black VR4: 100% stock - totalled by an Illegal 2-12-08
    95 White Stealth TT - 11.852 @ 118.25 - sold
    95 SSG Stealth TT - 11.981 @ 115.81mph - sold

    "I don't actually work on cars, I just talk about them on the internet."

  2. The Following 9 Users Say Thank You to Greg E For This Useful Post:


  3. #2
    Relax, it's just rocket science!
    Join Date
    Sep 2010
    Owner Since
    Nov 2001

    Location
    Ozark, AL
    Posts
    1,211
    Blog Entries
    2
    Thanks
    53
    Thanked 122 Times in 76 Posts
    Great info! Looks like a lot of progress is being made in the flashable ECU territory.

  4. The Following User Says Thank You to BigTyla For This Useful Post:


  5. #3
    Stuper Moderator
    Join Date
    Jul 2010
    Owner Since
    January 2003

    Posts
    1,108
    Thanks
    395
    Thanked 638 Times in 383 Posts
    Nice work, Greg. Really appreciate all your effort.

    Jeremy

    Quote Originally Posted by Echo419 View Post
    Douches

  6. The Following User Says Thank You to HilbillyHomeboy For This Useful Post:


  7. #4
    Forum User
    Join Date
    Sep 2010
    Owner Since
    2006

    Posts
    373
    Thanks
    1
    Thanked 23 Times in 20 Posts
    Next up, time travel using 98 ecu.

  8. #5
    Huh? verified
    Join Date
    Sep 2010
    Owner Since
    1901

    Location
    Detroit Area, MI
    Posts
    149
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Very cool. Thanks for all the effort!
    1993 3ooogt vr4
    Big single turbo and every other mod...
    Powered by BorgWarner

  9. #6
    Forum User verified
    Join Date
    Sep 2010
    Owner Since
    August 2010

    Location
    Chicago
    Posts
    1,494
    Thanks
    46
    Thanked 57 Times in 46 Posts
    good stuff man...

  10. #7
    Man vs 3/S verified
    Join Date
    Sep 2010
    Owner Since
    2003

    Location
    Kingston, WA
    Posts
    1,501
    Thanks
    124
    Thanked 171 Times in 112 Posts
    Excellent work, Greg.
    93 R/T - Modded, Full Suspension, Full Exhaust, Quaife Diff, Turbo brakes, Alpine/Boston Sound One of 25
    98 VR-4 - Billet 13t's, Downpipe, Blitz EBC, Ohlins R/T coil overs, SCE center differential, SCE oil pan, Pampena braced trans, TEC Rear Strut Bar, Custom Front Strut Bar, Camber Arms, Alum Driveshaft, 2" Koyo, Maximal oil cooler, SAFC2, Defi Gauges, RC 550's, Supra Pump, Skillard Splitter, Hardpipes, XYZ 14" front brakes/Carbotech, 255 Dunlop Z2's, AMR 18x9's, Alpine/Infinity/JL Sound. One of 13

    3SNG15 Best overall




    "I explode 1 piece rotors" -- ABM --
    Runs 12's (12.98's!!!!!!)
    My Garage

  11. #8
    LW fears my posts Not Verified
    Join Date
    Sep 2010
    Owner Since
    1996, 1st Stealth TT; 2000, current TT

    Location
    Dallas TX
    Posts
    704
    Thanks
    61
    Thanked 121 Times in 102 Posts
    These calculations are only for 98/99 ECU's, correct? Because I am pretty sure I've seen knocksum tables from the other site back in the day (that Mjannusch compiled maybe?) where a knock count up to 5-8 didn't affect timing. I also remember Jeff Lucius saying something similar, that small counts of knock were basically disregarded from the ECU.

    This was back before we knew anything about 98/99 ECUs so Mitsu may have changed more than was previously thought in 98-99 cars.

  12. #9
    I lack color... verified

    Join Date
    Sep 2010
    Owner Since
    Aug 1998

    Posts
    3,589
    Thanks
    104
    Thanked 498 Times in 241 Posts
    Quote Originally Posted by UTRacerX9 View Post
    These calculations are only for 98/99 ECU's, correct? Because I am pretty sure I've seen knocksum tables from the other site back in the day (that Mjannusch compiled maybe?) where a knock count up to 5-8 didn't affect timing. I also remember Jeff Lucius saying something similar, that small counts of knock were basically disregarded from the ECU.

    This was back before we knew anything about 98/99 ECUs so Mitsu may have changed more than was previously thought in 98-99 cars.
    I haven't seen the code so I couldnt tell you. Jeff has 90% of the 94 ROM disassembled so he's better qualified to answer that.

  13. #10
    I lack color... verified

    Join Date
    Sep 2010
    Owner Since
    Aug 1998

    Posts
    3,589
    Thanks
    104
    Thanked 498 Times in 241 Posts
    There's a lot of debate going on (still) about the differences between the knock sensor circuits between the various flashable ECUs. I can tell you if there are differences, it doesn't matter. Neither side of the debate disagrees that the sensor itself communicates with the ADC chip. The disagreement comes from the path the signal takes to get there and it somehow having an effect.

    From a software standpoint, Mitsubishi uses the same logic for calculating knock sum on every single vehicle equipped with a knock sensor from 91 till now (that I'm aware of). Though the filtering points may change between various motors, the process is always the same. It's not like the ECU has an ear to the motor listening for a specific sound... it hears everything and filters out what you tell it to.

    Tuning the knock sensor filters is no different than tuning your fuel injectors for the proper AFR. Every motor is different and you might find you will have to make some adjustments as you're logging your car.

    So let's say even if there is something different about the signal path for the knock raw voltage it doesn't matter. You can adjust the code filtering for any variants. Just like you'll have to adjust these tables to suit your VR4 motor with 150k or even your freshly built forged bottom end....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The 3000GT/Stealth/GTO Web History Project
3000gt.com
3000GT / Stealth International WWWboard Archive
Jim's (RED3KGT) Reststop
3000GT/Stealth/GTO Information and Resources
Team 3S
3000GT / Stealth / GTO Information
daveblack.net
3000GT/Stealth/GTO Clubs and Groups
Michigan 3S
MInnesota 3S
Wisconsin 3S
Iowa, Nebraska, Kansas 3S
North California 3000GT/Stealth
United Society of 3S Owners
3000GT/Stealth/GTO Forums
3000GT/Stealth International
3000GT/Stealth/GTO Event Pages
3S National Gathering
East Coast Gathering
Upper Mid-West Gathering
Blue Ridge Gathering