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 gppwm_channel *ignOverride = &engineConfiguration->gppwm[0];
92 ignOverride->pwmFrequency = 0;
93 strcpy(engineConfiguration->gpPwmNote[0], "ign ovrrd B");
94 setTable(ignOverride->table, 100);
95
96#ifdef HW_HELLEN_UAEFI121
97 // coil control plug pin A
98
99 // tan wire with a black trace - "HEI B", plug pin B (we use yellow)
100 ignOverride->pin = Gpio::MM100_IGN2; // 12a Coil 2
101 // tach plug pin C
102 engineConfiguration->triggerInputPins[0] = Gpio::MM100_IN_D2; // 35a HALL2 red wire
106#endif // HW_HELLEN_UAEFI121
107
108#if HW_PROTEUS
109 // tan wire with a black trace - "HEI B", plug pin B
110 ignOverride->pin = Gpio::PROTEUS_IGN_12;
112 // reminder about D101
113 engineConfiguration->injectionPins[0] = Gpio::PROTEUS_LS_14; // #1
114 // reminder about D104
115 engineConfiguration->injectionPins[3] = Gpio::PROTEUS_LS_15; // #4
116
117 // wow high side relay control on MEFI1 ELECTRONIC-FUEL-INJECTION-MEFI-1-2-5.7L-350CID-8.2L-502CID.pdf page 46
118 engineConfiguration->fuelPumpPin = Gpio::PROTEUS_HS_1;
119 // low side on MEFI3 ELECTRONIC-FUEL-INJECTION-MEFI-3-5.7L-350CID-8.2L-502CID.pdf page 487
120
122#endif // HW_PROTEUS
123 engineConfiguration->mainRelayPin = Gpio::Unassigned; // vehicle controls main relay
124
125 // for instance IWP069
127
128 setStepperHw();
129
130 // 8 cylinders one coil HEI trigger
135 // Proteus Digital 1 is Tach input "HEI R", plug pin C
136
137 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
138}
139
140static void setGmGdi() {
143 engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
145 gmRailSensor();
146
147 // is this oddly high or OKis?
150
151#ifdef HW_HELLEN_4K_GDI
154
155 engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_SENS2; // Digital Input 3
156 engineConfiguration->camInputs[0] = Gpio::H144_IN_SENS3; // Digital Input 4
158 engineConfiguration->sentInputPins[0] = Gpio::H144_IN_AUX2_DIGITAL;
160
161 // engineConfiguration->starterControlPin = high side :()
162#endif // HW_HELLEN_4K_GDI
163
164#ifdef HW_HELLEN_8CHAN
165 engineConfiguration->sentInputPins[0] = Gpio::MM176_IN_D3;
166 engineConfiguration->starterControlPin = Gpio::MM176_IGN5; // 14C
167
168 engineConfiguration->map.sensor.hwChannel = MM176_IN_CRANK_ANALOG; // 1A Aux Analog 1. Important to use analog without muxing!
169 engineConfiguration->fuelPumpPin = Gpio::MM176_OUT_IO2; // 6C - High Side 2 orange/brown
170 engineConfiguration->hpfpValvePin = Gpio::MM176_GP17; // 19D Injector 9
171
175
176 engineConfiguration->starterControlPin = Gpio::PIN_5C; // 5C - High Side 1, ignition output is not enough at least on HHR
178#endif // HW_HELLEN_8CHAN
179
180 setPPSCalibration(1, 4.25, 0.5, 2.14);
181
182 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_GM);
183 engineConfiguration->etbFunctions[1] = DC_None;
185}
186
193
201
202void setGmLcv() {
205 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
206 strcpy(engineConfiguration->engineCode, "LCV");
207}
208
209void setGmLnf() {
210 setGmGdi();
212 strcpy(engineConfiguration->engineCode, "LNF");
213 setTPS1Calibration(880, 129, 118, 870);
214
216
217 // todo: engineConfiguration->hpfpCam = HPFP_CAM_IN1;
218#ifdef HW_HELLEN_8CHAN
219 engineConfiguration->vvtMode[1] = VVT_BOSCH_QUICK_START;
222 engineConfiguration->highPressureFuel.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
223
224 engineConfiguration->vvtPins[0] = Gpio::MM176_OUT_PWM1;
225 engineConfiguration->vvtPins[1] = Gpio::MM176_OUT_PWM2;
226#endif // HW_HELLEN_8CHAN
227}
228
229// 2.0T
230void setGmLtg() {
233#ifdef HW_HELLEN_8CHAN
234 engineConfiguration->oilPressure.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
236
237 engineConfiguration->triggerInputPins[0] = Gpio::MM176_IN_D4; // 9A - Hall Input 4
238
239 engineConfiguration->luaOutputPins[0] = Gpio::MM176_OUT_IO1; // 7C - High Side 3 - unusual starter
240 engineConfiguration->luaOutputPins[1] = Gpio::MM176_OUT_IO4, // 9C - Low Side 4 - unusual starter
241#endif // HW_HELLEN_8CHAN
242 strcpy(engineConfiguration->engineCode, "LTG");
243}
244
246 setGmEcotec3();
250 engineConfiguration->firingOrder = FO_1_8_7_2_6_5_4_3;
251 engineConfiguration->map.sensor.type = MT_GM_1_BAR;
252
253 // engineConfiguration->hpfpPumpVolume = 0.623; // LT4
254 engineConfiguration->hpfpPumpVolume = 0.49; // cc per stroke
255
256 // LT 17.7 g/sec at 100bar which 1440
257 // todo: real flow!
258 engineConfiguration->injector.flow = 990; // 12.6g/sec
259
260#ifdef HW_HELLEN_8CHAN
263
264 engineConfiguration->injectionPins[4] = Gpio::MM176_INJ5;
265 engineConfiguration->injectionPins[5] = Gpio::MM176_INJ6;
266 engineConfiguration->injectionPins[6] = Gpio::MM176_INJ7;
267 engineConfiguration->injectionPins[7] = Gpio::MM176_INJ8;
268
269 engineConfiguration->ignitionPins[4] = Gpio::MM176_IGN5;
270 engineConfiguration->ignitionPins[5] = Gpio::MM176_IGN6;
271 engineConfiguration->ignitionPins[6] = Gpio::MM176_IGN7;
272 engineConfiguration->ignitionPins[7] = Gpio::MM176_IGN8;
273
274 engineConfiguration->starterControlPin = Gpio::MM176_SPI3_SCK; // 29C - Ignition 9
275
278 engineConfiguration->vvtMode[1] = VVT_INACTIVE;
280
281 // early models before SENT
282 // todo: early gen5 LS engines have redundant high pressure sensors #7364
283 engineConfiguration->highPressureFuel.v1 = 0.57; /* volts */;
285 engineConfiguration->highPressureFuel.v2 = 2.25; /* volts */;
287
288 engineConfiguration->lowPressureFuel.v1 = 2.9; /* volts */;
290 engineConfiguration->lowPressureFuel.v2 = 3.7; /* volts */;
292
294 engineConfiguration->oilPressure.value1 = 0; // 100 kPa absolute
296 engineConfiguration->oilPressure.value2 = 420; // 520 kPa absolute
297
298 engineConfiguration->oilPressure.hwChannel = MM176_IN_MAP1_ANALOG; // 2A Aux Analog 4
299 engineConfiguration->fuelLevelSensor = MM176_IN_O2S_ANALOG; // 3A - Aux Analog 2
300 engineConfiguration->lowPressureFuel.hwChannel = MM176_IN_AUX2_ANALOG; // 4A - Aux Analog 7
301 engineConfiguration->acPressure.hwChannel = MM176_IN_MAP2_ANALOG;// 10A - Aux Analog 5
302 engineConfiguration->flexSensorPin = Gpio::MM176_IN_SENS3;
303#endif // HW_HELLEN_8CHAN
304}
@ 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:230
static void setGmEcotec3()
Definition gm_sbc.cpp:187
static void set4CylGmEcotec3()
Definition gm_sbc.cpp:194
static void setGmGdi()
Definition gm_sbc.cpp:140
void setStepperHw()
Definition gm_sbc.cpp:15
void setGmSbcGen5()
Definition gm_sbc.cpp:245
void setGmLnf()
Definition gm_sbc.cpp:209
void setGmLcv()
Definition gm_sbc.cpp:202
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)