rusefi-1/firmware/config/engines/bmw_m73.cpp

272 lines
8.5 KiB
C++
Raw Normal View History

2019-11-01 19:56:58 -07:00
/*
* @file bmw_m73.cpp
*
*
* https://github.com/rusefi/rusefi_documentation/wiki/BMW_e38_750
*
* https://rusefi.com/wiki/index.php?title=Hardware:OEM_connectors#134_pin
*
2019-11-07 17:47:12 -08:00
* 1/2 plugs black
* 2/2 plugs grey
*
2019-11-01 19:56:58 -07:00
*
2019-11-09 15:40:06 -08:00
* ********* | | OEM | rusEfi | function
*
2019-11-08 17:53:51 -08:00
* Plug #1 9 pin
* ECU pin 4: GND BRN/ORG
* ECU pin 6: GND BRN
2019-11-09 15:40:06 -08:00
* ECU pin 7: IN RED +12v hot at all times
* ECU pin 8: IN RED/BLU +12v from ECU relay
2019-11-08 17:53:51 -08:00
*
* Plug #2 24 pin
2019-11-09 15:40:06 -08:00
* ECU pin 3: CAN xxx/xxx CAN low
* ECU pin 4: CAN xxx/xxx CAN high
* ECU pin 23: OUT BRN/BLK BLK ECU relay control, low-side
2019-11-01 19:56:58 -07:00
*
2019-11-08 17:53:51 -08:00
* Plug #3 52 pin
2019-11-30 17:24:31 -08:00
* ECU pin 2: OUT WHT injector #4
2019-11-09 15:40:06 -08:00
* ECU pin 6: GND ECU
2019-11-30 17:24:31 -08:00
* ECU pin 15: OUT BLK injector #2
2019-11-09 15:40:06 -08:00
* ECU pin 20: IN WHT hall effect camshaft sensor signal
* ECU pin 21: GND BRN BLK CLT sensor
* ECU pin 22: IN RED/BRN GRN CLT sensor
2019-11-30 17:24:31 -08:00
* ECU pin 27: OUT ORG injector #6
* ECU pin 28: OUT RED injector #5
2019-11-15 20:49:28 -08:00
* ECU pin 32: IN ORG VR positive crankshaft sensor - only 2x 5k per channel, R111 not installed, W1002 not installed
2019-11-30 17:24:31 -08:00
* ECU pin 40: OUT BRN/BLK GRN injector #3
* ECU pin 41: OUT BRN/WHT BLU injector #1
2019-11-09 15:40:06 -08:00
* ECU pin 45: GND crankshaft shield
2019-11-15 20:49:28 -08:00
* ECU pin 46: IN BLK BLU VR negative crankshaft sensor
2019-11-01 19:56:58 -07:00
*
*
2019-11-08 17:53:51 -08:00
* Plug #4 40 pin
2019-11-09 15:40:06 -08:00
* ECU pin 6: IN start signal from ignition key
* ECU pin 17: OUT BLK engine speed output for gauge cluster
* ECU pin 26: IN GRN/BLK RED +12 hot in start & run
* ECU pin 40: OUT YEL/BRN BRN starter enable
2019-11-01 19:56:58 -07:00
*
*
2019-11-17 19:32:27 -08:00
* Plug #5 9 pin
* ECU pic 3: OUT BLK coil signal, low-side
* ECU pic 5: GND BRN ground
* ECU pic 6: OUT BLK coil signal, low-side
2019-11-30 17:24:31 -08:00
* ECU pic 9: OUT BLK RED coil signal, low-side
2019-11-17 19:32:27 -08:00
*
2019-11-18 21:04:44 -08:00
* Frankenso
2019-11-14 20:58:04 -08:00
* set engine_type 40
2019-11-18 21:04:44 -08:00
* Manhattan
* set engine_type 24
2020-02-01 14:55:58 -08:00
* Proteus
* set engine_type 63
2019-11-14 20:58:04 -08:00
*
2019-11-22 20:27:03 -08:00
* https://raw.githubusercontent.com/wiki/rusefi/rusefi_documentation/oem_docs/VAG/Bosch_0280750009_pinout.jpg
*
2019-11-01 19:56:58 -07:00
* @date Nov 1, 2019
2020-01-07 21:02:40 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2019-11-01 19:56:58 -07:00
*/
#include "engine_template.h"
#include "custom_engine.h"
EXTERN_CONFIG;
2019-11-18 20:45:35 -08:00
static void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 13641435991 injector
engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info
2019-11-03 18:27:37 -08:00
engineConfiguration->specs.cylindersCount = 12;
engineConfiguration->specs.displacement = 5.4;
engineConfiguration->specs.firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10;
2019-11-14 20:58:04 -08:00
engineConfiguration->vvtMode = VVT_FIRST_HALF;
2019-11-17 19:32:27 -08:00
engineConfiguration->globalTriggerAngleOffset = 90;
2019-11-14 20:58:04 -08:00
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
2019-12-01 20:45:45 -08:00
// todo: that's not right, should be 60/2 without VW
2019-11-14 20:58:04 -08:00
engineConfiguration->trigger.type = TT_60_2_VW;
2019-12-01 20:45:45 -08:00
// this large engine seems to crank at around only 150 RPM? And happily idle at 400RPM?
engineConfiguration->cranking.rpm = 280;
2019-11-18 20:45:35 -08:00
engineConfiguration->ignitionMode = IM_TWO_COILS;
2019-12-01 19:37:26 -08:00
// set cranking_fuel 15
engineConfiguration->cranking.baseFuel = 15;
2019-11-18 20:45:35 -08:00
}
// BMW_M73_F
void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->triggerInputPins[0] = GPIOA_5;
engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
2019-11-18 20:45:35 -08:00
engineConfiguration->camInputs[0] = GPIOC_6;
CONFIG(idle).solenoidPin = GPIO_UNASSIGNED;
CONFIG(mainRelayPin) = GPIO_UNASSIGNED;
CONFIG(fanPin) = GPIO_UNASSIGNED;
CONFIG(fuelPumpPin) = GPIO_UNASSIGNED;
2019-11-16 13:00:50 -08:00
engineConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G - GREEN wire
engineConfiguration->ignitionPins[ID2INDEX(2)] = GPIO_UNASSIGNED;
engineConfiguration->ignitionPins[ID2INDEX(3)] = GPIO_UNASSIGNED;
engineConfiguration->ignitionPins[ID2INDEX(4)] = GPIO_UNASSIGNED;
engineConfiguration->ignitionPins[ID2INDEX(7)] = GPIOC_7; // Frankenso high side - pin 1H - ORANGE wire
2019-11-16 13:00:50 -08:00
engineConfiguration->injectionPins[0] = GPIOB_8; // BLU
engineConfiguration->injectionPins[1] = GPIOB_7; // BLK
engineConfiguration->injectionPins[2] = GPIOB_9; // GRN
engineConfiguration->injectionPins[3] = GPIOD_5; // WHT
engineConfiguration->injectionPins[4] = GPIOD_3; // RED
engineConfiguration->injectionPins[5] = GPIOE_2; // ORG
2019-11-16 13:00:50 -08:00
engineConfiguration->injectionPins[6] = GPIOE_3; // BLU
engineConfiguration->injectionPins[7] = GPIOE_4; // BLK
engineConfiguration->injectionPins[8] = GPIOE_5; // GRN
engineConfiguration->injectionPins[9] = GPIOE_6; // WHT
engineConfiguration->injectionPins[10] = GPIOC_13;//RED
engineConfiguration->injectionPins[11] = GPIOD_7;// ORG
2019-11-18 20:45:35 -08:00
}
2019-11-16 13:00:50 -08:00
2019-11-18 21:04:44 -08:00
// BMW_M73_M
2020-02-27 00:29:03 -08:00
// set engine_type 24
2019-11-18 20:45:35 -08:00
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
2019-11-14 20:58:04 -08:00
2019-11-20 21:19:35 -08:00
/**
Nucleo boards - first step is to confirm that I can blink via each pin
going clockwise from top-right corner
GPIOA_10 USD ID
GPIOA_11 USD DM
GPIOA_12 USD DP
E_4: running
Good GPIO:
GPIOC_9 ETB#1
GPIOC_8 ETB#1
2019-11-28 22:35:45 -08:00
GPIOB_8 ETB#2
GPIOB_9 ETB#2
2019-11-20 21:19:35 -08:00
GPIOC_5
GPIOA_7
GPIOA_6
*/
CONFIG(fsioOutputPins)[7] = GPIO_UNASSIGNED;
engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
engineConfiguration->fanPin = GPIO_UNASSIGNED;
2019-11-20 21:19:35 -08:00
2019-11-27 21:40:25 -08:00
/**
* Yellow op-amp board
*
2019-11-29 13:51:51 -08:00
* AN5 tested pull-down 1M PA3 TPS1 orange wire
2019-11-28 22:35:45 -08:00
* AN6 tested pull-down 1M PA4 TPS2
2019-11-29 11:51:20 -08:00
* AN7 tested pull-down 1M PA6 PPS
2019-11-27 21:40:25 -08:00
* AN8 tested no pull-down / no pull-up
*/
2019-11-20 21:19:35 -08:00
// For example TLE7209 - two control wires:
// PWM on both wires - one to open, another to close
2019-11-27 21:40:25 -08:00
// ETB motor NEG pin # - white wire - OUT 1
2020-02-27 00:29:03 -08:00
// green input wire
2019-11-29 11:51:20 -08:00
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_6;
2019-11-28 22:35:45 -08:00
// set_analog_input_pin tps PA3
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3; // PA3
2019-11-29 11:51:20 -08:00
// set_analog_input_pin tps2 PA4
2019-11-28 22:35:45 -08:00
engineConfiguration->tps2_1AdcChannel = EFI_ADC_4; // PA4
2019-11-20 21:19:35 -08:00
// PWM pin
engineConfiguration->etbIo[0].controlPin1 = GPIO_UNASSIGNED;
2019-11-20 21:19:35 -08:00
// DIR pin
engineConfiguration->etbIo[0].directionPin1 = GPIOC_9;
engineConfiguration->etbIo[0].directionPin2 = GPIOC_8;
2019-11-29 13:51:51 -08:00
CONFIG(etb_use_two_wires) = true;
2019-11-20 21:19:35 -08:00
2019-11-28 22:35:45 -08:00
// PWM pin
engineConfiguration->etbIo[1].controlPin1 = GPIO_UNASSIGNED;
2019-11-28 22:35:45 -08:00
// DIR pin
engineConfiguration->etbIo[1].directionPin1 = GPIOB_8;
engineConfiguration->etbIo[1].directionPin2 = GPIOB_9;
2019-11-20 21:49:38 -08:00
2019-11-20 21:19:35 -08:00
engineConfiguration->injectionPins[0] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[1] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
2019-11-20 21:19:35 -08:00
engineConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[7] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
engineConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
2019-11-20 21:19:35 -08:00
2019-11-01 19:56:58 -07:00
}
2019-11-18 20:45:35 -08:00
2020-02-19 19:34:51 -08:00
/**
* set engine_type 63
2020-02-23 06:16:11 -08:00
*
2020-03-06 21:45:45 -08:00
* https://github.com/mck1117/proteus/blob/master/readme_pinout.md
*
2020-02-23 06:16:11 -08:00
* black#3 : orange : injector #1
* black#4 : blue : injector #3
* black#5 : white : injector #5
* black#6 : green : injector #6
* black#7 : orange : injector #7
* black#8 : blue : injector #9
* black#9 : white : injector #11
* black#15: blue : injector #2
* black#16: white : injector #4
* black#19: green : injector #8
* black#20: : injector #10
* black#21: : injector #12
*
*
* small#5 : : VR1 pos
2020-02-23 21:20:36 -08:00
* small#8 : blue : ETB1-
2020-02-23 06:16:11 -08:00
* small#13: blue : VR1 neg
* small#15: orange : ETB1+
* small#18: red : ignition power / ECU power source
* small#19: black : GND
* small#21: blue : ETB2-
* small#22: orange : ETB2+
* small#23: red : ETB/high-side power from main relay
*
*
*
* white#9 : orange : +5v
2020-03-06 21:45:45 -08:00
* white#17: green : PPS
2020-02-23 06:16:11 -08:00
* white#18: red
* white#23: black : Sensor Ground
* white#24: red : TPS#1
*
2020-02-19 19:34:51 -08:00
*/
2020-02-01 14:55:58 -08:00
void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
2020-02-19 19:34:51 -08:00
// 12 injectors defined in boards/proteus/board_configuration.cpp
2020-03-06 21:45:45 -08:00
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_4;
2020-02-19 19:34:51 -08:00
2020-02-27 00:29:03 -08:00
// set vbatt_divider 8.16
// engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f) * 16.8f / 10.0f;
// todo: figure out exact values from TLE8888 breakout board used by Manhattan
engineConfiguration->vbattDividerCoeff = 7.6;
2020-02-23 06:16:11 -08:00
// TPS#2 = Analog volt
// engineConfiguration->tps2_1AdcChannel = EFI_ADC_;
2020-02-01 14:55:58 -08:00
}