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

156 lines
4.8 KiB
C++
Raw Normal View History

2019-12-26 18:33:12 -08:00
/*
* @file vw_b6.cpp
*
* @date Dec 26, 2019
2020-01-07 21:02:40 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2019-12-26 18:33:12 -08:00
*/
#include "engine.h"
#include "vw_b6.h"
2020-10-12 21:35:04 -07:00
#include "custom_engine.h"
2020-10-21 21:57:11 -07:00
#include "table_helper.h"
2020-10-27 22:01:54 -07:00
#include "map.h"
2019-12-26 18:33:12 -08:00
EXTERN_CONFIG;
/**
* set engine_type 62
2020-08-29 07:06:28 -07:00
* VW_B6
2020-10-12 21:35:04 -07:00
* has to be microRusEFI 0.5.2
2019-12-26 18:33:12 -08:00
*/
2020-08-29 07:06:28 -07:00
void setVwPassatB6(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
2020-10-21 22:48:28 -07:00
#if (BOARD_TLE8888_COUNT > 0)
2020-08-29 07:06:28 -07:00
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->vvtMode = VVT_BOSCH_QUICK_START;
2020-10-22 21:39:22 -07:00
engineConfiguration->map.sensor.type = MT_BOSCH_2_5;
2019-12-26 18:33:12 -08:00
// seting Injectors flow rate equal 1214 cc/min
engineConfiguration->injector.flow = 1214;
// seting pressure to high
engineConfiguration->injectorPressureType = IPT_High;
// setting to Sensed Rail Pressure mode
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
// setting Fuel rail pressure to 10 000 kPa
engineConfiguration->fuelRailPressure = 10000;
//setting "flat" 0.2 ms injector's lag time
setArrayValues(engineConfiguration->injector.battLagCorr, 0.2);
2020-08-29 16:01:44 -07:00
strcpy(CONFIG(engineMake), ENGINE_MAKE_VAG);
strcpy(CONFIG(engineCode), "BPY");
2020-08-29 14:05:54 -07:00
engineConfiguration->verboseVVTDecoding = true;
2020-08-29 16:01:44 -07:00
engineConfiguration->invertCamVVTSignal = true;
engineConfiguration->vvtCamSensorUseRise = true;
2020-10-12 21:35:04 -07:00
2020-10-17 11:53:56 -07:00
// EFI_ADC_7: "31 - AN volt 3" - PA7
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
2020-10-12 21:35:04 -07:00
2020-10-17 11:53:56 -07:00
// "26 - AN volt 2"
engineConfiguration->highPressureFuel.hwChannel = EFI_ADC_6;
2020-10-31 21:33:18 -07:00
/**
* PSS-140
*/
2020-10-27 22:01:54 -07:00
// todo: calibration
engineConfiguration->highPressureFuel.v1 = 0.5; /* volts */;
2020-10-31 21:33:18 -07:00
engineConfiguration->highPressureFuel.value1 = 0;
2020-10-27 22:01:54 -07:00
engineConfiguration->highPressureFuel.v2 = 4.5; /* volts */;
2020-10-31 21:33:18 -07:00
engineConfiguration->highPressureFuel.value2 = BAR2KPA(140);
2020-10-27 22:01:54 -07:00
2020-10-17 11:53:56 -07:00
// "19 - AN volt 4"
engineConfiguration->lowPressureFuel.hwChannel = EFI_ADC_12;
2020-10-27 22:01:54 -07:00
engineConfiguration->lowPressureFuel.v1 = 0.5; /* volts */;
engineConfiguration->lowPressureFuel.value1 = PSI2KPA(0);
engineConfiguration->lowPressureFuel.v2 = 4.5; /* volts */;
// todo: what's the proper calibration of this Bosch sensor? is it really 200psi?
engineConfiguration->lowPressureFuel.value2 = PSI2KPA(200);
2020-10-12 21:35:04 -07:00
CONFIG(isSdCardEnabled) = false;
CONFIG(mc33816spiDevice) = SPI_DEVICE_3;
setBoschHDEV_5_injectors(PASS_CONFIG_PARAMETER_SIGNATURE);
2020-10-17 17:17:53 -07:00
// RED
2020-10-12 21:35:04 -07:00
engineConfiguration->spi3mosiPin = GPIOC_12;
2020-10-17 17:17:53 -07:00
// YELLOW
2020-10-12 21:35:04 -07:00
engineConfiguration->spi3misoPin = GPIOC_11;
2020-10-17 17:17:53 -07:00
// BROWN
2020-10-12 21:35:04 -07:00
engineConfiguration->spi3sckPin = GPIOC_10;
engineConfiguration->sdCardCsPin = GPIO_UNASSIGNED;
CONFIG(is_enabled_spi_3) = true;
2020-10-17 17:17:53 -07:00
// J8 orange
CONFIG(mc33816_cs) = GPIOB_8;
// J8 Grey
CONFIG(mc33816_rstb) = GPIOA_15;
// J8 Dark BLUE
CONFIG(mc33816_driven) = GPIOB_9;
// J9 violet
CONFIG(mc33816_flag0) = GPIOC_13;
2020-10-12 21:35:04 -07:00
2020-10-17 17:17:53 -07:00
// J10 Dark BLUE
2020-10-12 21:35:04 -07:00
engineConfiguration->injectionPins[0] = GPIOE_6;
2020-10-17 17:17:53 -07:00
// J11 green
2020-10-12 21:35:04 -07:00
engineConfiguration->injectionPins[1] = GPIOE_5;
2020-10-17 17:17:53 -07:00
// J18 grey
engineConfiguration->injectionPins[2] = GPIOB_7;
// J6 white
engineConfiguration->injectionPins[3] = GPIOE_0;
2020-10-19 20:25:23 -07:00
2020-10-21 22:48:28 -07:00
gppwm_channel *lowPressureFuelPumpControl = &engineConfiguration->gppwm[1];
lowPressureFuelPumpControl->pwmFrequency = 20;
lowPressureFuelPumpControl->loadAxis = GPPWM_FuelLoad;
lowPressureFuelPumpControl->dutyIfError = 50;
setTable(lowPressureFuelPumpControl->table, (uint8_t)50);
2020-11-15 17:56:16 -08:00
// "42 - Injector 4", somehow GP4 did not work? not enough current? not happy with diode?
lowPressureFuelPumpControl->pin = TLE8888_PIN_4;
2020-10-21 22:48:28 -07:00
gppwm_channel *coolantControl = &engineConfiguration->gppwm[0];
coolantControl->pwmFrequency = 25;
coolantControl->loadAxis = GPPWM_FuelLoad;
// Volkswage wants 10% for fan to be OFF, between pull-up and low side control we need to invert that value
int value = 100 - 10;
coolantControl->dutyIfError = value;
setTable(coolantControl->table, (uint8_t)value);
2020-10-19 20:25:23 -07:00
// for now I just want to stop radiator whine
// todo: enable cooling!
/*
2020-10-21 22:48:28 -07:00
for (int load = 0; load < GPPWM_LOAD_COUNT; load++) {
2020-10-19 20:25:23 -07:00
for (int r = 0; r < GPPWM_RPM_COUNT; r++) {
2020-10-21 22:48:28 -07:00
engineConfiguration->gppwm[0].table[load][r] = value;
2020-10-19 20:25:23 -07:00
}
}
2020-10-21 22:48:28 -07:00
*/
Tle8888 big update 1 (#1892) * smart gpio: fix tle8888 direct pin mapping for MRE * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 * TLE8888: cleanup * TLE8888: do not reset driver private data on WD/undervoltage reset * TLE8888: diagnostic updates * TLE8888 driver: BIG driver rework * TLE8888: check SPI answers for abnormal states Reply with other than requested register can be a sign of: -Power-On-Reset, then OpStat0 will be replyed -WatchDog reset, then FWDStat1 will be replyed -Invalid communication frame, then Diag0 will be replyed Keep tracking last accessed register and check with the next reply. * TLE8888: debug clean-up * TLE8888: implement spi array write This reduce CS inactive state time between two consequent accesses from 8.8 uS to 1.4 uS * TLE8888: fix PP outputs in OD mode * TLE8888: cleanup register definitions * TLE8888: run separate driver thread for each chip instance Calculating poll interval for few chips become more complex, avoid this running thread for each device. * TLE8888: fix cypress and kinetic compilation Both platforms define its own MAX and cause redifination error if common.h is included in driver. * MRE: update mapping.yaml and fix direct pin mapping for TLE8888 * TLE8888: diagnnostic: disable switch off in case of overcurrent For all output, use current limiting instead * TLE8888: check for overvoltage on OUT8..OUT13 * TLE8888: add TODO note about how to recover from failure condition Currently TLE8888 automaticly recovers only from overcurrent and (may be) overtemperature conditions. Short to bat cause output disable (bit in OECONFIG is reset) and needs driver/host intervention. * TLE8888: save few bytes of RAM * TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888 Don't forget to enable PP mode for TLE8888 outputs 21..24: uncomment line 1087 in tle8888.c * TLE8888: reorder code, cleanup * TLE8888: mode all debug/statisctic to per-chip struct * TLE8888: rework poll interval calculation * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 09:25:30 -07:00
coolantControl->pin = TLE8888_PIN_5; // "3 - Lowside 2"
2020-10-19 20:25:23 -07:00
2020-11-15 12:37:53 -08:00
// "7 - Lowside 1"
engineConfiguration->hpfpValvePin = TLE8888_PIN_6;
2020-10-28 22:15:55 -07:00
// set tps_min 890
engineConfiguration->tpsMin = 890; // convert 12to10 bit (ADC/4)
// set tps_max 70
engineConfiguration->tpsMax = 70; // convert 12to10 bit (ADC/4)
engineConfiguration->etb.pFactor = 5.12;
engineConfiguration->etb.iFactor = 47;
2020-10-28 22:15:55 -07:00
engineConfiguration->etb.dFactor = 0.088;
engineConfiguration->etb.offset = 0;
2020-10-19 20:25:23 -07:00
2020-10-28 15:53:30 -07:00
engineConfiguration->injector.flow = 300;
2020-11-10 21:43:21 -08:00
engineConfiguration->tempHpfpStart = 120;
engineConfiguration->tempHpfpDuration = 30;
2020-10-28 15:53:30 -07:00
2020-10-19 20:25:23 -07:00
engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
engineConfiguration->fanPin = GPIO_UNASSIGNED;
2020-10-21 21:57:11 -07:00
CONFIG(useETBforIdleControl) = true;
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
2020-10-21 22:48:28 -07:00
#endif /* BOARD_TLE8888_COUNT */
2020-08-29 07:06:28 -07:00
}