4 chan
This commit is contained in:
parent
8f17fdc502
commit
52209e36c5
|
@ -0,0 +1,27 @@
|
|||
# Combine the related files for a specific platform and MCU.
|
||||
|
||||
# Target ECU board design
|
||||
BOARDCPPSRC = $(BOARDS_DIR)/hellen/alphax-4chan/board_configuration.cpp
|
||||
BOARDINC = $(BOARDS_DIR)/hellen/alphax-4chan
|
||||
|
||||
# 144 package MCU
|
||||
ifeq ($(LED_CRITICAL_ERROR_BRAIN_PIN),)
|
||||
LED_CRITICAL_ERROR_BRAIN_PIN = -DLED_CRITICAL_ERROR_BRAIN_PIN=H144_LED1_RED
|
||||
endif
|
||||
|
||||
DDEFS += -DEFI_MAIN_RELAY_CONTROL=TRUE
|
||||
|
||||
DDEFS += -DTS_NO_SECONDARY
|
||||
|
||||
# Add them all together
|
||||
DDEFS += -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"AlphaX-4chan\" $(LED_CRITICAL_ERROR_BRAIN_PIN) $(LED_COMMUNICATION_BRAIN_PIN)
|
||||
DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE
|
||||
DDEFS += -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE
|
||||
# todo: is it broken?
|
||||
DDEFS += -DEFI_LOGIC_ANALYZER=FALSE
|
||||
|
||||
# Enable serial pins on expansion header
|
||||
DDEFS += -DEFI_CONSOLE_TX_BRAIN_PIN=GPIOD_6 -DEFI_CONSOLE_RX_BRAIN_PIN=GPIOD_5 -DTS_PRIMARY_PORT=UARTD2 -DSTM32_UART_USE_USART2=1
|
||||
|
||||
include $(BOARDS_DIR)/hellen/hellen-common.mk
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* @file boards/hellen/hellen-nb1/board_configuration.cpp
|
||||
*
|
||||
*
|
||||
* @brief Configuration defaults for the hellen-nb1 board
|
||||
*
|
||||
* See http://rusefi.com/s/hellenNB1
|
||||
*
|
||||
* @author andreika <prometheus.pcb@gmail.com>
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "custom_engine.h"
|
||||
#include "hellen_meta.h"
|
||||
|
||||
static OutputPin alphaEn;
|
||||
static OutputPin alphaTachPullUp;
|
||||
static OutputPin alphaTempPullUp;
|
||||
static OutputPin alphaCrankPPullUp;
|
||||
static OutputPin alphaCrankNPullUp;
|
||||
|
||||
static void setInjectorPins() {
|
||||
engineConfiguration->injectionPins[0] = H144_LS_1;
|
||||
engineConfiguration->injectionPins[1] = H144_LS_2;
|
||||
engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
|
||||
engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
|
||||
|
||||
// Disable remainder
|
||||
for (int i = 4; i < MAX_CYLINDER_COUNT;i++) {
|
||||
engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
|
||||
}
|
||||
|
||||
engineConfiguration->injectionPinMode = OM_DEFAULT;
|
||||
|
||||
engineConfiguration->clutchDownPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->clutchDownPinMode = PI_PULLDOWN;
|
||||
engineConfiguration->launchActivationMode = CLUTCH_INPUT_LAUNCH;
|
||||
engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
|
||||
}
|
||||
|
||||
static void setIgnitionPins() {
|
||||
engineConfiguration->ignitionPins[0] = H144_IGN_1;
|
||||
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
||||
engineConfiguration->ignitionPins[2] = H144_IGN_2;
|
||||
engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
|
||||
|
||||
// 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
|
||||
|
||||
engineConfiguration->vbattAdcChannel = H144_IN_VBATT;
|
||||
|
||||
engineConfiguration->adcVcc = 3.29f;
|
||||
}
|
||||
|
||||
static void setupDefaultSensorInputs() {
|
||||
// trigger inputs, hall
|
||||
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
|
||||
engineConfiguration->triggerInputPins[1] = H144_IN_CAM;
|
||||
engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
|
||||
engineConfiguration->camInputs[0] = GPIO_UNASSIGNED;
|
||||
|
||||
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;
|
||||
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
|
||||
|
||||
engineConfiguration->mafAdcChannel = H144_IN_MAP1;
|
||||
engineConfiguration->map.sensor.hwChannel = H144_IN_MAP2;
|
||||
engineConfiguration->baroSensor.type = MT_MPXH6400;
|
||||
engineConfiguration->baroSensor.hwChannel = H144_IN_MAP3;
|
||||
|
||||
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 boardInitHardware() {
|
||||
alphaEn.initPin("a-EN", H144_OUT_IO3);
|
||||
alphaEn.setValue(1);
|
||||
|
||||
alphaTachPullUp.initPin("a-tach", H144_OUT_IO1);
|
||||
alphaTempPullUp.initPin("a-temp", H144_OUT_IO4);
|
||||
alphaCrankPPullUp.initPin("a-crank-p", H144_OUT_IO2);
|
||||
alphaCrankNPullUp.initPin("a-crank-n", H144_OUT_IO5);
|
||||
boardOnConfigurationChange(nullptr);
|
||||
}
|
||||
|
||||
void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration*/) {
|
||||
alphaTachPullUp.setValue(engineConfiguration->boardUseTachPullUp);
|
||||
alphaTempPullUp.setValue(engineConfiguration->boardUseTempPullUp);
|
||||
alphaCrankPPullUp.setValue(engineConfiguration->boardUseCrankPullUp);
|
||||
alphaCrankNPullUp.setValue(engineConfiguration->boardUseCrankPullUp);
|
||||
}
|
||||
|
||||
void setBoardConfigOverrides() {
|
||||
setHellen144LedPins();
|
||||
setupVbatt();
|
||||
setSdCardConfigurationOverrides();
|
||||
|
||||
engineConfiguration->clt.config.bias_resistor = 4700;
|
||||
engineConfiguration->iat.config.bias_resistor = 4700;
|
||||
|
||||
engineConfiguration->canTxPin = GPIOD_1;
|
||||
engineConfiguration->canRxPin = GPIOD_0;
|
||||
}
|
||||
|
||||
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->acSwitch = GPIO_UNASSIGNED;
|
||||
engineConfiguration->fuelPumpPin = H144_OUT_PWM2;
|
||||
engineConfiguration->fanPin = H144_OUT_PWM4;
|
||||
engineConfiguration->mainRelayPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->tachOutputPin = H144_OUT_PWM3;
|
||||
|
||||
// "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;
|
||||
|
||||
engineConfiguration->clutchDownPin = H144_IN_D_2;
|
||||
engineConfiguration->clutchDownPinMode = PI_PULLDOWN;
|
||||
engineConfiguration->launchActivationMode = CLUTCH_INPUT_LAUNCH;
|
||||
// ? engineConfiguration->malfunctionIndicatorPin = GPIOG_4; //1E - Check Engine Light
|
||||
setHellenDefaultVrThresholds();
|
||||
engineConfiguration->vrThreshold[0].pin = H144_OUT_PWM6;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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_2;
|
||||
|
||||
engineConfiguration->spi2mosiPin = H_SPI2_MOSI;
|
||||
engineConfiguration->spi2misoPin = H_SPI2_MISO;
|
||||
engineConfiguration->spi2sckPin = H_SPI2_SCK;
|
||||
engineConfiguration->sdCardCsPin = H_SPI2_CS;
|
||||
engineConfiguration->is_enabled_spi_2 = true;
|
||||
}
|
||||
|
||||
void boardPrepareForStop() {
|
||||
// Wake on the CAN RX pin
|
||||
palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PROJECT_BOARD=hellen/alphax-4chan
|
||||
export PROJECT_CPU=ARCH_STM32F4
|
||||
export EXTRA_PARAMS="-DSHORT_BOARD_NAME=alphax-4chan"
|
||||
|
||||
cd ..
|
||||
bash ../common_make.sh
|
|
@ -0,0 +1 @@
|
|||
#include "../hellen_knock_config.h"
|
Loading…
Reference in New Issue