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
19 engineConfiguration->stepperDcInvertedPins = false; // or true?
20
21 // for instance IWP069
23 setPPSInputs(EFI_ADC_NONE, EFI_ADC_NONE);
24
25#ifdef HW_HELLEN_8CHAN
26 // using 8chan pinout for DC1: A26 (OUT_DC1+ AH pin "D") and A27 (OUT_DC1- AL pin "C")
27 engineConfiguration->stepperDcIo[0].controlPin = Gpio::H144_GP_IO4; // DC1_PWM
28 engineConfiguration->stepperDcIo[0].directionPin1 = Gpio::H144_GP_IO3; // DC1_DIR
30 engineConfiguration->stepperDcIo[0].disablePin = Gpio::H144_GP_IO5; // ETB_DIS
31 // using 8chan pinout for DC2: A28 (OUT_DC2+ BL pin "A") and A29 (OUT_DC2- BH pin "B")
32 engineConfiguration->stepperDcIo[1].controlPin = Gpio::H144_UART8_TX; // DC2_PWM
33 engineConfiguration->stepperDcIo[1].directionPin1 = H_SPI3_CS; // DC2_DIR
35#endif // HW_HELLEN
36
37#ifdef HW_HELLEN_UAEFI
38 // TODO: all the copy-pasting here begs the question: "shall we rename etbIo to hBridgeIo and reuse for stepper"?
39 engineConfiguration->stepperDcIo[0].controlPin = Gpio::MM100_OUT_PWM3;
40 engineConfiguration->stepperDcIo[0].directionPin1 = Gpio::MM100_OUT_PWM4;
42 engineConfiguration->stepperDcIo[0].disablePin = Gpio::MM100_SPI2_MISO;
43
44 engineConfiguration->stepperDcIo[1].controlPin = Gpio::MM100_OUT_PWM5;
45 engineConfiguration->stepperDcIo[1].directionPin1 = Gpio::MM100_SPI2_MOSI;
46 engineConfiguration->stepperDcIo[1].directionPin2 = Gpio::MM100_USB1ID;
47#endif // HW_HELLEN_UAEFI
48
49#ifdef HW_PROTEUS
50 // coil #1 = proteus pin 15 (DC2 positive) to BL pin "A", pin B to pin 8 (DC2 negative)
51 // PWM pin
53 // DIR pin
55 // Disable pin
57 // Unused
59
60 // coil #2 - proteus pin 7 (DC1 positive) to AH pin "D", pin C to pin 6 (DC1 negative)
61 // PWM pin
63 // DIR pin
65 // Disable pin
67 // Unused
69
70#endif // HW_PROTEUS
71}
72
73static void gmRailSensor() {
74 engineConfiguration->highPressureFuel.v1 = 0.5; /* volts */;
76 engineConfiguration->highPressureFuel.v2 = 4.5; /* volts */;
77 // fun fact: twice the range of VAG B6?
79}
80
81void setGmSbc() {
83 // that's original firing order before gen 3
84 engineConfiguration->firingOrder = FO_1_8_4_3_6_5_7_2;
86
87 // see engine sniffer at https://github.com/rusefi/rusefi/issues/5353
88 // if injectors are wired in groups of four best to use channels 1 and 4
91
94
95 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_GM);
96 strcpy(engineConfiguration->engineCode, "SBC");
97 // white wire "HEI E" plug pin D
98 engineConfiguration->ignitionMode = IM_ONE_COIL;
100
101 gppwm_channel *ignOverride = &engineConfiguration->gppwm[0];
102 ignOverride->pwmFrequency = 0;
103 strcpy(engineConfiguration->gpPwmNote[0], "ign ovrrd B");
104 setTable(ignOverride->table, 100);
105
106#ifdef HW_HELLEN_UAEFI121
107 // coil control plug pin A
108
109 // tan wire with a black trace - "HEI B", plug pin B (we use yellow)
110 ignOverride->pin = Gpio::MM100_IGN2; // 12a Coil 2
111 // tach plug pin C
112 engineConfiguration->triggerInputPins[0] = Gpio::MM100_IN_D2; // 35a HALL2 red wire
116#endif // HW_HELLEN_UAEFI121
117
118#if HW_PROTEUS
119 // tan wire with a black trace - "HEI B", plug pin B
120 ignOverride->pin = Gpio::PROTEUS_IGN_12;
122 // reminder about D101
123 engineConfiguration->injectionPins[0] = Gpio::PROTEUS_LS_14; // #1
124 // reminder about D104
125 engineConfiguration->injectionPins[3] = Gpio::PROTEUS_LS_15; // #4
126
127 // wow high side relay control on MEFI1 ELECTRONIC-FUEL-INJECTION-MEFI-1-2-5.7L-350CID-8.2L-502CID.pdf page 46
128 engineConfiguration->fuelPumpPin = Gpio::PROTEUS_HS_1;
129 // low side on MEFI3 ELECTRONIC-FUEL-INJECTION-MEFI-3-5.7L-350CID-8.2L-502CID.pdf page 487
130
132#endif // HW_PROTEUS
133 engineConfiguration->mainRelayPin = Gpio::Unassigned; // vehicle controls main relay
134
135 setStepperHw();
136
137 // 8 cylinders one coil HEI trigger
142 // Proteus Digital 1 is Tach input "HEI R", plug pin C
143
144 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
145}
146
147static void setGmGdi() {
150 engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
152 gmRailSensor();
153
154 // is this oddly high or OKis?
157
158#ifdef HW_HELLEN_4K_GDI
161
162 engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_SENS2; // Digital Input 3
163 engineConfiguration->camInputs[0] = Gpio::H144_IN_SENS3; // Digital Input 4
165 engineConfiguration->sentInputPins[0] = Gpio::H144_IN_AUX2_DIGITAL;
167
168 // engineConfiguration->starterControlPin = high side :()
169#endif // HW_HELLEN_4K_GDI
170
171#ifdef HW_HELLEN_8CHAN
172 engineConfiguration->sentInputPins[0] = Gpio::MM176_IN_D3;
173 engineConfiguration->starterControlPin = Gpio::MM176_IGN5; // 14C
174
175 engineConfiguration->map.sensor.hwChannel = MM176_IN_CRANK_ANALOG; // 1A Aux Analog 1. Important to use analog without muxing!
176 engineConfiguration->fuelPumpPin = Gpio::MM176_OUT_IO2; // 6C - High Side 2 orange/brown
177 engineConfiguration->hpfpValvePin = Gpio::MM176_GP17; // 19D Injector 9
178
182
183 engineConfiguration->starterControlPin = Gpio::PIN_5C; // 5C - High Side 1, ignition output is not enough at least on HHR
185#endif // HW_HELLEN_8CHAN
186
187 setPPSCalibration(1, 4.25, 0.5, 2.14);
188
189 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_GM);
190 engineConfiguration->etbFunctions[1] = DC_None;
192}
193
200
208
209void setGmLcv() {
212 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
213 strcpy(engineConfiguration->engineCode, "LCV");
214}
215
216void setGmLnf() {
217 setGmGdi();
219 strcpy(engineConfiguration->engineCode, "LNF");
220 setTPS1Calibration(880, 129, 118, 870);
221
223
224 // todo: engineConfiguration->hpfpCam = HPFP_CAM_IN1;
225#ifdef HW_HELLEN_8CHAN
226 engineConfiguration->vvtMode[1] = VVT_BOSCH_QUICK_START;
229 engineConfiguration->highPressureFuel.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
230
231 engineConfiguration->vvtPins[0] = Gpio::MM176_OUT_PWM1;
232 engineConfiguration->vvtPins[1] = Gpio::MM176_OUT_PWM2;
233#endif // HW_HELLEN_8CHAN
234}
235
236// 2.0T
237void setGmLtg() {
240#ifdef HW_HELLEN_8CHAN
241 engineConfiguration->oilPressure.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
243
244 engineConfiguration->triggerInputPins[0] = Gpio::MM176_IN_D4; // 9A - Hall Input 4
245
246 engineConfiguration->luaOutputPins[0] = Gpio::MM176_OUT_IO1; // 7C - High Side 3 - unusual starter
247 engineConfiguration->luaOutputPins[1] = Gpio::MM176_OUT_IO4, // 9C - Low Side 4 - unusual starter
248#endif // HW_HELLEN_8CHAN
249 strcpy(engineConfiguration->engineCode, "LTG");
250}
251
253 setGmEcotec3();
257 engineConfiguration->firingOrder = FO_1_8_7_2_6_5_4_3;
258 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
259
260 // engineConfiguration->hpfpPumpVolume = 0.623; // LT4
261 engineConfiguration->hpfpPumpVolume = 0.49; // cc per stroke
262
263 // LT 17.7 g/sec at 100bar which 1440
264 // todo: real flow!
265 engineConfiguration->injector.flow = 990; // 12.6g/sec
266
267#ifdef HW_HELLEN_8CHAN
270
271 engineConfiguration->injectionPins[4] = Gpio::MM176_INJ5;
272 engineConfiguration->injectionPins[5] = Gpio::MM176_INJ6;
273 engineConfiguration->injectionPins[6] = Gpio::MM176_INJ7;
274 engineConfiguration->injectionPins[7] = Gpio::MM176_INJ8;
275
276 engineConfiguration->ignitionPins[4] = Gpio::MM176_IGN5;
277 engineConfiguration->ignitionPins[5] = Gpio::MM176_IGN6;
278 engineConfiguration->ignitionPins[6] = Gpio::MM176_IGN7;
279 engineConfiguration->ignitionPins[7] = Gpio::MM176_IGN8;
280
281 engineConfiguration->starterControlPin = Gpio::MM176_SPI3_SCK; // 29C - Ignition 9
282
285 engineConfiguration->vvtMode[1] = VVT_INACTIVE;
287
288 // early models before SENT
289 // todo: early gen5 LS engines have redundant high pressure sensors #7364
290 engineConfiguration->highPressureFuel.v1 = 0.57; /* volts */;
292 engineConfiguration->highPressureFuel.v2 = 2.25; /* volts */;
294
295 engineConfiguration->lowPressureFuel.v1 = 2.9; /* volts */;
297 engineConfiguration->lowPressureFuel.v2 = 3.7; /* volts */;
299
301 engineConfiguration->oilPressure.value1 = 0; // 100 kPa absolute
303 engineConfiguration->oilPressure.value2 = 420; // 520 kPa absolute
304
305 engineConfiguration->oilPressure.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
306 engineConfiguration->fuelLevelSensor = MM176_IN_O2S_ANALOG; // 3A - Aux Analog 2
307 engineConfiguration->lowPressureFuel.hwChannel = MM176_IN_AUX2_ANALOG; // 4A - Aux Analog 7
308 engineConfiguration->acPressure.hwChannel = MM176_IN_MAP2_ANALOG;// 10A - Aux Analog 5
309 engineConfiguration->flexSensorPin = Gpio::MM176_IN_SENS3;
310#endif // HW_HELLEN_8CHAN
311}
@ 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:237
static void setGmEcotec3()
Definition gm_sbc.cpp:194
static void set4CylGmEcotec3()
Definition gm_sbc.cpp:201
static void setGmGdi()
Definition gm_sbc.cpp:147
void setStepperHw()
Definition gm_sbc.cpp:15
void setGmSbcGen5()
Definition gm_sbc.cpp:252
void setGmLnf()
Definition gm_sbc.cpp:216
void setGmLcv()
Definition gm_sbc.cpp:209
void setGmSbc()
Definition gm_sbc.cpp:81
static void gmRailSensor()
Definition gm_sbc.cpp:73
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)