From ca37f4909f0f0d2ffbd031479f1f9dae218ccb63 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 18 Apr 2021 10:15:06 -0400 Subject: [PATCH] hellen64 scripts and pinout #2565 --- .../!compile_hellenNA6.bat | 2 + .../hellen/hellen64_miataNA6_94/board.h | 331 ++++++++++++++++++ .../hellen/hellen64_miataNA6_94/board.mk | 42 +++ .../board_configuration.cpp | 189 ++++++++++ .../hellen64_miataNA6_94/compile_hellenNA6.sh | 8 + .../hellen/hellen64_miataNA6_94/prepend.txt | 24 ++ 6 files changed, 596 insertions(+) create mode 100644 firmware/config/boards/hellen/hellen64_miataNA6_94/!compile_hellenNA6.bat create mode 100644 firmware/config/boards/hellen/hellen64_miataNA6_94/board.h create mode 100644 firmware/config/boards/hellen/hellen64_miataNA6_94/board.mk create mode 100644 firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp create mode 100644 firmware/config/boards/hellen/hellen64_miataNA6_94/compile_hellenNA6.sh create mode 100644 firmware/config/boards/hellen/hellen64_miataNA6_94/prepend.txt diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/!compile_hellenNA6.bat b/firmware/config/boards/hellen/hellen64_miataNA6_94/!compile_hellenNA6.bat new file mode 100644 index 0000000000..d260b050a9 --- /dev/null +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/!compile_hellenNA6.bat @@ -0,0 +1,2 @@ +@echo off +bash.exe compile_hellen72.sh diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/board.h b/firmware/config/boards/hellen/hellen64_miataNA6_94/board.h new file mode 100644 index 0000000000..f3f92e5fae --- /dev/null +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/board.h @@ -0,0 +1,331 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * This file has been automatically generated using ChibiStudio board + * generator plugin. Do not edit manually. + */ + +#ifndef BOARD_H +#define BOARD_H + + +/* + * Setup for STMicroelectronics STM32F4-Discovery board. + */ + +/* + * Board identifier. + */ +#define BOARD_NAME "Hellen72" + +#define EFI_USB_AF 10U +#define EFI_USB_SERIAL_DM GPIOA_11 +#define EFI_USB_SERIAL_DP GPIOA_12 + +// Ignore USB VBUS pin (we're never a host, only a device) +#define BOARD_OTG_NOVBUSSENS TRUE + +/* + * Default to input mode, with internal PULLDOWN resistor enabled. + * Pulldowns are more safe because most of MCU outputs on Hellen are high-active. + */ +#define EFI_PIN_MODE_DEFAULT PIN_MODE_INPUT +#define EFI_DR_DEFAULT PIN_PUPDR_PULLDOWN + +// See https://github.com/rusefi/rusefi/issues/397 +#define DEFAULT_GPIO_SPEED PIN_OSPEED_HIGH + +/* + * Board oscillators-related settings. + * NOTE: LSE not fitted. + */ +#if !defined(STM32_LSECLK) +#define STM32_LSECLK 32768U +#endif + +#if !defined(STM32_HSECLK) +#define STM32_HSECLK 8000000U +#endif + +/* + * Board voltages. + * Required for performance limits calculation. + */ +#define STM32_VDD 300U + +/* + * IO pins assignments. + */ +#define GPIOA_SWDIO 13 +#define GPIOA_SWCLK 14 + +#define GPIOB_SWO 3 + +/* + * I/O ports initial setup, this configuration is established soon after reset + * in the initialization code. + * Please refer to the STM32 Reference Manual for details. + */ +#define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) +#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) +#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) +#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) +#define PIN_ODR_LOW(n) (0U << (n)) +#define PIN_ODR_HIGH(n) (1U << (n)) +#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) +#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) +#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) +#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) +#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) +#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) +#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) +#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) +#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) +#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) + +#define VAL_GPIO_MODER_ALL_DEFAULT (EFI_PIN_MODE_DEFAULT(0) | \ + EFI_PIN_MODE_DEFAULT(1) | \ + EFI_PIN_MODE_DEFAULT(2) | \ + EFI_PIN_MODE_DEFAULT(3) | \ + EFI_PIN_MODE_DEFAULT(4) | \ + EFI_PIN_MODE_DEFAULT(5) | \ + EFI_PIN_MODE_DEFAULT(6) | \ + EFI_PIN_MODE_DEFAULT(7) | \ + EFI_PIN_MODE_DEFAULT(8) | \ + EFI_PIN_MODE_DEFAULT(9) | \ + EFI_PIN_MODE_DEFAULT(10) | \ + EFI_PIN_MODE_DEFAULT(11) | \ + EFI_PIN_MODE_DEFAULT(12) | \ + EFI_PIN_MODE_DEFAULT(13) | \ + EFI_PIN_MODE_DEFAULT(14) | \ + EFI_PIN_MODE_DEFAULT(15)) + +#define VAL_GPIO_OTYPER_ALL_DEFAULT (PIN_OTYPE_PUSHPULL(0) | \ + PIN_OTYPE_PUSHPULL(1) | \ + PIN_OTYPE_PUSHPULL(2) | \ + PIN_OTYPE_PUSHPULL(3) | \ + PIN_OTYPE_PUSHPULL(4) | \ + PIN_OTYPE_PUSHPULL(5) | \ + PIN_OTYPE_PUSHPULL(6) | \ + PIN_OTYPE_PUSHPULL(7) | \ + PIN_OTYPE_PUSHPULL(8) | \ + PIN_OTYPE_PUSHPULL(9) | \ + PIN_OTYPE_PUSHPULL(10) | \ + PIN_OTYPE_PUSHPULL(11) | \ + PIN_OTYPE_PUSHPULL(12) | \ + PIN_OTYPE_PUSHPULL(13) | \ + PIN_OTYPE_PUSHPULL(14) | \ + PIN_OTYPE_PUSHPULL(15)) + +#define VAL_GPIO_OSPEEDR_ALL_DEFAULT (DEFAULT_GPIO_SPEED(0) | \ + DEFAULT_GPIO_SPEED(1) | \ + DEFAULT_GPIO_SPEED(2) | \ + DEFAULT_GPIO_SPEED(3) | \ + DEFAULT_GPIO_SPEED(4) | \ + DEFAULT_GPIO_SPEED(5) | \ + DEFAULT_GPIO_SPEED(6) | \ + DEFAULT_GPIO_SPEED(7) | \ + DEFAULT_GPIO_SPEED(8) | \ + DEFAULT_GPIO_SPEED(9) | \ + DEFAULT_GPIO_SPEED(10) | \ + DEFAULT_GPIO_SPEED(11) | \ + DEFAULT_GPIO_SPEED(12) | \ + DEFAULT_GPIO_SPEED(13) | \ + DEFAULT_GPIO_SPEED(14) | \ + DEFAULT_GPIO_SPEED(15)) + +#define VAL_GPIO_ODR_ALL_DEFAULT 0 + +#define VAL_GPIO_PUPDR_ALL_DEFAULT (EFI_DR_DEFAULT(0) | \ + EFI_DR_DEFAULT(1) | \ + EFI_DR_DEFAULT(2) | \ + EFI_DR_DEFAULT(3) | \ + EFI_DR_DEFAULT(4) | \ + EFI_DR_DEFAULT(5) | \ + EFI_DR_DEFAULT(6) | \ + EFI_DR_DEFAULT(7) | \ + EFI_DR_DEFAULT(8) | \ + EFI_DR_DEFAULT(9) | \ + EFI_DR_DEFAULT(10) | \ + EFI_DR_DEFAULT(11) | \ + EFI_DR_DEFAULT(12) | \ + EFI_DR_DEFAULT(13) | \ + EFI_DR_DEFAULT(14) | \ + EFI_DR_DEFAULT(15)) + +#define VAL_GPIO_AF_ALL_DEFAULT (PIN_AFIO_AF(0, 0U) | \ + PIN_AFIO_AF(1, 0U) | \ + PIN_AFIO_AF(2, 0U) | \ + PIN_AFIO_AF(3, 0U) | \ + PIN_AFIO_AF(4, 0U) | \ + PIN_AFIO_AF(5, 0U) | \ + PIN_AFIO_AF(6, 0U) | \ + PIN_AFIO_AF(7, 0U)) + + +/* + * GPIOA setup: + * + * PA11 - OTG_FS_DM (alternate 10). + * PA12 - OTG_FS_DP (alternate 10). + * PA13 - SWDIO (alternate 0). + * PA14 - SWCLK (alternate 0). + */ +#define VAL_GPIOA_MODER (EFI_PIN_MODE_DEFAULT(0) | \ + EFI_PIN_MODE_DEFAULT(1) | \ + EFI_PIN_MODE_DEFAULT(2) | \ + EFI_PIN_MODE_DEFAULT(3) | \ + EFI_PIN_MODE_DEFAULT(4) | \ + EFI_PIN_MODE_DEFAULT(5) | \ + EFI_PIN_MODE_DEFAULT(6) | \ + EFI_PIN_MODE_DEFAULT(7) | \ + EFI_PIN_MODE_DEFAULT(8) | \ + EFI_PIN_MODE_DEFAULT(9) | \ + EFI_PIN_MODE_DEFAULT(10) | \ + PIN_MODE_ALTERNATE(11) | \ + PIN_MODE_ALTERNATE(12) | \ + PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \ + PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \ + EFI_PIN_MODE_DEFAULT(15)) +#define VAL_GPIOA_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOA_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOA_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOA_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOA_AFRL (PIN_AFIO_AF(0, 0U) | \ + PIN_AFIO_AF(1, 0U) | \ + PIN_AFIO_AF(2, 0U) | \ + PIN_AFIO_AF(3, 0U) | \ + PIN_AFIO_AF(4, 6U) | \ + PIN_AFIO_AF(5, 5U) | \ + PIN_AFIO_AF(6, 5U) | \ + PIN_AFIO_AF(7, 5U)) +#define VAL_GPIOA_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOB setup: + * + * Default except SWO configured on PB3 + * + */ +#define VAL_GPIOB_MODER (EFI_PIN_MODE_DEFAULT(0) | \ + EFI_PIN_MODE_DEFAULT(1) | \ + EFI_PIN_MODE_DEFAULT(2) | \ + PIN_MODE_ALTERNATE(GPIOB_SWO) | \ + EFI_PIN_MODE_DEFAULT(4) | \ + EFI_PIN_MODE_DEFAULT(5) | \ + EFI_PIN_MODE_DEFAULT(6) | \ + EFI_PIN_MODE_DEFAULT(7) | \ + EFI_PIN_MODE_DEFAULT(8) | \ + EFI_PIN_MODE_DEFAULT(9) | \ + EFI_PIN_MODE_DEFAULT(10) | \ + EFI_PIN_MODE_DEFAULT(11) | \ + EFI_PIN_MODE_DEFAULT(12) | \ + EFI_PIN_MODE_DEFAULT(13) | \ + EFI_PIN_MODE_DEFAULT(14) | \ + EFI_PIN_MODE_DEFAULT(15)) +#define VAL_GPIOB_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOB_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOB_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOB_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOB_AFRL (PIN_AFIO_AF(0, 0U) | \ + PIN_AFIO_AF(1, 0U) | \ + PIN_AFIO_AF(2, 0U) | \ + PIN_AFIO_AF(GPIOB_SWO, 0U) | \ + PIN_AFIO_AF(4, 0U) | \ + PIN_AFIO_AF(5, 0U) | \ + PIN_AFIO_AF(6, 0U) | \ + PIN_AFIO_AF(7, 0U)) +#define VAL_GPIOB_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOC setup: + */ +#define VAL_GPIOC_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOC_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOC_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOC_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOC_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOC_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOC_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOD setup: + */ +#define VAL_GPIOD_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOD_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOD_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOD_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOD_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOD_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOD_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOE setup: + */ +#define VAL_GPIOE_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOE_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOE_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOE_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOE_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOE_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOE_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOF setup: + */ +#define VAL_GPIOF_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOF_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOF_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOF_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOF_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOF_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOF_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOG setup: + */ +#define VAL_GPIOG_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOG_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOG_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOG_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOG_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOG_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOG_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOH setup: + */ +#define VAL_GPIOH_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOH_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOH_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOH_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOH_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOH_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOH_AFRH VAL_GPIO_AF_ALL_DEFAULT + +/* + * GPIOI setup: + */ +#define VAL_GPIOI_MODER VAL_GPIO_MODER_ALL_DEFAULT +#define VAL_GPIOI_OTYPER VAL_GPIO_OTYPER_ALL_DEFAULT +#define VAL_GPIOI_OSPEEDR VAL_GPIO_OSPEEDR_ALL_DEFAULT +#define VAL_GPIOI_PUPDR VAL_GPIO_PUPDR_ALL_DEFAULT +#define VAL_GPIOI_ODR VAL_GPIO_ODR_ALL_DEFAULT +#define VAL_GPIOI_AFRL VAL_GPIO_AF_ALL_DEFAULT +#define VAL_GPIOI_AFRH VAL_GPIO_AF_ALL_DEFAULT + +#endif /* BOARD_H */ diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/board.mk b/firmware/config/boards/hellen/hellen64_miataNA6_94/board.mk new file mode 100644 index 0000000000..ce7cd73eef --- /dev/null +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/board.mk @@ -0,0 +1,42 @@ +# Combine the related files for a specific platform and MCU. + +# Target ECU board design +BOARDCPPSRC = $(BOARDS_DIR)/hellen/hellen72/board_configuration.cpp +BOARDINC = $(BOARDS_DIR)/hellen/hellen72 + +# Set this if you want a default engine type other than normal Hellen72 +ifeq ($(DEFAULT_ENGINE_TYPE),) + DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=HELLEN_NB2 +endif + +ifeq ($(LED_CRITICAL_ERROR_BRAIN_PIN),) + LED_CRITICAL_ERROR_BRAIN_PIN = -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOH_8 +endif + +ifeq ($(LED_COMMUNICATION_BRAIN_PIN),) + LED_COMMUNICATION_BRAIN_PIN = -DEFI_COMMUNICATION_PIN=GPIOH_10 +endif + +DDEFS += -DEFI_MAIN_RELAY_CONTROL=TRUE + +DDEFS += -DLED_ERROR_BRAIN_PIN_MODE=INVERTED_OUTPUT +DDEFS += -DLED_RUNING_BRAIN_PIN_MODE=INVERTED_OUTPUT +DDEFS += -DLED_WARNING_BRAIN_PIN_MODE=INVERTED_OUTPUT +DDEFS += -DLED_COMMUNICATION_BRAIN_PIN_MODE=INVERTED_OUTPUT + +# Disable serial ports on this board as UART3 causes a DMA conflict with the SD card +DDEFS += -DTS_NO_PRIMARY -DTS_NO_SECONDARY + +# Add them all together +DDEFS += -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"hellen72\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(LED_COMMUNICATION_BRAIN_PIN) +# -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE +DDEFS += -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE -DHAL_VSS_USE_PAL=TRUE +# todo: is it broken? +DDEFS += -DEFI_LOGIC_ANALYZER=FALSE + +# We are running on Hellen-One hardware! +DDEFS += -DHW_HELLEN=1 + +# Shared variables +ALLCPPSRC += $(BOARDCPPSRC) +ALLINC += $(BOARDINC) diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp b/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp new file mode 100644 index 0000000000..66edaa31a3 --- /dev/null +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp @@ -0,0 +1,189 @@ +/** + * @file boards/hellen/hellen72/board_configuration.cpp + * + * + * @brief Configuration defaults for the Hellen72 board + * + * See https://rusefi.com/s/hellen72 + * + * @author andreika + * @author Andrey Belomutskiy, (c) 2012-2020 + */ + +#include "global.h" +#include "engine.h" +#include "engine_math.h" +#include "allsensors.h" +#include "fsio_impl.h" +#include "engine_configuration.h" + +EXTERN_ENGINE; + +static void setInjectorPins() { + engineConfiguration->injectionPins[0] = GPIOG_7; + engineConfiguration->injectionPins[1] = GPIOG_8; + engineConfiguration->injectionPins[2] = GPIOD_11; + engineConfiguration->injectionPins[3] = GPIOD_10; + + //engineConfiguration->injectionPins[4] = GPIOD_9; + //engineConfiguration->injectionPins[5] = GPIOF_12; + //engineConfiguration->injectionPins[6] = GPIOF_13; + //engineConfiguration->injectionPins[7] = GPIOF_14; + + // Disable remainder + for (int i = 4; i < INJECTION_PIN_COUNT;i++) { + engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED; + } + + engineConfiguration->injectionPinMode = OM_DEFAULT; +} + +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 < IGNITION_PIN_COUNT; i++) { + engineConfiguration->ignitionPins[i] = GPIO_UNASSIGNED; + } + + engineConfiguration->ignitionPinMode = OM_DEFAULT; +} + +static void setLedPins() { +#ifdef EFI_COMMUNICATION_PIN + engineConfiguration->communicationLedPin = EFI_COMMUNICATION_PIN; +#else + engineConfiguration->communicationLedPin = GPIOH_10; +#endif /* EFI_COMMUNICATION_PIN */ + engineConfiguration->runningLedPin = GPIOH_9; // green + engineConfiguration->warningLedPin = GPIOH_11; // yellow +} + +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->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 = EFI_ADC_12; + + engineConfiguration->iat.adcChannel = EFI_ADC_13; + + engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE; + engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE; +} + +void setBoardConfigOverrides(void) { + setLedPins(); + setupVbatt(); + setSdCardConfigurationOverrides(); + + engineConfiguration->clt.config.bias_resistor = 4700; + engineConfiguration->iat.config.bias_resistor = 4700; + + engineConfiguration->canTxPin = GPIOD_1; + engineConfiguration->canRxPin = GPIOD_0; +} + +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->isSdCardEnabled = true; + + CONFIG(enableSoftwareKnock) = true; + + engineConfiguration->canTxPin = GPIOD_1; + engineConfiguration->canRxPin = GPIOD_0; + + 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 + + // "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 PASS_CONFIG_PARAMETER_SUFFIX); + + 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(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; +} diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/compile_hellenNA6.sh b/firmware/config/boards/hellen/hellen64_miataNA6_94/compile_hellenNA6.sh new file mode 100644 index 0000000000..fba01bf769 --- /dev/null +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/compile_hellenNA6.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +export PROJECT_BOARD=hellen/hellen72 +export PROJECT_CPU=ARCH_STM32F4 +export EXTRA_PARAMS="-DSHORT_BOARD_NAME=hellen72" + +cd .. +bash ../common_make.sh diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/prepend.txt b/firmware/config/boards/hellen/hellen64_miataNA6_94/prepend.txt new file mode 100644 index 0000000000..66045a7623 --- /dev/null +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/prepend.txt @@ -0,0 +1,24 @@ +#define ts_show_hip9011 false +#define ts_show_cj125 false + +//Jokeri says it's better with full pinout just in case +//#define ts_show_full_pinout false + +#define ts_show_lcd false +#define ts_show_joystick false +#define ts_show_egt false +#define ts_show_gps false +#define ts_show_etb_pins false +#define ts_show_analog_divider false +#define ts_show_spi true +#define ts_show_sd_card true +#define ts_show_can_pins false +#define ts_show_tunerstudio_port false +#define ts_show_can2 false +#define ts_show_software_knock true +#define ts_show_hardware_simulator false + +#define show_test_presets false +#define show_Frankenso_presets false +#define show_microRusEFI_presets false +#define show_Proteus_presets false