This post will attempt to explain, in detail, how the knock control strategy works for the 16-bit ECUs. The example values given are based on a USDM 02 WRX and the use of Enginuity/Ecuflash with the latest definitions.
Ignition Timing is determined by the ECU as follows: Cobb Accesstuner Tuning Guide
- Total Timing = Base Timing + Knock Correction Advance + Other timing compensations
- Other timing compensations = other compensations including those for IAT, ECT, per cylinder, among others.
- Knock Correction Advance = (Timing Advance Maximum * (IAM/16)) + feedback knock correction + fine learning knock correction
Note: The IAM (ignition advance multiplier) used in the formula above is the raw value (ranging from 0-16) for the 16-bit ECU. For the 32-bit ECU, the IAM will range from 0 to 1 (substitute "IAM" for "IAM/16").
From the formula above, you can see that Knock Correction Advance (KC) consists of three elements. How these values are determined and how they interact with one another will be discussed below.
Although exactly how the ECU determines knock (based on input from the knock sensor) is not fully understood, the result is quite simple. The knock signal is either set or clear. That it, as far as the ECU is concerned, there either is knock or there isn't. There's no level of severity that is stored or used for knock control.
Feedback Knock Correction (FBKC)
Feedback knock correction (FBKC), as applied, is always either zero or negative. It is active when engine speed and load are within the ranges specified by the 'Feedback Correction Range' tables (although it can be disabled temporarily as described below). If enabled, the ECU looks at the knock signal. If set (i.e. knock), the FBKC value is decreased by about 2 degrees("Feedback Correction Retard Value"). Each time this portion of the code is executed, 2 additional degrees will be pulled if the knock signal is still set, up to a limit of about -11 degrees("Feedback Correction Retard Limit"). However, if FBKC is negative and the knock signal then becomes clear (i.e. no knock), FBKC does not immediately reset to zero. Instead, there is a delay("Feedback Correction Negative Advance Delay") in which the current correction remains until the knock signal is clear over the delay period. If so, feedback correction is increased by ~1 degree("Feedback Correction Negative Advance Value") and the feedback delay counter is reset. If not, and the knock signal is set over the delay period, the counter is reset and 2 degrees will be pulled. This process continues and FBKC will eventually reach zero as long as the delay period is satisfied enough times to increment the correction back to zero. Of course, "delay" is in the terms of the ecu, so this all happens very rapidly.
As noted above, FBKC can be disabled even when load and RPM are within the ranges specified by the "Feedback Correction Range" tables. In fact, this is necessary as the two other elements of knock control (changes to the IAM and changes to fine learning knock correction, described below) cannot be active unless FBKC is disabled. ALL of the following conditions must be met in order for FBKC to be disabled. If any of the following are not met, FBKC is enabled within its load/rpm ranges:
- Coolant temp is greater than 140F
- A/C is off or A/C was not just turned on (an extremely brief window of time after the A/C is switched on)
- If in rough correction mode (described below), load and RPM are within the "Rough Correction Ranges".
- If in fine correction mode (described below), load and RPM are within the "Fine Correction Ranges"
- Immediate change in load is less than about +/- .05 g/rev.
- ECU is not in test mode
- ECU is not in limp-home mode due to the triggering of specific groups of CELs.
- An unknown timing compensation based on throttle change is not active (i.e. no compensaton).
Rough correction involves manipulating the IAM (ignition advance multiplier) due to knock. This has the result of correcting timing advance across the board (timing advance maximum * IAM/16). The IAM can range between 0-16 for the 16-bit ECU. Subaru's Knock Correction Made Simple
The ECU has two modes of operation - rough correction or fine correction. That is, the ECU is either poised to possibly make corrections to the IAM (rough correction) or to possibly make changes to the fine learning knock correction table (described later), but not both at the same time. But, just because the ECU is in either of these modes, does not mean changes to the IAM or the fine learning knock correction (FLKC) table will be made. Therefore, there are two sets of thresholds for each mode. One set determines when to switch between modes (different depending on the current mode) and another set to determine whether changes to the IAM or FLKC table will be made in their respective modes. NOTE: After an ECU reset, the ECU defaults to the rough correction mode.
To exit from fine correction mode to rough correction mode, ALL of the following requirements must be met:
- Engine speed and load must be within the ranges specified by the 'Rough Correction Range' tables.
- Timing advance (maximum) map value is greater than 4.9 degrees.
- Some FLKC value change (positive or negative) occured last execution.
- The last FLKC applied value (|x|) is greater than 3.9 degrees (that is, the absolute correction -> ex. -4 = 4)
- The last FLKC raw difference (|y| * 2.84) is greater than last timing advance (maximum) map value.
- (IAM > 1) or (IAM <= 1 and last applied FLKC was positive).
Once in rough correction mode, the following requirements must be met each time in order to make any change to the IAM. That is, even though the ECU is in rough correction mode, it will not always be adjusting the IAM:
- Current timing advance (maximum) map value > 3.9 degrees ("Rough Correction Minimum Timing Advance Map Value").
- Limp-home mode not active (IAM would already be 0 in this case)
- FBKC is disabled.
- IAM step value > 1 (explained below)
If these are met, the following will occur, however, only after switching between the fine correction mode to the rough correction mode. That is, these will only be executed once each time the switch to the rough correction mode from fine correction mode occurs and right before a change to the IAM is going to occur:
- IAM is set to the 'Advance Multiplier (Initial)' value
- IAM step value is set to 4 ("Advance Multiplier Step Value", described below)
- IAM learning delay counter set to 0 (explained below)
- The entire FLKC table in ram is cleared.
The knock signal is checked. If clear (i.e. no knock):
- The IAM learning delay counter is checked. If the current value is less than the delay target specified by the 'Rough Correction Learning Delay (Increasing)' table then the counter is incremented (similar to the delay for FBKC). When the current value is greater than the delay target, then the IAM is increased. On the first run through, IAM is always advanced by 4 ("Advance Multiplier Step Value"). It remains 4 as long as it is keeps increasing the IAM (up to 16). However, if during the last execution the IAM was decreased, the IAM step value is reduced by 1/2. This occurs each time the IAM flip-flops. When the IAM step value is less than or equal to 1, the rough correction mode ends (after applying one last change to the IAM) and the ECU switches to fine correction mode. Basically, this is the way the ECU determines that the IAM has settled.
If the knock signal is set (i.e. knock):
- There is no delay for decreasing the IAM. However the counter value is cleared because knock was detected.
- Other than no delay, the rest of the logic is basically the same as when the IAM is increasing except that the IAM is decreased.
In addition, when the IAM is 0 or 16, after a slight delay of remaining at these extremes, the ECU will switch to fine correction mode regardless of the current IAM step value. This would be necessary if there was not enough "settling" before reaching these extremes to exit the rough correction mode.
Note, that when the IAM has finally "settled", the ECU will switch from rough correction mode to fine correction mode. Fine correction mode will continue until the mode switch conditions listed at the beginning of this section are met again.
Fine Learning Knock Correction
Fine learning knock correction (FLKC) allows for positive or negative correction to KC based on knock. These values are stored in RAM and are stored and applied across specific load and RPM ranges. The ECU determines these ranges based on the 'Fine Correction Rows (RPM)' and 'Fine Correction Columns (Load)' tables. Although these tables consist of 7 values each, the ranges make up an 8x8 3d table. For example:
If your 'Fine Correction Rows (RPM)' table was:
1400,1800,2600,3400,4200,5000,6000 - the ranges would be as follows:
- Range 1: less than 1400
- Range 2: 1400 to less than 1800
- Range 3: 1800 to less than 2600
- Range 4: 2600 to less than 3400
- Range 5: 3400 to less than 4200
- Range 6: 4200 to less than 5000
- Range 7: 5000 to less than 6000
- Range 8: 6000 +
Fine correction is designed to make "finer" adjustments to timing after the IAM has roughly corrected timing advance where there is no knock. Fine corrections are stored in RAM and are applied to KC all the time (except for certain conditions like idle). Although the FLKC table values in RAM are always being applied to KC, adjustments to the table itself can only occur when certain conditions are met:
- Currently in fine correction mode. The switch from rough correction mode to fine correction mode occurs when the IAM step value <= 1 or IAM is 0 or 16 after a slight delay.
- FBKC is disabled.
- Engine speed and load are within the ranges specified by the 'Fine Correction Range' tables.
- Limp-home mode is not active.
Then, if the knock signal is clear, other conditions must be met to add positive correction to the current fine correction cell in ram:
- (FBKC and/or negative FLKC was NOT applied during the last execution)
- if #1 is true, then the previous FLKC load/RPM range also has to be the same as the last range before this execution.
- The current FLKC table load/rpm range is the same as the last range.
- Like the other corrections, there is a delay before which an FLKC table value can be increased ('Fine Correction Advance Delay'). This is based on a counter (similar to the FBKC counter), which is incremented when there is no knock and is cleared when FLKC table adjustments are made or the knock signal is set.
If the above are met, then the FLKC value for the current load/RPM cell is increased. However, it cannot be increased if current timing advance + FLKC is greater than the current value in the "Timing Advance (Maximum)" table. This also means that if the IAM is 16, only negative FLKC is allowed. Each increment of FLKC is .35 degrees ('Fine Correction Advance Value'). Maximum allowable correction is 8 degrees("Fine Correction Advance Limit").
If the knock signal is set:
- Fine correction in the current FLKC cell is decreased by about 1 degree ("Fine Correction Retard Value") with a limit of about 12 degrees("Fine Correction Retard Limit").
NOTE: After switching from fine correction mode to rough correction mode and right before the first change to the IAM after switching to that mode, the entire FLKC table is cleared and no corrections to the table are made until the ECU switches to the fine correction mode (although the current FLKC table is applied regardless except at idle and certain sensor failures).
Do the 32-bit ECUs use the same logic?
The 32-bit ECUs generally follow the outline as described above. Some of thresholds may be different and some conditions may not apply or there may be additional conditions not listed. There are also other elements to knock control with the 32-bit ECU which have not been fully analyzed. But the description for the 16-bit ECU is sufficient to tune for the 32-bit ECU.
Whenever the IAM is re-evaluated, you said that the IAM is set to the value in the 'Advance Multiplier (Initial)' table, even without an ECU reset. I've never seen this in my logs. Can you explain why?
When the IAM re-evaluation starts, IAM is always set to this initial value, however this would be almost impossible to catch on a log because the next chunk of code is involved in decreasing/increasing the IAM (with an intial IAM step value of 4). This happens pretty much instantly as far as logging is concerned and it would be very unlikely that you would capture it.
How can I log feedback knock correction, fine learning knock correction or IAM?
If your ECU is supported for extended parameters with Enginuity's logger (be sure to update to the latest logger definitions), then you can log the following which relate to knock control:
- IAM (Ignition Advance Multiplier)* - current IAM
- Fine Learning Knock Correction* - current applied FLKC
- Feedback Knock Correction - current FBKC
- Fine Learning Table Offset - current applied FLKC cell. If this value remains the same while logged FLKC changes, then the ECU made an adjustment to the FLKC in the current cell (barring any sync issues normal to logging).
So, there is no fine or feedback correction to KC above their respective rpm/load ranges?
Not necessarily. Fine correction is applied in ranges. Looking at the RPM example above for 'Fine Correction Rows (RPM)', the stored FLKC value in RAM is applied at any rpm 6000+ (and its corresponding load cell). However, a change to the FLKC table in RAM can only occur within the ranges as specified by the 'Fine Correction Range' tables. If this table has a max value of say, 6200 rpm, then adjustments to the RAM table will only be made between 6000-6200 (assuming the same corresponding load), however they will be applied from 6000+ rpm (also assuming the same load).
Also, for FBKC, if it is negative at the same time you are leaving the maximum load or rpm thresholds, the ecu will keep the current feedback correction in play.
I've logged a large negative value in FBKC, but the IAM and FLKC did not change? Why didn't the ECU change the IAM based on this severe knock?
It is better to think of following as three distinct means of knock control:
1. Negative FBKC
2. Changes to the current IAM.
3. Changes to the current FLKC cell (note this is different than applied FLKC).
That is, only one is active at any given time based on what would be appropriate for the given conditions. So, in order for the IAM to change, the "severe" knock would have to occur when the ECU is in rough correction mode, FBKC is disabled, and the conditions to make a change to the IAM are met. So, basically, the corrective action that is taken is dependent on which knock control method is active at the time and whether certain conditions were met (although some values, such as FLKC, may partially impact mode selection as described earlier).