There have been many occasions where I have been asked how to configure the Variable Valve Timing cam angle measurement. Rather than repeat it every time, it seems more sensible to describe how it works and how you set it up :
First and foremost a good clean signal is required - for VR type sensors this means choosing the rapid edge (be that falling or rising) and configuring the thresholds accordingly, for a Hall Effect type sensor typically the fastest edge is usually the falling edge (but there may be reasons it cannot be used, see below).
Once a good clean signal is available, the fun begins. Start by making sure that a) VVT Control is disabled at normal engine speeds (set the Enable to 7000 RPM for example) and also make sure the engine is *thoroughly warm* - cam angles move as the block heats and expands!
Next enable every latch point in the Latch Points table for every cam that needs to be controlled - most will be removed again but for now they all need to be on. The reason is that every time a tooth is detected, the angle at which it occurred is transferred into a holding register in the hardware, every Latch Point that register is read - so if another tooth comes along in the meantime we can lose a tooth, which we don't want to do.
With all the Latch Points turned on, it is time to bring up a gauge for vvt1InRaw (plus any other cams you need to control). Set this to 1 or 2 Hz so you can actually read the values. With the engine idling, there will be a value shown (pretty randomly) for every tooth, but you may have to wait for them - it may show a tooth at 20 degrees ATDC for a long time before then showing another. A little patience and knowing how many teeth there are helps! Take a note of the angle at which each tooth occurs. It may vary a little - eg 19.5, 19.75, 19.25, 19.25, 19.75 etc but there will be a "centre" to those numbers - write them down for each tooth on each cam.
Turn off all the latch points now, and populate only the ones that are needed :
Now that we know where the teeth are at with the cams in their rest position it is time to configure the Latch Points and Latch Offsets. Where a cam is fully retarded when at rest and advanced by the variator, we will choose a latch point closely after the tooth happens - it is already happening as late as it can, it can only move forwards from here. By way of example, if there was a tooth at 19 degrees then we might choose the 30 degree latch point - if a belt can stretch 11 degrees there are more serious issues to deal with first! If there is another tooth at 199 degrees then we would also enable the latch point at 210 degrees. This needs to be done for every tooth on every cam that is fully retarded when no drive is supplied to the variator. If a cam is fully advanced and will retard when the variator is driven then we need to add the variator maximum retard to the angle - if a cam tooth sits at 50 degrees and the variator can retard it 50 degrees, then that tooth can move to 100 degrees ATDC, so we need to make sure the latch point is after this latest point that the tooth can happen, for this example the 120 degree latch point would be used.
With all the latch points configured, all of the tooth angles should still be shown in the vvt1InRaw etc gauges - if one or more disappear then there is an error in the Latch Point selection. Assuming all is good and all the teeth are still registering, it is time to set the Latch Offsets. In order to present the cam angle in cam advance terms, the actual tooth angle is subtracted from the Latch Offset - so for a tooth at 19.5 degrees, a Latch Point would be enabled at 30 degrees, and the Latch Offset at the 30 degree Latch Point would be 19.5 degrees. If the tooth happens at 19.5 then that is subtracted from 19.5, thereby causing vvt1In (note no Raw) to read 0. Now if the cam advances 10 degrees to 9.5 degrees, then 19.5 - 9.5 = 10 degrees, ie correctly showing 10 degrees of advance. This can be done for all the teeth on all the cams. Any cam where the variator rest position is fully advanced will then read negative advance for retarded cam position - if this is not the desired result then the maximum variator retard can be added onto the Latch Offsets thus causing the rest position to read as having advance, and then the fully retarded position having no advance (rather than showing retard) - this is a case of personal preference.
With the Latch Points and the Latch Offsets configured it is time to check that the readings remain sensible when the engine speed is increased. A small variation is acceptable, but no more than about 4 degrees. If, with the variator drive turned off, a change in measured cam advance of more than 4 degrees is measured then there is a problem with the signal - it may be that the incorrect edge has been selected, that an input filter is turned on, or that the signal inverts. If any of these are happening then they must be fixed.
The correct edge should be easy to determine - for VR sensors it is the edge "in the middle", typically a falling one, ie if the signal starts at 0, swings up, shoots down and then swings back up to zero then the falling edge is the right one. The low trigger threshold should be the notional zero voltage (which can sometimes be more than 0 for high impedance VR sensors). If all that looks good then some type of a filter / delay is happening and needs to be turned off / removed.
If using a Hall Effect sensor, it is possible that the signal turns itself upside down (this has been seen on a number of sensors!). In this event, the choice of the correct trigger should be so it is right when the signal is in the operating RPM range, not idle, and ideally the closed loop VVT control should be disabled until above the RPM at which point the signal inverts (this tends to be fairly predictable / consistent). The choice of the correct edge will depend on what the signal does : if it is high-for-tooth but flips to low-for-tooth then using the falling edge will be fine, the measured angle will advance by the tooth width and should be accounted for in the Latch Offsets. If the signal at idle is high-for-tooth but then goes to low-for-tooth then using the falling edge may prove problematic - if the Latch Point is after the leading edge but before the trailing edge of the tooth at full retard, then when the signal inverts the last falling edge will have been the trailing edge of the previous tooth, *NOT* the trailing edge of the present tooth - a rising edge may prove favourable under these circumstances since that would correspond to the trailing edge of the the tooth under idle conditions and the leading edge of the same tooth as the engine speed rises (thereby moving the reading by 20-30 degrees, not 120-180 degrees).
Additional care may be necessary where a single sensor is both a VVT and a Phase sensor. It is not possible then for the Phase sensor to have different trigger edge and/or trigger thresholds to the VVT sensor. The configuration must work for both functions, even in the case of signal inversion.
Hopefully this clears up some of the questions / "mysteries" in the VVT cam angle measurement system.