Initial engine config, and cleanup. (#786)
* Add files via upload Initial Engine Config * Add files via upload Cleanup * Added Can coolant message for newer cars
This commit is contained in:
parent
3c63060dd5
commit
c0ff11a9df
|
@ -1,18 +1,24 @@
|
|||
rem
|
||||
rem STM32F767 version of the firmware for Nucleo-F767ZI board
|
||||
rem VAG-ME7 version of the firmware for F767ZI chip NOT on Red board, with a real oscilattor
|
||||
rem
|
||||
|
||||
cd ../../..
|
||||
set PROJECT_BOARD=ME7_PNP
|
||||
set PROJECT_CPU=ST_STM32F7
|
||||
set PROJECT_BOARD=me7_pnp
|
||||
set PROJECT_CPU=ARCH_STM32F7
|
||||
set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^
|
||||
-DEFI_INJECTOR_PIN3=GPIO_UNASSIGNED ^
|
||||
-DEFI_COMMUNICATION_PIN=GPIOA_2 ^
|
||||
-DEFI_FATAL_ERROR_PIN=GPIOA_5 ^
|
||||
-DCONFIG_RESET_SWITCH_PORT=NULL ^
|
||||
-DEFI_ENABLE_ASSERTS=FALSE ^
|
||||
-DCH_DBG_THREADS_PROFILING=FALSE
|
||||
rem set DEBUG_LEVEL_OPT="-O2"
|
||||
-DEFI_USE_OSC=TRUE ^
|
||||
-DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE
|
||||
set DEBUG_LEVEL_OPT="-O2"
|
||||
make -j4
|
||||
rem TODO fix hex2dfu for F7
|
||||
rem ..\misc\hex2dfu\HEX2DFU.exe build/rusefi.hex -out build/rusefi.dfu
|
||||
if not exist build/rusefi.hex echo FAILED to compile ME7_PNP
|
||||
if not exist build/rusefi.hex exit -1
|
||||
|
||||
..\misc\hex2dfu\HEX2DFU.exe build/rusefi.hex -out build/rusefi.dfu
|
||||
|
||||
rem Clean up so that no one inherits this value
|
||||
set PROJECT_BOARD=
|
||||
set PROJECT_CPU=
|
||||
set EXTRA_PARAMS=
|
||||
set DEBUG_LEVEL_OPT=
|
||||
set USE_BOOTLOADER=
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
# List of all the board related files.
|
||||
BOARDSRC = $(PROJECT_DIR)/config/boards/NUCLEO_F767/board.c
|
||||
BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/ME7_PNP/board_configuration.cpp
|
||||
BOARDSRC = $(PROJECT_DIR)/config/boards/nucleo_f767/board.c
|
||||
BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/me7_pnp/board_configuration.cpp
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(PROJECT_DIR)/config/boards/NUCLEO_F767 $(PROJECT_DIR)/config/stm32f7ems
|
||||
|
||||
LDSCRIPT= $(PROJECT_DIR)/config/boards/NUCLEO_F767/STM32F76xxI.ld
|
||||
|
||||
LDSCRIPT= $(PROJECT_DIR)/config/boards/nucleo_f767/STM32F76xxI.ld
|
||||
|
||||
|
||||
# Override DEFAULT_ENGINE_TYPE
|
||||
DDEFS += -DDEFAULT_ENGINE_TYPE=CUSTOM_ENGINE -DSTM32F767xx
|
||||
DDEFS += -DDEFAULT_ENGINE_TYPE=VAG_18_TURBO -DSTM32F767xx
|
||||
|
|
|
@ -5,49 +5,47 @@
|
|||
*
|
||||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "engine.h"
|
||||
#include "engine_math.h"
|
||||
#include "allsensors.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "smart_gpio.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
void setPinConfigurationOverrides(void) {
|
||||
static void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
}
|
||||
|
||||
void setSerialConfigurationOverrides(void) {
|
||||
boardConfiguration->useSerialPort = true;
|
||||
engineConfiguration->binarySerialTxPin = GPIOD_8;
|
||||
engineConfiguration->binarySerialRxPin = GPIOD_9;
|
||||
engineConfiguration->consoleSerialTxPin = GPIOD_8;
|
||||
engineConfiguration->consoleSerialRxPin = GPIOD_9;
|
||||
// boardConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED;
|
||||
// engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED;
|
||||
|
||||
//UART
|
||||
|
||||
engineConfiguration->binarySerialTxPin = GPIOB_10;
|
||||
engineConfiguration->binarySerialRxPin = GPIOB_11;
|
||||
engineConfiguration->consoleSerialTxPin = GPIOB_10;
|
||||
engineConfiguration->consoleSerialRxPin = GPIOB_11;
|
||||
|
||||
}
|
||||
|
||||
void setSdCardConfigurationOverrides(void) {
|
||||
}
|
||||
void setPinConfigurationOverrides(void) {
|
||||
|
||||
/**
|
||||
* @brief Board-specific configuration code overrides.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void setBoardConfigurationOverrides(void) {
|
||||
setSerialConfigurationOverrides();
|
||||
//NOT USED
|
||||
|
||||
engineConfiguration->runningLedPin = GPIOB_0; //green LED
|
||||
engineConfiguration->warningLedPin = GPIO_UNASSIGNED;
|
||||
#if 0
|
||||
engineConfiguration->vbattAdcChannel = EFI_ADC_13;
|
||||
engineConfiguration->adcVcc = ADC_VCC;
|
||||
#endif
|
||||
engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
|
||||
boardConfiguration->ignitionPins[8] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->ignitionPins[9] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->mainRelayPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->fanPin = GPIO_UNASSIGNED;
|
||||
|
||||
// not used
|
||||
}
|
||||
void setBoardConfigurationOverrides(void) {
|
||||
|
||||
// NOT USED
|
||||
engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
|
||||
engineConfiguration->displayMode = DM_NONE;
|
||||
|
@ -57,22 +55,31 @@ void setBoardConfigurationOverrides(void) {
|
|||
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
|
||||
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
|
||||
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
|
||||
for (int i = 0; i < DIGIPOT_COUNT ; i++) {
|
||||
for (int i = 0; i < DIGIPOT_COUNT; i++) {
|
||||
boardConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED;
|
||||
}
|
||||
boardConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
|
||||
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->boardTestModeJumperPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->acRelayPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
|
||||
boardConfiguration->max31855spiDevice = SPI_NONE;
|
||||
engineConfiguration->warningLedPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->runningLedPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->useStepperIdle = false;
|
||||
boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->stepperEnablePinMode = OM_DEFAULT;
|
||||
boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->isHip9011Enabled = false;
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
boardConfiguration->is_enabled_spi_1 = false;
|
||||
boardConfiguration->is_enabled_spi_2 = false;
|
||||
boardConfiguration->is_enabled_spi_3 = false;
|
||||
}
|
||||
|
||||
void setSdCardConfigurationOverrides(void) {
|
||||
}
|
||||
|
||||
|
|
|
@ -6,3 +6,186 @@
|
|||
*/
|
||||
|
||||
#include "me7pnp.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "engine.h"
|
||||
#include "engine_math.h"
|
||||
#include "allsensors.h"
|
||||
#include "fsio_impl.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "smart_gpio.h"
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
||||
//Base Engine Settings
|
||||
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->trigger.type = TT_60_2_VW;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
|
||||
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
|
||||
engineConfiguration->injector.flow = 205;
|
||||
engineConfiguration->specs.displacement = 1.839;
|
||||
engineConfiguration->globalTriggerAngleOffset = 114;
|
||||
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
||||
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
|
||||
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
||||
boardConfiguration->ignitionPinMode = OM_INVERTED;
|
||||
boardConfiguration->injectionPinMode = OM_OPENDRAIN_INVERTED;
|
||||
engineConfiguration->isCylinderCleanupEnabled = true;
|
||||
engineConfiguration->rpmHardLimit = 8000;
|
||||
engineConfiguration->cranking.baseFuel = 4;
|
||||
|
||||
|
||||
//Analog Inputs
|
||||
|
||||
boardConfiguration->isFastAdcEnabled = true;
|
||||
engineConfiguration->map.sensor.type = MT_GM_3_BAR;
|
||||
setCommonNTCSensor(&engineConfiguration->clt);
|
||||
engineConfiguration->clt.config.bias_resistor = 2700;
|
||||
setCommonNTCSensor(&engineConfiguration->iat);
|
||||
engineConfiguration->iat.config.bias_resistor = 2700;
|
||||
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
|
||||
//engineConfiguration->tpsAdcChannel = PF3; TODO: ADC channel 3
|
||||
engineConfiguration->map.sensor.hwChannel = EFI_ADC_10;
|
||||
engineConfiguration->clt.adcChannel = EFI_ADC_6;
|
||||
//engineConfiguration->iat.adcChannel = PF4; TODO: ADC channel 3
|
||||
engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->vbattAdcChannel = EFI_ADC_4;
|
||||
engineConfiguration->vbattDividerCoeff = ((float) (10.0 + 33)) / 10 * 2;
|
||||
engineConfiguration->cj125ur = EFI_ADC_11;
|
||||
engineConfiguration->cj125ua = EFI_ADC_12;
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_8;
|
||||
|
||||
//CAN Settings
|
||||
|
||||
engineConfiguration->canNbcType = CAN_BUS_NBC_VAG;
|
||||
engineConfiguration->canReadEnabled = true;
|
||||
engineConfiguration->canWriteEnabled = true;
|
||||
boardConfiguration->canDeviceMode = CD_USE_CAN1;
|
||||
boardConfiguration->canTxPin = GPIOB_6;
|
||||
boardConfiguration->canRxPin = GPIOB_12;
|
||||
|
||||
// Injectors
|
||||
|
||||
boardConfiguration->injectionPins[0] = GPIOE_4; // #1
|
||||
boardConfiguration->injectionPins[1] = GPIOE_2; // #2
|
||||
boardConfiguration->injectionPins[2] = GPIOE_3; // #3
|
||||
boardConfiguration->injectionPins[3] = GPIOE_1; // #4
|
||||
boardConfiguration->injectionPins[4] = GPIOE_6; // #5
|
||||
boardConfiguration->injectionPins[5] = GPIOE_5; // #6
|
||||
boardConfiguration->injectionPins[6] = GPIOB_9; // #7
|
||||
boardConfiguration->injectionPins[7] = GPIOE_0; // #8
|
||||
|
||||
//Ignition Outputs
|
||||
|
||||
boardConfiguration->ignitionPins[0] = GPIOD_1; // #1
|
||||
boardConfiguration->ignitionPins[1] = GPIOD_6; // #2
|
||||
boardConfiguration->ignitionPins[2] = GPIOD_3; // #3
|
||||
boardConfiguration->ignitionPins[3] = GPIOD_4; // #4
|
||||
boardConfiguration->ignitionPins[4] = GPIOD_0; // #5
|
||||
boardConfiguration->ignitionPins[5] = GPIOD_2; // #6
|
||||
boardConfiguration->ignitionPins[6] = GPIOA_15; // #7
|
||||
boardConfiguration->ignitionPins[7] = GPIOC_12; // #8
|
||||
|
||||
//SPI Settings
|
||||
boardConfiguration->is_enabled_spi_1 = true;
|
||||
boardConfiguration->is_enabled_spi_2 = true;
|
||||
boardConfiguration->is_enabled_spi_3 = false;
|
||||
engineConfiguration->tle8888spiDevice = SPI_DEVICE_1;
|
||||
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
|
||||
boardConfiguration->cj125CsPin = GPIOB_11;
|
||||
|
||||
//Digital Inputs/Outputs
|
||||
|
||||
boardConfiguration->fuelPumpPin = TLE8888_PIN_22;
|
||||
boardConfiguration->mainRelayPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->fanPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->clutchDownPin = GPIOD_11;
|
||||
engineConfiguration->brakePedalPin = GPIOE_10;
|
||||
engineConfiguration->camInput = GPIOA_2;
|
||||
boardConfiguration->triggerInputPins[0] = GPIOG_7;
|
||||
boardConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
|
||||
boardConfiguration->tachOutputPin = TLE8888_PIN_16;
|
||||
|
||||
|
||||
//Alternator Settings
|
||||
boardConfiguration->alternatorControlPin = TLE8888_PIN_17;
|
||||
boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
|
||||
engineConfiguration->targetVBatt = 13.8;
|
||||
engineConfiguration->alternatorControl.offset = 40;
|
||||
engineConfiguration->alternatorControl.pFactor = 14;
|
||||
engineConfiguration->alternatorControl.iFactor = 0.1;
|
||||
engineConfiguration->alternatorControl.dFactor = 0;
|
||||
engineConfiguration->alternatorControl.periodMs = 10;
|
||||
|
||||
//ETB Settings
|
||||
|
||||
#if EFI_FSIO
|
||||
setFsio (12, GPIOF_12, "0" PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
setFsio (14, GPIOF_13, "1" PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
setFsioExt (3, GPIOE_0, "0.15 90 coolant 120 min max 90 - 30 / 0.8 * +", 25 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
engineConfiguration->auxPidFrequency[3] = 25;
|
||||
CONFIG(etb1_use_two_wires) = true;
|
||||
CONFIGB(etb1.directionPin1) = GPIOF_15;
|
||||
CONFIGB(etb1.directionPin2) = GPIOF_14;
|
||||
boardConfiguration->isHip9011Enabled = false;
|
||||
|
||||
#if EFI_FSIO
|
||||
setFsio (13, GPIOE_5, "0" PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
setFsio (15, GPIOE_6, "1" PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
CONFIG(etb2_use_two_wires) = true;
|
||||
CONFIG(etb2.directionPin1) = GPIOE_2;
|
||||
CONFIG(etb2.directionPin2) = GPIOE_4;
|
||||
|
||||
engineConfiguration->etb.pFactor = 1.07;
|
||||
engineConfiguration->etb.iFactor = 0.18;
|
||||
engineConfiguration->etb.dFactor = 0.24;
|
||||
engineConfiguration->etb.offset = 80;
|
||||
engineConfiguration->etb_iTermMin = -300;
|
||||
engineConfiguration->etb_iTermMax = 300;
|
||||
|
||||
// VVT Settings
|
||||
|
||||
engineConfiguration->auxPidPins[0] = TLE8888_PIN_6; // VVT solenoid control
|
||||
engineConfiguration->activateAuxPid1 = true;
|
||||
engineConfiguration->auxPidFrequency[0] = 300;
|
||||
boardConfiguration->fsio_setting[0] = 0.0;
|
||||
engineConfiguration->auxPid[0].pFactor = 2;
|
||||
engineConfiguration->auxPid[0].iFactor = 0.005;
|
||||
engineConfiguration->auxPid[0].dFactor = 0;
|
||||
engineConfiguration->auxPid[0].offset = 33;
|
||||
engineConfiguration->auxPid[0].minValue = 24;
|
||||
engineConfiguration->auxPid[0].maxValue = 44;
|
||||
engineConfiguration->auxPidFrequency[0] = 300;
|
||||
boardConfiguration->fsio_setting[0] = 0.0;
|
||||
|
||||
|
||||
//AC Settings
|
||||
//Configuration 1 : bidirectional Wire
|
||||
//Configuration 2 : Over CAN with variable Kompressor(CAN: Input=B_sacc,B_skoc Output: B_kov)
|
||||
//Configuration 3 : 2 Wires
|
||||
|
||||
boardConfiguration->acRelayPin = GPIO_UNASSIGNED;
|
||||
engineConfiguration->acCutoffLowRpm = 400;
|
||||
engineConfiguration->acCutoffHighRpm = 4500;
|
||||
engineConfiguration->acIdleRpmBump = 200;
|
||||
// TODO: AC driver request input PE13 and AC compressor input-output PE7
|
||||
|
||||
//Cruise Control
|
||||
//TODO: Implement Criuse Control
|
||||
|
||||
//TODO: Thermostat Control TLE8888_PIN_5
|
||||
|
||||
//TODO: N75 Boost Control TLE8888_PIN_21
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -205,6 +205,10 @@ static void canDashboardVAG(void) {
|
|||
commonTxInit(CAN_VAG_CLT);
|
||||
setShortValue(&txmsg, (int) ((engine->sensors.clt + 48.373) / 0.75), 1); //Coolant Temp
|
||||
sendCanMessage();
|
||||
|
||||
commonTxInit(CAN_VAG_CLT_V2);
|
||||
setShortValue(&txmsg, (int) ((engine->sensors.clt + 48.373) / 0.75), 4); //Coolant Temp
|
||||
sendCanMessage();
|
||||
}
|
||||
|
||||
static void canInfoNBCBroadcast(can_nbc_e typeOfNBC) {
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
// https://wiki.openstreetmap.org/wiki/VW-CAN
|
||||
#define CAN_VAG_RPM 0x280
|
||||
#define CAN_VAG_CLT 0x288
|
||||
#define CAN_VAG_CLT_V2 0x420
|
||||
|
||||
|
||||
void initCan(void);
|
||||
void commonTxInit(int eid);
|
||||
|
|
Loading…
Reference in New Issue