174 lines
5.5 KiB
C++
174 lines
5.5 KiB
C++
/**
|
|
* @file boards/hellen/hellen64_miataNA6_94/board_configuration.cpp
|
|
*
|
|
*
|
|
* @brief Configuration defaults for the hellen64_miataNA6_94 board
|
|
*
|
|
* See https://rusefi.com/s/hellenNA6
|
|
*
|
|
* @author andreika <prometheus.pcb@gmail.com>
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
|
*/
|
|
|
|
#include "pch.h"
|
|
#include "custom_engine.h"
|
|
#include "hellen_meta.h"
|
|
|
|
static void setInjectorPins() {
|
|
engineConfiguration->injectionPins[0] = H176_LS_1;
|
|
engineConfiguration->injectionPins[1] = GPIOG_8;
|
|
engineConfiguration->injectionPins[2] = GPIOD_11;
|
|
engineConfiguration->injectionPins[3] = GPIOD_10;
|
|
|
|
// Disable remainder
|
|
for (int i = 4; i < MAX_CYLINDER_COUNT;i++) {
|
|
engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
|
|
}
|
|
|
|
engineConfiguration->injectionPinMode = OM_DEFAULT;
|
|
|
|
engineConfiguration->clutchDownPin = GPIOC_4; // Clutch switch input
|
|
engineConfiguration->clutchDownPinMode = PI_PULLDOWN;
|
|
engineConfiguration->launchActivationMode = CLUTCH_INPUT_LAUNCH;
|
|
engineConfiguration->malfunctionIndicatorPin = GPIOG_4; //1E - Check Engine Light
|
|
}
|
|
|
|
static void setIgnitionPins() {
|
|
engineConfiguration->ignitionPins[0] = GPIOI_8; // 3F - IGN_1 (1&4)
|
|
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED ; // GPIOE_4
|
|
engineConfiguration->ignitionPins[2] = GPIOE_5; // 3I - IGN_2 (2&3)
|
|
engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; // GPIOE_3
|
|
|
|
//engineConfiguration->ignitionPins[4] = GPIOE_2;
|
|
//engineConfiguration->ignitionPins[5] = GPIOI_5;
|
|
//engineConfiguration->ignitionPins[6] = GPIOI_6;
|
|
//engineConfiguration->ignitionPins[7] = GPIOI_7;
|
|
|
|
// disable remainder
|
|
for (int i = 4; i < MAX_CYLINDER_COUNT; i++) {
|
|
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, hall
|
|
engineConfiguration->triggerInputPins[0] = GPIOA_6;
|
|
engineConfiguration->triggerInputPins[1] = GPIOB_1;
|
|
engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
|
|
engineConfiguration->camInputs[0] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->tps1_1AdcChannel = EFI_ADC_4;
|
|
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
|
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_10;
|
|
engineConfiguration->map.sensor.hwChannel = EFI_ADC_11;
|
|
|
|
engineConfiguration->afr.hwChannel = EFI_ADC_1;
|
|
|
|
engineConfiguration->clt.adcChannel = H144_IN_CLT;
|
|
|
|
engineConfiguration->iat.adcChannel = H144_IN_IAT;
|
|
|
|
engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE;
|
|
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
|
|
}
|
|
|
|
void setBoardConfigOverrides() {
|
|
setHellen176LedPins();
|
|
setupVbatt();
|
|
setSdCardConfigurationOverrides();
|
|
|
|
engineConfiguration->clt.config.bias_resistor = 4700;
|
|
engineConfiguration->iat.config.bias_resistor = 4700;
|
|
|
|
engineConfiguration->canTxPin = H176_CAN_TX;
|
|
engineConfiguration->canRxPin = H176_CAN_RX;
|
|
}
|
|
|
|
void setSerialConfigurationOverrides() {
|
|
engineConfiguration->useSerialPort = false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Board-specific configuration defaults.
|
|
*
|
|
* See also setDefaultEngineConfiguration
|
|
*
|
|
* @todo Add your board-specific code, if any.
|
|
*/
|
|
void setBoardDefaultConfiguration() {
|
|
setInjectorPins();
|
|
setIgnitionPins();
|
|
|
|
engineConfiguration->isSdCardEnabled = true;
|
|
|
|
engineConfiguration->enableSoftwareKnock = true;
|
|
|
|
// these stm32 pins do not match hellen_meta, is that because hellenNA6 is not using latest MCU version?
|
|
engineConfiguration->acRelayPin = GPIOH_15; // 1J - AC Relay
|
|
engineConfiguration->fuelPumpPin = GPIOG_2; // OUT_IO9
|
|
engineConfiguration->idle.solenoidPin = GPIOD_14; // OUT_PWM5
|
|
engineConfiguration->fanPin = GPIOD_12; // OUT_PWM8
|
|
engineConfiguration->mainRelayPin = GPIOI_2; // OUT_LOW3
|
|
engineConfiguration->tachOutputPin = GPIOI_0;
|
|
engineConfiguration->malfunctionIndicatorPin = GPIOG_9;
|
|
|
|
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;
|
|
|
|
// "required" hardware is done - set some reasonable defaults
|
|
setupDefaultSensorInputs();
|
|
|
|
// Some sensible defaults for other options
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
|
setAlgorithm(LM_SPEED_DENSITY);
|
|
|
|
engineConfiguration->specs.cylindersCount = 4;
|
|
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
|
|
|
|
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK
|
|
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
|
engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL;
|
|
}
|
|
|
|
/**
|
|
* @brief Board-specific SD card configuration code overrides. Needed by bootloader code.
|
|
* @todo Add your board-specific code, if any.
|
|
*/
|
|
void setSdCardConfigurationOverrides() {
|
|
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;
|
|
engineConfiguration->is_enabled_spi_3 = true;
|
|
}
|