This tutorial is written to explain all the trigger setup variables for the 1.1.x series of firmware. There are two general types of trigger schemes, those that rely on a missing teeth to identify the wheel position and those that do not. This document deals with the latter.
The examples here are taken from a Mazda 1.8l 4 cylinder BP engine's trigger scheme. With the settings here it should be trivial to make changes and adapt the configuration to variants of this scheme.
First the Mazda distributor contains a disc with slots as follows:
This camwheel rotates counterclockwise and is triggered via hall type sensor. This means either rising or falling edge pulses are appropriate.
Looking closely at this wheel the waveform of a running engine will look like this graphed according to degrees of rotation on the cam. Since the crank rotates at twice the speed this graph also represents two complete crank revolutions.
Dissecting the data presented here a number of details can be determined. Note that unless otherwise noted all measurements are expressed in degrees of cam rotation. Here, the primary pulse occurs 4 times per engine period and the secondary trigger only once.
- The rising edge of any primary trigger occurs 80 degrees before TDC on the next cylinder.
- The falling edge of any primary trigger occurs 33 degrees before TDC on the next cylinder.
- The rising edge of the secondary pulse occurs 18 degrees before TDC1
- The falling edge of the secondary pulse occurs 57 degrees after TDC1 and 43 degrees before TDC3.
Since these measurements are in cam degrees they are 1/2 of the crank measurement. This engine will never require 66 crank degrees of advance so we can use the falling edge of the primary trigger. Since this signal will occur closer to the actual engine event it will be slightly more accurate when the RPM is not constant.
First the trigger types must be configured:
primary_trigger
This configuration parameter contains a number of bit flags:
Bit Position | 1 | 0 |
0 | Rising edge trigger | Falling edge trigger |
1 | Simple repeating trigger type | Missing tooth trigger type |
2 | Filtering enabled | Filtering disabled |
3 | Advanced trigger code | Disabled |
4 | One missing tooth (ie 60-1) | Two missing teeth (ie 60-2) |
5 | Fiat Stilo and Subaru triggers | Disabled |
6 | Nissan trigger | Disabled |
Here we wish to trigger on the falling edge, it is a simple repeating trigger type with filtering enabled\n
primary_trigger=06
secondary_trigger
Bit Position | 1 | 0 |
0 | Rising edge trigger | Falling edge trigger |
1 | Disable this trigger | Enable this trigger |
3 | Single tooth type | Multitooth type |
4 | Cam Sync | Alien Advance |
5 | reserved for future crank trigger scheme | Disabled |
6 | Fiat Stilo and Subaru triggers | Disabled |
The secondary trigger also uses the falling edge and is flagged as the cam sync channel.\n
secondary_trigger=18
tooth_wheel
This parameter is used to store the tooth count of the primary trigger. In our case the tooth count on the primary wheel is 4 but it's run by the cam and this tooth_wheel parameter is expecting the crank tooth count. The crank rotates at twice the speed of the cam so we use a tooth count of 2.\n
tooth_wheel=02
reset_engphase_after
Since the crank rotates at twice the speed of the cam then this value is normally 2x the tooth_wheel value\n
reset_engphase_after=04
trigger_tooth
There is no documentation for this but I set it to 0 and it does something.
another_trigger_tooth
There is no documentation for this but mcel thought I should set it to 1.
cam_sync_r_edge_phase
cam_sync_f_edge_phase
These two do not appear to be implemented in the code and nobody understands what they do anyway. I suspect they can be used to provide a faster sync of the trigger when the cam sync pulse arrives. Both are set to 0xFF
crank_minper
The docs say this is the minimum period for the crank trigger. It is in 16us intervals. Can anyone explain what it's for? I think the description below is correct.
Let's assume the maximum RPM for this engine is 8000 RPM. At 10,000 RPM it will probably fly to pieces. 60 seconds/ 10000rpm means 0.006 seconds per 360 degree revolution. The width of the primary trigger is 37 degrees but since it runs at 1/2 the speed it's actually 74 crank degrees. With 74/360 degrees of crank trigger pulse we know that our minimum crank pulse is 783us so for this value we use a value of 48 (0x30).\n
crank_minper=30
tooth_wheel_twidth1
tooth_wheel_twidth2
With no missing teeth these two values are used together as a 16 bit value for the number of degrees between on the primary triggers. This value does not reflect the 74 crank degrees of width in our primary trigger but the 180 crank degrees between falling edges. The value is stored in 1/4 crank degrees. The resulting value is 0x02D0\n
tooth_wheel_twidth1=0xD0 tooth_wheel_twidth2=0x02
ign_tdcdelay
This parameter is very important as it must be chosen such that there are enough crank degrees of rotation to allow our maximum desired amount of timing advance. I do not know if this factors in dwell time or not. mcel? This stores the number of 1/2 crank degrees from the primary trigger pulse to TDC. Since we use the falling edge of the primary pulse it is 33 cam degrees and 66 crank degrees before TDC. The resulting hex value in 1/2 degree increments is 0x84 \n
ign_tdcdelay=84
The resulting trigger config for this Mazda BP engine is as follows:\nÿ8ÿ
Someone will have to explain to me step by step how the h[1] table works so I can add that in here.