Nedenfor kommer en cut'n paste av noe RickyB på mr2oc kom opp med nylig. Regner med det kan være av interesse for flere her inne
Facts regarding the stock ECU's "high" and "low" octane modes
--------------------------------------------------------------------------------
I've been spending a good deal of time reverse engineering the firmware code in the stock ECU and discovered a few interesting facts about the mechanism used to switch between "high octane" and "low octane" mode. The octane mode determines how aggressive the timing and fuel maps used are and how the TVIS and TVSV outputs are handled.
The stock ECU breaks the RPM spectrum down into three knock detection ranges, these are 1200 through 2800, 2800 through 4800 and 4800 through 6400 with a 50 RPM band on either side of these to prevent the system from quickly jumping back and forth between these when the motor is held right at the boundary point. For example, you must rev above 2850 to get into the second range and let the RPMs fall below 2750 to go back into the first range.
For each of these three ranges, the stock ECU keeps track of how much knock sensor activity it detects when the amount of air flowing through the AFM is large enough for the motor to be near or above boost. Three persistant values (persistant meaning that the ECU does not forget these values until the battery is disconnected or the EFI fuse pulled) each keep track of the maximum amount of knock sensor activity detected for each of these ranges.
The ECU has a specific maximum and minimum threshold for each of these three RPM ranges. The minimum is used to allow the ECU to switch into "high octane" mode. When the ECU is reset by disconnecting the battery or pulling the EFI fuse, it is actually first put into "low octane" mode. It stays in this mode until near boost or boost flow is detected in at least two of the three RPM ranges. Once this condition has taken place, the ECU checks the knock activity values against its minimum thresholds and allows the ECU to enter "high octane" mode only if the knock sensor activity is below the minimum threshold values for all the RPM ranges sampled under boost. Once the ECU switches to "high octane" mode once, it can switch to "low octane" mode at any time, but never again switch back to "high octane" mode until ignition power is cycled.
When the ECU is in "high octane" mode, it constantly monitors the three RPM bands during near boost and boost and should the knock activity values exceed the maximum threshold values in any two RPM ranges, the ECU will switch back to "low octane" mode.
Slowly over time, if knock sensor activity is lower than the recorded persistant maximum value when a particular RPM range is near boost or above, the persistant maximum knock sensor activity value is decreased. If this behavior persists for some time, it may potentially decrease the persistant value under the minimum threshold to allow the ECU to switch back to "high octane" mode at some point in the future after the ignition power has cycled.
An interesting thing to note is the ECU is essentially "deaf" to knock above 6450 RPMs. This makes sense as detonation simply doesn't have enough time to happen at high RPMs.
Another interesting thing to note is that the three RPM bands with at least two having high or low activity required to switch the octane mode is most likely there to help tolerate an external source of false knock such as a loose heat shield or a clutch that resonates in the knock frequency at only a single RPM point.
The amount of code used to do all this is amazingly small and efficient for all that it does. It is interesting to realize that the Toyota MCU's main instruction clock is ticking away at only three megahertz and that the average instruction takes three to four clock cycles to execute. This means that the stock ECU must accomplish everything to keep the motor running with only a million instruction executions or so each second.

Facts regarding the stock ECU's "high" and "low" octane modes
--------------------------------------------------------------------------------
I've been spending a good deal of time reverse engineering the firmware code in the stock ECU and discovered a few interesting facts about the mechanism used to switch between "high octane" and "low octane" mode. The octane mode determines how aggressive the timing and fuel maps used are and how the TVIS and TVSV outputs are handled.
The stock ECU breaks the RPM spectrum down into three knock detection ranges, these are 1200 through 2800, 2800 through 4800 and 4800 through 6400 with a 50 RPM band on either side of these to prevent the system from quickly jumping back and forth between these when the motor is held right at the boundary point. For example, you must rev above 2850 to get into the second range and let the RPMs fall below 2750 to go back into the first range.
For each of these three ranges, the stock ECU keeps track of how much knock sensor activity it detects when the amount of air flowing through the AFM is large enough for the motor to be near or above boost. Three persistant values (persistant meaning that the ECU does not forget these values until the battery is disconnected or the EFI fuse pulled) each keep track of the maximum amount of knock sensor activity detected for each of these ranges.
The ECU has a specific maximum and minimum threshold for each of these three RPM ranges. The minimum is used to allow the ECU to switch into "high octane" mode. When the ECU is reset by disconnecting the battery or pulling the EFI fuse, it is actually first put into "low octane" mode. It stays in this mode until near boost or boost flow is detected in at least two of the three RPM ranges. Once this condition has taken place, the ECU checks the knock activity values against its minimum thresholds and allows the ECU to enter "high octane" mode only if the knock sensor activity is below the minimum threshold values for all the RPM ranges sampled under boost. Once the ECU switches to "high octane" mode once, it can switch to "low octane" mode at any time, but never again switch back to "high octane" mode until ignition power is cycled.
When the ECU is in "high octane" mode, it constantly monitors the three RPM bands during near boost and boost and should the knock activity values exceed the maximum threshold values in any two RPM ranges, the ECU will switch back to "low octane" mode.
Slowly over time, if knock sensor activity is lower than the recorded persistant maximum value when a particular RPM range is near boost or above, the persistant maximum knock sensor activity value is decreased. If this behavior persists for some time, it may potentially decrease the persistant value under the minimum threshold to allow the ECU to switch back to "high octane" mode at some point in the future after the ignition power has cycled.
An interesting thing to note is the ECU is essentially "deaf" to knock above 6450 RPMs. This makes sense as detonation simply doesn't have enough time to happen at high RPMs.
Another interesting thing to note is that the three RPM bands with at least two having high or low activity required to switch the octane mode is most likely there to help tolerate an external source of false knock such as a loose heat shield or a clutch that resonates in the knock frequency at only a single RPM point.
The amount of code used to do all this is amazingly small and efficient for all that it does. It is interesting to realize that the Toyota MCU's main instruction clock is ticking away at only three megahertz and that the average instruction takes three to four clock cycles to execute. This means that the stock ECU must accomplish everything to keep the motor running with only a million instruction executions or so each second.
-------------------------------------
'72 Celica (RA21/TA22) Solskinnscruiseren
'94 MR2 Turbo (SW20) Lillegul
'87 Corolla bane/leke prosjekt (AE86) Hachi'n
'83 Starlet (KP61) Sølvpilen
'90 Starlet arbeids/vinter go-cart (EP81)
'83 Starlet delebil/impulskjøp (KP61)
'73 Datsun 240Z
'72 Celica (RA21/TA22) Solskinnscruiseren
'94 MR2 Turbo (SW20) Lillegul
'87 Corolla bane/leke prosjekt (AE86) Hachi'n
'83 Starlet (KP61) Sølvpilen
'90 Starlet arbeids/vinter go-cart (EP81)
'83 Starlet delebil/impulskjøp (KP61)
'73 Datsun 240Z