mitsu 4g63 (#5001)

* mitsu 4g63

* file header
This commit is contained in:
Matthew Kennedy 2023-01-23 17:23:40 -08:00 committed by GitHub
parent 7647f159ed
commit 9630edfbf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 268 additions and 4 deletions

View File

@ -96,6 +96,8 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
case VVT_MITSUBISHI_6G75:
case VVT_NISSAN_MR:
return TT_NISSAN_MR18_CAM_VVT;
case VVT_MITSUBISHI_4G63:
return TT_MITSU_ONLY_TOP_BOTH_FRONTS;
default:
firmwareError(OBD_PCM_Processor_Fault, "getVvtTriggerType for %s", getVvt_mode_e(vvtMode));
return TT_ONE; // we have to return something for the sake of -Werror=return-type

View File

@ -107,6 +107,8 @@ typedef enum __attribute__ ((__packed__)) {
*/
VVT_HONDA_K_EXHAUST = 16,
VVT_MITSUBISHI_4G63 = 17,
} vvt_mode_e;
/**

View File

@ -85,9 +85,13 @@ void initializeMitsubishi4g93_both_both(TriggerWaveform *s) {
void initializeMitsubishi4g93_only_first_wheel_both_fronts(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Both);
s->setTriggerSynchronizationGap(3.2);
s->setSecondTriggerSynchronizationGap2(0.5, 2.3);
s->setTriggerSynchronizationGap2(0.1, 0.5);
addMitsu93(s, false);
s->addEvent720(180, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
s->addEvent720(266, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
s->addEvent720(641, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
s->addEvent720(720, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
}
void initialize36_2_1_1(TriggerWaveform *s) {

View File

@ -170,6 +170,7 @@ static angle_t adjustCrankPhase(int camIndex) {
switch (vvtMode) {
case VVT_FIRST_HALF:
case VVT_MAP_V_TWIN:
case VVT_MITSUBISHI_4G63:
return tc->syncAndReport(getCrankDivider(operationMode), 1);
case VVT_SECOND_HALF:
case VVT_NISSAN_VQ:

View File

@ -307,8 +307,8 @@ custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@
#define VM_VVT_INACTIVE 0
#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2JZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "vvt17"
custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:4], @@vvt_mode_e_enum@@
#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2JZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsu 4G63"
custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:5], @@vvt_mode_e_enum@@
! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU
! todo: as of ChibiOS3, only channels 1 & 2 are allowed to capture input, that's a ChibiOS driver limitation

View File

@ -14,6 +14,7 @@ TESTS_SRC_CPP = \
tests/trigger/test_real_cranking_nissan_vq40.cpp \
tests/trigger/test_trigger_skipped_wheel.cpp \
tests/trigger/test_real_4b11.cpp \
tests/trigger/test_real_4g63.cpp \
tests/trigger/test_real_volkswagen.cpp \
tests/trigger/test_real_nb2_cranking.cpp \
tests/trigger/test_real_gm_24x.cpp \

View File

@ -0,0 +1,199 @@
Time[s], crank, cam
0.000000000000000, 1, 0
1.494753000000000, 0, 0
1.506921750000000, 1, 0
1.612318250000000, 0, 0
1.681612750000000, 0, 1
1.732877500000000, 1, 1
1.806291750000000, 0, 1
1.861951000000000, 0, 0
1.902313000000000, 1, 0
1.970729250000000, 0, 0
2.022872250000000, 0, 1
2.059014000000000, 1, 1
2.085412750000000, 1, 0
2.119538000000000, 0, 0
2.206066250000000, 1, 0
2.266987500000000, 0, 0
2.316638500000000, 0, 1
2.352118750000000, 1, 1
2.412216500000000, 0, 1
2.460772750000000, 0, 0
2.497370750000000, 1, 0
2.559245750000000, 0, 0
2.607990000000000, 0, 1
2.642810000000000, 1, 1
2.667487000000000, 1, 0
2.700186500000000, 0, 0
2.785114250000000, 1, 0
2.844329000000000, 0, 0
2.893034750000000, 0, 1
2.927807250000000, 1, 1
2.986567000000000, 0, 1
3.034370750000000, 0, 0
3.070484750000000, 1, 0
3.131379250000000, 0, 0
3.179887750000000, 0, 1
3.214613250000000, 1, 1
3.239370500000000, 1, 0
3.271715250000000, 0, 0
3.356859250000000, 1, 0
3.415756750000000, 0, 0
3.464241500000000, 0, 1
3.498965250000000, 1, 1
3.557156500000000, 0, 1
3.604547500000000, 0, 0
3.640645750000000, 1, 0
3.701006250000000, 0, 0
3.749165500000000, 0, 1
3.783702750000000, 1, 1
3.808099750000000, 1, 0
3.840262750000000, 0, 0
3.925541500000000, 1, 0
3.984426500000000, 0, 0
4.032156250000000, 0, 1
4.066623000000000, 1, 1
4.124483000000000, 0, 1
4.171811000000000, 0, 0
4.207782750000000, 1, 0
4.267835499999999, 0, 0
4.315820000000000, 0, 1
4.350302000000000, 1, 1
4.374738250000000, 1, 0
4.406492249999999, 0, 0
4.490840500000000, 1, 0
4.549222750000000, 0, 0
4.597310500000000, 0, 1
4.631872500000000, 1, 1
4.689966500000000, 0, 1
4.737363750000000, 0, 0
4.773538250000000, 1, 0
4.834032500000000, 0, 0
4.881681749999999, 0, 1
4.915958000000000, 1, 1
4.940247250000000, 1, 0
4.972271000000000, 0, 0
5.056390749999999, 1, 0
5.114432250000000, 0, 0
5.163234750000000, 0, 1
5.198098000000000, 1, 1
5.255806250000000, 0, 1
5.303640000000000, 0, 0
5.339906750000000, 1, 0
5.399754499999999, 0, 0
5.447633000000000, 0, 1
5.482216250000000, 1, 1
5.506672500000000, 1, 0
5.538245750000000, 0, 0
5.622610750000000, 1, 0
5.680819250000000, 0, 0
5.727998250000000, 0, 1
5.761973250000000, 1, 1
5.818899500000000, 0, 1
5.865582499999999, 0, 0
5.901025250000000, 1, 0
5.960164750000000, 0, 0
6.007168249999999, 0, 1
6.041088999999999, 1, 1
6.065072499999999, 1, 0
6.096412000000000, 0, 0
6.180311250000000, 1, 0
6.237890500000000, 0, 0
6.285459500000000, 0, 1
6.319601250000000, 1, 1
6.376443750000000, 0, 1
6.422967250000000, 0, 0
6.458396000000000, 1, 0
6.517242749999999, 0, 0
6.563905750000000, 0, 1
6.597798999999999, 1, 1
6.621518500000000, 1, 0
6.652881499999999, 0, 0
6.736140750000000, 1, 0
6.793416250000000, 0, 0
6.840612999999999, 0, 1
6.874703250000000, 1, 1
6.931303750000000, 0, 1
6.977859250000000, 0, 0
7.013473500000000, 1, 0
7.072443750000000, 0, 0
7.118917499999999, 0, 1
7.152824250000000, 1, 1
7.176675250000000, 1, 0
7.207953250000000, 0, 0
7.291758499999999, 1, 0
7.349159750000000, 0, 0
7.396515249999999, 0, 1
7.430614250000000, 1, 1
7.487187250000000, 0, 1
7.533847000000000, 0, 0
7.569177499999999, 1, 0
7.627891999999999, 0, 0
7.674611250000000, 0, 1
7.708475999999999, 1, 1
7.732335999999999, 1, 0
7.763510500000000, 0, 0
7.845901749999999, 1, 0
7.902759250000000, 0, 0
7.949735500000000, 0, 1
7.983770000000000, 1, 1
8.040103000000000, 0, 1
8.086273000000000, 0, 0
8.121497750000000, 1, 0
8.179841000000000, 0, 0
8.226068999999999, 0, 1
8.259755999999999, 1, 1
8.283215750000000, 1, 0
8.314324250000000, 0, 0
8.396975500000000, 1, 0
8.453863750000000, 0, 0
8.501026000000000, 0, 1
8.534975500000000, 1, 1
8.591211249999999, 0, 1
8.637514749999999, 0, 0
8.672692500000000, 1, 0
8.731024750000000, 0, 0
8.777467000000000, 0, 1
8.811156499999999, 1, 1
8.834794250000000, 1, 0
8.865860500000000, 0, 0
8.948499750000000, 1, 0
9.005370500000000, 0, 0
9.052408500000000, 0, 1
9.086271750000000, 1, 1
9.142514250000000, 0, 1
9.188700250000000, 0, 0
9.223915750000000, 1, 0
9.282259500000000, 0, 0
9.328291000000000, 0, 1
9.361782500000000, 1, 1
9.385013749999999, 1, 0
9.416155000000000, 0, 0
9.498853499999999, 1, 0
9.555615749999999, 0, 0
9.602765750000000, 0, 1
9.636807250000000, 1, 1
9.693013499999999, 0, 1
9.739416250000000, 0, 0
9.774776500000000, 1, 0
9.833094250000000, 0, 0
9.879419499999999, 0, 1
9.913084500000000, 1, 1
9.936648750000000, 1, 0
9.967679250000000, 0, 0
10.049862250000000, 1, 0
10.106634500000000, 0, 0
10.153670499999999, 0, 1
10.187534749999999, 1, 1
10.243663000000000, 0, 1
10.289702499999999, 0, 0
10.324709250000000, 1, 0
10.382712500000000, 0, 0
10.428939999999999, 0, 1
10.462404249999999, 1, 1
10.485657750000000, 1, 0
10.573481749999999, 1, 1
10.601926499999999, 0, 1
12.630424750000000, 1, 1
12.630433499999999, 0, 1
12.630445499999999, 1, 1
1 Time[s] crank cam
2 0.000000000000000 1 0
3 1.494753000000000 0 0
4 1.506921750000000 1 0
5 1.612318250000000 0 0
6 1.681612750000000 0 1
7 1.732877500000000 1 1
8 1.806291750000000 0 1
9 1.861951000000000 0 0
10 1.902313000000000 1 0
11 1.970729250000000 0 0
12 2.022872250000000 0 1
13 2.059014000000000 1 1
14 2.085412750000000 1 0
15 2.119538000000000 0 0
16 2.206066250000000 1 0
17 2.266987500000000 0 0
18 2.316638500000000 0 1
19 2.352118750000000 1 1
20 2.412216500000000 0 1
21 2.460772750000000 0 0
22 2.497370750000000 1 0
23 2.559245750000000 0 0
24 2.607990000000000 0 1
25 2.642810000000000 1 1
26 2.667487000000000 1 0
27 2.700186500000000 0 0
28 2.785114250000000 1 0
29 2.844329000000000 0 0
30 2.893034750000000 0 1
31 2.927807250000000 1 1
32 2.986567000000000 0 1
33 3.034370750000000 0 0
34 3.070484750000000 1 0
35 3.131379250000000 0 0
36 3.179887750000000 0 1
37 3.214613250000000 1 1
38 3.239370500000000 1 0
39 3.271715250000000 0 0
40 3.356859250000000 1 0
41 3.415756750000000 0 0
42 3.464241500000000 0 1
43 3.498965250000000 1 1
44 3.557156500000000 0 1
45 3.604547500000000 0 0
46 3.640645750000000 1 0
47 3.701006250000000 0 0
48 3.749165500000000 0 1
49 3.783702750000000 1 1
50 3.808099750000000 1 0
51 3.840262750000000 0 0
52 3.925541500000000 1 0
53 3.984426500000000 0 0
54 4.032156250000000 0 1
55 4.066623000000000 1 1
56 4.124483000000000 0 1
57 4.171811000000000 0 0
58 4.207782750000000 1 0
59 4.267835499999999 0 0
60 4.315820000000000 0 1
61 4.350302000000000 1 1
62 4.374738250000000 1 0
63 4.406492249999999 0 0
64 4.490840500000000 1 0
65 4.549222750000000 0 0
66 4.597310500000000 0 1
67 4.631872500000000 1 1
68 4.689966500000000 0 1
69 4.737363750000000 0 0
70 4.773538250000000 1 0
71 4.834032500000000 0 0
72 4.881681749999999 0 1
73 4.915958000000000 1 1
74 4.940247250000000 1 0
75 4.972271000000000 0 0
76 5.056390749999999 1 0
77 5.114432250000000 0 0
78 5.163234750000000 0 1
79 5.198098000000000 1 1
80 5.255806250000000 0 1
81 5.303640000000000 0 0
82 5.339906750000000 1 0
83 5.399754499999999 0 0
84 5.447633000000000 0 1
85 5.482216250000000 1 1
86 5.506672500000000 1 0
87 5.538245750000000 0 0
88 5.622610750000000 1 0
89 5.680819250000000 0 0
90 5.727998250000000 0 1
91 5.761973250000000 1 1
92 5.818899500000000 0 1
93 5.865582499999999 0 0
94 5.901025250000000 1 0
95 5.960164750000000 0 0
96 6.007168249999999 0 1
97 6.041088999999999 1 1
98 6.065072499999999 1 0
99 6.096412000000000 0 0
100 6.180311250000000 1 0
101 6.237890500000000 0 0
102 6.285459500000000 0 1
103 6.319601250000000 1 1
104 6.376443750000000 0 1
105 6.422967250000000 0 0
106 6.458396000000000 1 0
107 6.517242749999999 0 0
108 6.563905750000000 0 1
109 6.597798999999999 1 1
110 6.621518500000000 1 0
111 6.652881499999999 0 0
112 6.736140750000000 1 0
113 6.793416250000000 0 0
114 6.840612999999999 0 1
115 6.874703250000000 1 1
116 6.931303750000000 0 1
117 6.977859250000000 0 0
118 7.013473500000000 1 0
119 7.072443750000000 0 0
120 7.118917499999999 0 1
121 7.152824250000000 1 1
122 7.176675250000000 1 0
123 7.207953250000000 0 0
124 7.291758499999999 1 0
125 7.349159750000000 0 0
126 7.396515249999999 0 1
127 7.430614250000000 1 1
128 7.487187250000000 0 1
129 7.533847000000000 0 0
130 7.569177499999999 1 0
131 7.627891999999999 0 0
132 7.674611250000000 0 1
133 7.708475999999999 1 1
134 7.732335999999999 1 0
135 7.763510500000000 0 0
136 7.845901749999999 1 0
137 7.902759250000000 0 0
138 7.949735500000000 0 1
139 7.983770000000000 1 1
140 8.040103000000000 0 1
141 8.086273000000000 0 0
142 8.121497750000000 1 0
143 8.179841000000000 0 0
144 8.226068999999999 0 1
145 8.259755999999999 1 1
146 8.283215750000000 1 0
147 8.314324250000000 0 0
148 8.396975500000000 1 0
149 8.453863750000000 0 0
150 8.501026000000000 0 1
151 8.534975500000000 1 1
152 8.591211249999999 0 1
153 8.637514749999999 0 0
154 8.672692500000000 1 0
155 8.731024750000000 0 0
156 8.777467000000000 0 1
157 8.811156499999999 1 1
158 8.834794250000000 1 0
159 8.865860500000000 0 0
160 8.948499750000000 1 0
161 9.005370500000000 0 0
162 9.052408500000000 0 1
163 9.086271750000000 1 1
164 9.142514250000000 0 1
165 9.188700250000000 0 0
166 9.223915750000000 1 0
167 9.282259500000000 0 0
168 9.328291000000000 0 1
169 9.361782500000000 1 1
170 9.385013749999999 1 0
171 9.416155000000000 0 0
172 9.498853499999999 1 0
173 9.555615749999999 0 0
174 9.602765750000000 0 1
175 9.636807250000000 1 1
176 9.693013499999999 0 1
177 9.739416250000000 0 0
178 9.774776500000000 1 0
179 9.833094250000000 0 0
180 9.879419499999999 0 1
181 9.913084500000000 1 1
182 9.936648750000000 1 0
183 9.967679250000000 0 0
184 10.049862250000000 1 0
185 10.106634500000000 0 0
186 10.153670499999999 0 1
187 10.187534749999999 1 1
188 10.243663000000000 0 1
189 10.289702499999999 0 0
190 10.324709250000000 1 0
191 10.382712500000000 0 0
192 10.428939999999999 0 1
193 10.462404249999999 1 1
194 10.485657750000000 1 0
195 10.573481749999999 1 1
196 10.601926499999999 0 1
197 12.630424750000000 1 1
198 12.630433499999999 0 1
199 12.630445499999999 1 1

View File

@ -0,0 +1,55 @@
// Mitsubishi 4G63 trigger pattern
// Crank: 2 teeth per rev (4 teeth per cycle)
// Cam: 4G63 pattern (big tooth - small tooth)
#include "pch.h"
#include "logicdata_csv_reader.h"
TEST(real4g63, cranking) {
CsvReader reader(1, /* vvtCount */ 1);
reader.open("tests/trigger/resources/4g63-cranking.csv");
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->isFasterEngineSpinUpEnabled = true;
engineConfiguration->alwaysInstantRpm = true;
engineConfiguration->isPhaseSyncRequiredForIgnition = true;
engineConfiguration->vvtMode[0] = VVT_MITSUBISHI_4G63;
engineConfiguration->trigger.customTotalToothCount = 2;
engineConfiguration->trigger.customSkippedToothCount = 0;
engineConfiguration->skippedWheelOnCam = false;
eth.setTriggerType(TT_TOOTHED_WHEEL);
int eventCount = 0;
bool gotRpm = false;
bool gotSync = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
engine->rpmCalculator.onSlowCallback();
// Expect that all teeth are in the correct spot
auto rpm = Sensor::getOrZero(SensorType::Rpm);
if (!gotRpm && rpm) {
gotRpm = true;
// We should get first RPM on exactly the first sync point - this means the instant RPM pre-sync event copy all worked OK
EXPECT_EQ(eventCount, 6);
EXPECT_NEAR(rpm, 132.77f, 0.1);
}
if (!gotSync && engine->triggerCentral.triggerState.hasSynchronizedPhase()) {
gotSync = true;
EXPECT_EQ(eventCount, 13);
EXPECT_NEAR(rpm, 191.45f, 0.1);
}
}
ASSERT_EQ(0, eth.recentWarnings()->getCount());
}