2021-08-03 02:22:35 -07:00
|
|
|
/**
|
|
|
|
* @file boards/hellen/hellen121nissan/board_configuration.cpp
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @brief Configuration defaults for the hellen121nissan board
|
|
|
|
*
|
|
|
|
* See https://rusefi.com/s/hellen121nissan
|
|
|
|
*
|
|
|
|
* @author andreika <prometheus.pcb@gmail.com>
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
|
|
|
*/
|
|
|
|
|
2021-08-04 16:30:52 -07:00
|
|
|
#include "pch.h"
|
2021-08-03 02:22:35 -07:00
|
|
|
#include "fsio_impl.h"
|
2021-09-29 08:47:04 -07:00
|
|
|
#include "custom_engine.h"
|
2021-08-03 02:22:35 -07:00
|
|
|
|
|
|
|
static void hellenWbo() {
|
|
|
|
engineConfiguration->enableAemXSeries = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setInjectorPins() {
|
2021-10-09 13:51:07 -07:00
|
|
|
engineConfiguration->injectionPins[0] = H144_LS_1;
|
|
|
|
engineConfiguration->injectionPins[1] = H144_LS_2;
|
|
|
|
engineConfiguration->injectionPins[2] = H144_LS_3;
|
|
|
|
engineConfiguration->injectionPins[3] = H144_LS_4;
|
2021-08-03 02:22:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
// Disable remainder
|
2021-10-09 13:51:07 -07:00
|
|
|
for (int i = 4; i < MAX_CYLINDER_COUNT;i++) {
|
2021-08-03 02:22:35 -07:00
|
|
|
engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
|
|
|
|
}
|
|
|
|
|
|
|
|
engineConfiguration->injectionPinMode = OM_DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setIgnitionPins() {
|
|
|
|
engineConfiguration->ignitionPins[0] = GPIOC_13;
|
|
|
|
engineConfiguration->ignitionPins[1] = GPIOE_5;
|
|
|
|
engineConfiguration->ignitionPins[2] = GPIOE_4;
|
|
|
|
engineConfiguration->ignitionPins[3] = GPIOE_3;
|
|
|
|
|
|
|
|
// disable remainder
|
2021-10-09 13:51:07 -07:00
|
|
|
for (int i = 4; i < MAX_CYLINDER_COUNT; i++) {
|
2021-08-03 02:22:35 -07:00
|
|
|
engineConfiguration->ignitionPins[i] = GPIO_UNASSIGNED;
|
|
|
|
}
|
|
|
|
|
|
|
|
engineConfiguration->ignitionPinMode = OM_DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setupVbatt() {
|
|
|
|
// 4.7k high side/4.7k low side = 2.0 ratio divider
|
|
|
|
engineConfiguration->analogInputDividerCoefficient = 2.0f;
|
|
|
|
|
|
|
|
// set vbatt_divider 5.835
|
|
|
|
// 33k / 6.8k
|
|
|
|
engineConfiguration->vbattDividerCoeff = (33 + 6.8) / 6.8; // 5.835
|
|
|
|
|
|
|
|
// pin input +12 from Main Relay
|
|
|
|
engineConfiguration->vbattAdcChannel = EFI_ADC_5; // 4T
|
|
|
|
|
|
|
|
engineConfiguration->adcVcc = 3.29f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setupDefaultSensorInputs() {
|
|
|
|
// trigger inputs
|
|
|
|
engineConfiguration->triggerInputPins[0] = GPIOB_1;
|
|
|
|
engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
|
|
|
|
// Direct hall-only cam input
|
|
|
|
engineConfiguration->camInputs[0] = GPIOA_6;
|
|
|
|
engineConfiguration->camInputs[1 * CAMS_PER_BANK] = GPIOA_7;
|
|
|
|
|
|
|
|
engineConfiguration->tps1_1AdcChannel = EFI_ADC_4;
|
|
|
|
engineConfiguration->tps1_2AdcChannel = EFI_ADC_8;
|
|
|
|
|
|
|
|
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_3;
|
|
|
|
engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_14;
|
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_10;
|
|
|
|
engineConfiguration->map.sensor.hwChannel = EFI_ADC_11;
|
|
|
|
|
|
|
|
engineConfiguration->afr.hwChannel = EFI_ADC_1;
|
|
|
|
|
|
|
|
engineConfiguration->clt.adcChannel = EFI_ADC_12;
|
|
|
|
|
|
|
|
engineConfiguration->iat.adcChannel = EFI_ADC_13;
|
|
|
|
|
|
|
|
engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE;
|
|
|
|
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setBoardConfigOverrides(void) {
|
2021-09-29 08:47:04 -07:00
|
|
|
setHellen144LedPins();
|
2021-08-03 02:22:35 -07:00
|
|
|
setupVbatt();
|
|
|
|
setSdCardConfigurationOverrides();
|
|
|
|
|
|
|
|
engineConfiguration->clt.config.bias_resistor = 4700;
|
|
|
|
engineConfiguration->iat.config.bias_resistor = 4700;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setPinConfigurationOverrides(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void setSerialConfigurationOverrides(void) {
|
|
|
|
engineConfiguration->useSerialPort = false;
|
|
|
|
engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED;
|
|
|
|
// engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED;
|
|
|
|
// engineConfiguration->consoleSerialRxPin = GPIO_UNASSIGNED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Board-specific configuration defaults.
|
|
|
|
*
|
|
|
|
* See also setDefaultEngineConfiguration
|
|
|
|
*
|
|
|
|
* @todo Add your board-specific code, if any.
|
|
|
|
*/
|
|
|
|
void setBoardDefaultConfiguration(void) {
|
|
|
|
setInjectorPins();
|
|
|
|
setIgnitionPins();
|
|
|
|
|
|
|
|
engineConfiguration->displayLogicLevelsInEngineSniffer = true;
|
|
|
|
engineConfiguration->isSdCardEnabled = true;
|
|
|
|
|
|
|
|
CONFIG(enableSoftwareKnock) = true;
|
|
|
|
CONFIG(canNbcType) = CAN_BUS_NISSAN_VQ;
|
|
|
|
|
2021-10-09 13:51:07 -07:00
|
|
|
engineConfiguration->canTxPin = H176_CAN_TX;
|
|
|
|
engineConfiguration->canRxPin = H176_CAN_RX;
|
2021-08-03 02:22:35 -07:00
|
|
|
|
|
|
|
// engineConfiguration->fuelPumpPin = GPIOG_2; // OUT_IO9
|
|
|
|
// engineConfiguration->idle.solenoidPin = GPIOD_14; // OUT_PWM5
|
|
|
|
// engineConfiguration->fanPin = GPIOD_12; // OUT_PWM8
|
|
|
|
engineConfiguration->mainRelayPin = GPIOG_14; // pin: 111a, OUT_IO3
|
|
|
|
|
|
|
|
// "required" hardware is done - set some reasonable defaults
|
|
|
|
setupDefaultSensorInputs();
|
|
|
|
|
|
|
|
engineConfiguration->etbIo[0].directionPin1 = GPIOD_15; // out_pwm7
|
|
|
|
engineConfiguration->etbIo[0].directionPin2 = GPIOD_14; // out_pwm6
|
|
|
|
engineConfiguration->etbIo[0].controlPin = GPIOD_13; // ETB_EN out_pwm1
|
|
|
|
CONFIG(etb_use_two_wires) = true;
|
|
|
|
|
|
|
|
// Some sensible defaults for other options
|
|
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
|
|
|
|
|
|
|
engineConfiguration->vvtCamSensorUseRise = true;
|
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
|
|
|
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
|
|
|
|
|
|
|
|
|
2021-10-09 13:51:07 -07:00
|
|
|
// 2010-2012 315cc at 43.5psi
|
|
|
|
// fuel system is fixed pressure 55psi
|
|
|
|
// 2013+ 450cc at 43.5
|
|
|
|
// fuel system is fixed pressure 85psi
|
|
|
|
// flow rate P2 = flow rate P1 * sqrt(P2/P1)
|
|
|
|
engineConfiguration->injector.flow = 354.19; // https://www.google.com/search?q=315*sqrt%2855%2F43.5%29
|
2021-10-09 14:09:11 -07:00
|
|
|
engineConfiguration->fuelReferencePressure = PSI2KPA(55);
|
2021-10-09 13:51:07 -07:00
|
|
|
// todo: split engine generations
|
|
|
|
engineConfiguration->injector.flow = 629.03; // https://www.google.com/search?q=450*sqrt%2885%2F43.5%29
|
2021-10-09 14:09:11 -07:00
|
|
|
engineConfiguration->fuelReferencePressure = PSI2KPA(85);
|
2021-08-03 02:22:35 -07:00
|
|
|
|
2021-10-09 13:51:07 -07:00
|
|
|
engineConfiguration->injectorCompensationMode = ICM_FixedRailPressure;
|
|
|
|
|
|
|
|
engineConfiguration->specs.cylindersCount = 4;
|
|
|
|
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
|
|
|
|
engineConfiguration->specs.displacement = 1.998;
|
|
|
|
strcpy(CONFIG(engineMake), ENGINE_MAKE_Hyundai);
|
|
|
|
strcpy(CONFIG(engineCode), "Theta II");
|
2021-08-03 02:22:35 -07:00
|
|
|
|
|
|
|
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK
|
|
|
|
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
|
|
|
engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL;
|
|
|
|
|
|
|
|
hellenWbo();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Board-specific SD card configuration code overrides. Needed by bootloader code.
|
|
|
|
* @todo Add your board-specific code, if any.
|
|
|
|
*/
|
|
|
|
void setSdCardConfigurationOverrides(void) {
|
|
|
|
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_3;
|
|
|
|
|
|
|
|
engineConfiguration->spi3mosiPin = GPIOC_12;
|
|
|
|
engineConfiguration->spi3misoPin = GPIOC_11;
|
|
|
|
engineConfiguration->spi3sckPin = GPIOC_10;
|
|
|
|
engineConfiguration->sdCardCsPin = GPIOA_15;
|
|
|
|
|
|
|
|
// engineConfiguration->spi2mosiPin = GPIOB_15;
|
|
|
|
// engineConfiguration->spi2misoPin = GPIOB_14;
|
|
|
|
// engineConfiguration->spi2sckPin = GPIOB_13;
|
|
|
|
// engineConfiguration->sdCardCsPin = GPIOB_12;
|
|
|
|
CONFIG(is_enabled_spi_3) = true;
|
|
|
|
}
|