rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
gm_sbc.cpp
Go to the documentation of this file.
1#include "pch.h"
2#include "gm_sbc.h"
3#include "defaults.h"
4
5#ifdef HW_HELLEN
6#include "hellen_meta.h"
7#endif // HW_HELLEN
8
9#ifdef HW_HELLEN_8CHAN
10#include "connectors/generated_board_pin_names.h"
11#endif // HW_HELLEN_8CHAN
12
13#include "proteus_meta.h"
14
20
21 for (size_t i = 0;i<ETB_COUNT;i++) {
23 }
24
25 setPPSInputs(EFI_ADC_NONE, EFI_ADC_NONE);
26
27#ifdef HW_HELLEN_8CHAN
30#endif // HW_HELLEN_8CHAN
31
32#ifdef HW_HELLEN_UAEFI
35#endif // HW_HELLEN_UAEFI
36
37#ifdef HW_PROTEUS
38//Coil 1 - Pin 15 DC2 positive Pin A Toyota iac pin 4
39//Coil 1 - Pin 8 DC2 negative Pin B Toyota iac pin 6
40//Coil 2 - Pin 7 DC1 positive Pin C Toyota iac pin 1
41//Coil 2 - Pin 6 DC1 negative Pin D Toyota iac pin 3
42
43 // coil #1 = proteus pin 15 (DC2 positive) to BL pin "A", pin B to pin 8 (DC2 negative)
44 // PWM pin
46 // DIR pin
48 // Disable pin
50 // Unused
52
53 // coil #2 - proteus pin 7 (DC1 positive) to AH pin "D", pin C to pin 6 (DC1 negative)
54 // PWM pin
56 // DIR pin
58 // Disable pin
60 // Unused
62
63#endif // HW_PROTEUS
64}
65
66static void gmRailSensor() {
67 engineConfiguration->highPressureFuel.v1 = 0.5; /* volts */;
69 engineConfiguration->highPressureFuel.v2 = 4.5; /* volts */;
70 // fun fact: twice the range of VAG B6?
72}
73
74void setGmSbc() {
76 // that's original firing order before gen 3
77 engineConfiguration->firingOrder = FO_1_8_4_3_6_5_7_2;
79
80 // see engine sniffer at https://github.com/rusefi/rusefi/issues/5353
81 // if injectors are wired in groups of four best to use channels 1 and 4
84
85 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_GM);
86 strcpy(engineConfiguration->engineCode, "SBC");
87 // white wire "HEI E" plug pin D
88 engineConfiguration->ignitionMode = IM_ONE_COIL;
90
91 // this is used to tell HEI that we are always in charge of timing advance
92 gppwm_channel *ignOverride = &engineConfiguration->gppwm[0];
93 ignOverride->pwmFrequency = 0;
94 strcpy(engineConfiguration->gpPwmNote[0], "ign ovrrd B");
95 setTable(ignOverride->table, 100);
96
97#ifdef HW_HELLEN_UAEFI121
98 // coil control plug pin A
99
100 // tan wire with a black trace - "HEI B", plug pin B (we use yellow)
101 ignOverride->pin = Gpio::MM100_IGN2; // 12a Coil 2
102 // tach plug pin C
103 engineConfiguration->triggerInputPins[0] = Gpio::MM100_IN_D2; // 35a HALL2 red wire
107#endif // HW_HELLEN_UAEFI121
108
109#ifdef HW_HELLEN_SUPER_UAEFI
110 engineConfiguration->triggerInputPins[0] = Gpio::MM100_IN_D2; // HALL2
112#endif // HW_HELLEN_SUPER_UAEFI
113
114#if HW_PROTEUS
115 // tan wire with a black trace - "HEI B", plug pin B
116 ignOverride->pin = Gpio::PROTEUS_IGN_12;
118 // reminder about D101
119 engineConfiguration->injectionPins[0] = Gpio::PROTEUS_LS_14; // #1
120 // reminder about D104
121 engineConfiguration->injectionPins[3] = Gpio::PROTEUS_LS_15; // #4
122
123 // wow high side relay control on MEFI1 ELECTRONIC-FUEL-INJECTION-MEFI-1-2-5.7L-350CID-8.2L-502CID.pdf page 46
124 engineConfiguration->fuelPumpPin = Gpio::PROTEUS_HS_1;
125 // low side on MEFI3 ELECTRONIC-FUEL-INJECTION-MEFI-3-5.7L-350CID-8.2L-502CID.pdf page 487
126
128#endif // HW_PROTEUS
129 engineConfiguration->mainRelayPin = Gpio::Unassigned; // vehicle controls main relay
130
131 // for instance IWP069
133
134 setStepperHw();
135
136 // 8 cylinders one coil HEI trigger
141 // Proteus Digital 1 is Tach input "HEI R", plug pin C
142
143 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
144}
145
146static void setGmGdi() {
149 engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
151 gmRailSensor();
152
153 // is this oddly high or OKis?
156
157#ifdef HW_HELLEN_4K_GDI
160
161 engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_SENS2; // Digital Input 3
162 engineConfiguration->camInputs[0] = Gpio::H144_IN_SENS3; // Digital Input 4
164 engineConfiguration->sentInputPins[0] = Gpio::H144_IN_AUX2_DIGITAL;
166
167 // engineConfiguration->starterControlPin = high side :()
168#endif // HW_HELLEN_4K_GDI
169
170#ifdef HW_HELLEN_8CHAN
171 engineConfiguration->sentInputPins[0] = Gpio::MM176_IN_D3;
172 engineConfiguration->starterControlPin = Gpio::MM176_IGN5; // 14C
173
174 engineConfiguration->map.sensor.hwChannel = MM176_IN_CRANK_ANALOG; // 1A Aux Analog 1. Important to use analog without muxing!
175 engineConfiguration->fuelPumpPin = Gpio::MM176_OUT_IO2; // 6C - High Side 2 orange/brown
176 engineConfiguration->hpfpValvePin = Gpio::MM176_GP17; // 19D Injector 9
177
181
182 engineConfiguration->starterControlPin = Gpio::PIN_5C; // 5C - High Side 1, ignition output is not enough at least on HHR
184#endif // HW_HELLEN_8CHAN
185
186 setPPSCalibration(1, 4.25, 0.5, 2.14);
187
188 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_GM);
189 engineConfiguration->etbFunctions[1] = DC_None;
191}
192
199
207
208void setGmLcv() {
211 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
212 strcpy(engineConfiguration->engineCode, "LCV");
213}
214
215void setGmLnf() {
216 setGmGdi();
218 strcpy(engineConfiguration->engineCode, "LNF");
219 setTPS1Calibration(880, 129, 118, 870);
220
222
223 // todo: engineConfiguration->hpfpCam = HPFP_CAM_IN1;
224#ifdef HW_HELLEN_8CHAN
225 engineConfiguration->vvtMode[1] = VVT_BOSCH_QUICK_START;
228 engineConfiguration->highPressureFuel.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
229
230 engineConfiguration->vvtPins[0] = Gpio::MM176_OUT_PWM1;
231 engineConfiguration->vvtPins[1] = Gpio::MM176_OUT_PWM2;
232#endif // HW_HELLEN_8CHAN
233}
234
235// 2.0T
236void setGmLtg() {
239#ifdef HW_HELLEN_8CHAN
240 engineConfiguration->oilPressure.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
242
243 engineConfiguration->triggerInputPins[0] = Gpio::MM176_IN_D4; // 9A - Hall Input 4
244
245 engineConfiguration->luaOutputPins[0] = Gpio::MM176_OUT_IO1; // 7C - High Side 3 - unusual starter
246 engineConfiguration->luaOutputPins[1] = Gpio::MM176_OUT_IO4, // 9C - Low Side 4 - unusual starter
247#endif // HW_HELLEN_8CHAN
248 strcpy(engineConfiguration->engineCode, "LTG");
249}
250
252 setGmEcotec3();
256 engineConfiguration->firingOrder = FO_1_8_7_2_6_5_4_3;
257 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
258
259 // engineConfiguration->hpfpPumpVolume = 0.623; // LT4
260 engineConfiguration->hpfpPumpVolume = 0.49; // cc per stroke
261
262 // LT 17.7 g/sec at 100bar which 1440
263 // todo: real flow!
264 engineConfiguration->injector.flow = 990; // 12.6g/sec
265
266#ifdef HW_HELLEN_8CHAN
269
270 engineConfiguration->injectionPins[4] = Gpio::MM176_INJ5;
271 engineConfiguration->injectionPins[5] = Gpio::MM176_INJ6;
272 engineConfiguration->injectionPins[6] = Gpio::MM176_INJ7;
273 engineConfiguration->injectionPins[7] = Gpio::MM176_INJ8;
274
275 engineConfiguration->ignitionPins[4] = Gpio::MM176_IGN5;
276 engineConfiguration->ignitionPins[5] = Gpio::MM176_IGN6;
277 engineConfiguration->ignitionPins[6] = Gpio::MM176_IGN7;
278 engineConfiguration->ignitionPins[7] = Gpio::MM176_IGN8;
279
280 engineConfiguration->starterControlPin = Gpio::MM176_SPI3_SCK; // 29C - Ignition 9
281
284 engineConfiguration->vvtMode[1] = VVT_INACTIVE;
286
287 // early models before SENT
288 // todo: early gen5 LS engines have redundant high pressure sensors #7364
289 engineConfiguration->highPressureFuel.v1 = 0.57; /* volts */;
291 engineConfiguration->highPressureFuel.v2 = 2.25; /* volts */;
293
294 engineConfiguration->lowPressureFuel.v1 = 2.9; /* volts */;
296 engineConfiguration->lowPressureFuel.v2 = 3.7; /* volts */;
298
300 engineConfiguration->oilPressure.value1 = 0; // 100 kPa absolute
302 engineConfiguration->oilPressure.value2 = 420; // 520 kPa absolute
303
304 engineConfiguration->oilPressure.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
305 engineConfiguration->fuelLevelSensor = MM176_IN_O2S_ANALOG; // 3A - Aux Analog 2
306 engineConfiguration->lowPressureFuel.hwChannel = MM176_IN_AUX2_ANALOG; // 4A - Aux Analog 7
307 engineConfiguration->acPressure.hwChannel = MM176_IN_MAP2_ANALOG;// 10A - Aux Analog 5
308 engineConfiguration->flexSensorPin = Gpio::MM176_IN_SENS3;
309#endif // HW_HELLEN_8CHAN
310}
@ Unassigned
void setHpfpLobeProfileAngle(int lobes)
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
void setGDIFueling()
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)
void setInline4()
void setTPS1Inputs(adc_channel_e tps1, adc_channel_e tps2)
void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, float secondaryDown)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
void setGmLtg()
Definition gm_sbc.cpp:236
static void setGmEcotec3()
Definition gm_sbc.cpp:193
static void set4CylGmEcotec3()
Definition gm_sbc.cpp:200
static void setGmGdi()
Definition gm_sbc.cpp:146
void setStepperHw()
Definition gm_sbc.cpp:15
void setGmSbcGen5()
Definition gm_sbc.cpp:251
void setGmLnf()
Definition gm_sbc.cpp:215
void setGmLcv()
Definition gm_sbc.cpp:208
void setGmSbc()
Definition gm_sbc.cpp:74
static void gmRailSensor()
Definition gm_sbc.cpp:66
void set8chanDefaultETBPins()
void setUaefiDefaultETBPins()
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
scaled_channel< uint8_t, 2, 1 > table[GPPWM_LOAD_COUNT][GPPWM_RPM_COUNT]
constexpr void setTable(TElement(&dest)[N][M], const VElement value)
void setGmCltSensor(ThermistorConf *thermistorConf)