skeleton & docs (#995)

* Documentation additions and clarifications.

Added config/boards/skeleton/ as an example and starting point for
board-specific support.

* Describe where the generated files came from.

* Minor rewording

* Delete mistakenly added emacs backups

* Added an overall description and build notes
This commit is contained in:
rusefi 2019-11-03 08:41:14 -05:00 committed by GitHub
parent 07e69cc773
commit 5f01a3fb04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 886 additions and 21 deletions

46
firmware/build-notes.txt Normal file
View File

@ -0,0 +1,46 @@
This directory contains the source code for the RusEFI firmware.
The ideal is that typical end users should be able to use pre-built
firmware. They should not need to modify or even rebuild from the
source code for basic use, but building from the source code provides
the opportunity for optimization, supporting unexpected engine
configurations, and specialized enhancements.
TL;DR
make PROJECT_BOARD=microrusefi PROJECT_CPU=ARCH_STM32F4
Environment
Rebuilding from source code requires this firmware, a modern C/C++
compiler for embedded ARM systems, and a platform that supports 'make'
based builds.
While many compilers have the potential to work, we suggest using the
official ARM version of GCC available at launchpad.net.
Linux and MacOS systems should have the software development tools,
primarily 'make', pre-installed or readily installed. MS-Windows
requires selecting and installing a Unix-compatible system environment.
Note that the developers are volunteers, with varied motivations.
These motivations often include using leading-edge language and build
system concepts, requiring recent versions of tools. Should you
encounter build problems, review the latest version of this document.
Expected Future Changes
The firmware build is moving toward a system that separates board
features from processor features. This will require specifying both
the board type and specific processor.
The existing system evolved based on the original RusEFI boards which
used 'STM32 Discovery' development boards plugged into base boards
that held the ECU specific chips. That resulted in hard-coded
assumption about pin assignments, and associations of hardware with a
specific processor variant. That legacy is slowly being cleaned up,
but is still evident in some settings and limitations.

View File

@ -1,16 +1,30 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/microrusefi/board_configuration.cpp
# Combine the related files for a specific platform and MCU.
# Required include directories
BOARDINC = $(PROJECT_DIR)/config/boards/nucleo_f767 $(PROJECT_DIR)/config/stm32f7ems
BOARDS_DIR = $(PROJECT_DIR)/config/boards
LDSCRIPT= $(PROJECT_DIR)/config/boards/nucleo_f767/STM32F76xxI.ld
# Target ECU board design
BOARDSRC_CPP = $(BOARDS_DIR)/microrusefi/board_configuration.cpp
# Target processor details
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
MCU_DEFS = -DSTM32F407xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c
BOARDINC = $(BOARDS_DIR)/microrusefi
BOARDINC += $(PROJECT_DIR)/config/stm32f4ems # For board.h
BOARDINC += $(BOARDS_DIR)/st_stm32f4
LDSCRIPT= $(BOARDS_DIR)/prometheus/STM32F405xG.ld
else
MCU_DEFS = -DSTM32F767xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld
endif
# Set this if you want a default engine type other than normal MRE
ifeq ($(DEFAULT_ENGINE_TYPE),)
DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=MICRO_RUS_EFI
endif
# Override DEFAULT_ENGINE_TYPE
DDEFS += -DSTM32F767xx -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE)
# Add them all together
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE)

View File

@ -0,0 +1,30 @@
# Combine the related files for a specific platform and MCU.
BOARDS_DIR = $(PROJECT_DIR)/config/boards
# Target ECU board design
BOARDSRC_CPP = $(BOARDS_DIR)/skeleton/board_configuration.cpp
# Target processor details
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
MCU_DEFS = -DSTM32F407xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c
BOARDINC = $(BOARDS_DIR)/skeleton
BOARDINC += $(PROJECT_DIR)/config/stm32f4ems # For board.h
BOARDINC += $(BOARDS_DIR)/st_stm32f4
LDSCRIPT= $(BOARDS_DIR)/prometheus/STM32F405xG.ld
else
MCU_DEFS = -DSTM32F767xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld
endif
# Set this if you want a default engine type
ifeq ($(DEFAULT_ENGINE_TYPE),)
DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=MICRO_RUS_EFI
endif
# Add them all together
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"skeleton\" $(DEFAULT_ENGINE_TYPE)

View File

@ -0,0 +1,226 @@
/**
* @file boards/skeleton/board_configuration.cpp
*
*
* @brief Configuration defaults for an example RusEFI board
*
* @author Donald Becker November 2019
* @author Hugo Becker November 2019
*
* This file is an example of board-specific firmware for RusEFI.
* It contains the unique code need for the setup of a specific board.
*
* These are called from firmware/controllers/algo/engine_configuration.cpp
* void setBoardConfigurationOverrides(void);
* void setPinConfigurationOverrides(void);
* void setSerialConfigurationOverrides(void);
*
* Future: Clean up the distinction between these functions.
*/
#include "global.h"
#include "engine.h"
#include "engine_math.h"
#include "allsensors.h"
#include "fsio_impl.h"
#include "engine_configuration.h"
EXTERN_ENGINE;
// An example of how to configure complex features on the board.
// Generally these should be local (static) functions, one function per chip.
// This shows a SPI connected TLE8888.
static void setupTle8888() {
// Enable the SPI channel and set up the SPI pins
boardConfiguration->is_enabled_spi_3 = true;
boardConfiguration->spi3mosiPin = GPIOB_5;
boardConfiguration->spi3misoPin = GPIOB_4;
boardConfiguration->spi3sckPin = GPIOB_3;
// SPI chip select is often independent of the SPI pin limitations
engineConfiguration->tle8888_cs = GPIOD_5;
// Set SPI device
engineConfiguration->tle8888spiDevice = SPI_DEVICE_3;
}
// A configuration for a Electronic Throttle Body (ETB) driver.
// This example uses the TLE9201 H-Bridge.
// The TLE9201 has three control pins:
// DIR - sets direction of the motor
// PWM - control (enable high, coast low), PWM capable
// DIS - disables motor (enable low)
// Future: An example showing how to probe for an optionally connected
// diagnostic interface on SPI
static void setupTle9201Etb() {
// This chip has PWM/DIR, not dira/dirb
engineConfiguration->etb1_use_two_wires = false;
// PWM and DIR pins
boardConfiguration->etb1.controlPin1 = GPIOC_7;
boardConfiguration->etb1.directionPin1 = GPIOA_8;
boardConfiguration->etb1.directionPin2 = GPIO_UNASSIGNED;
// PWM frequency needs to be configured to match the physical part
engineConfiguration->etbFreq = 800;
}
// Configure key sensors inputs.
//
// ToDo: Review count assumption with initialization of unused triggers/cams
// ToDo: Resolve angst over default input assignments.
static void setupDefaultSensorInputs() {
// Engine rotation position sensors
// Trigger is our primary timing signal, and usually comes from the crank.
// trigger inputs up TRIGGER_SUPPORTED_CHANNELS (2)
boardConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
// A secondary Cam signal up to CAM_INPUTS_COUNT (4)
engineConfiguration->camInputs[0] = GPIOA_5;
// Throttle Body Position Sensors, second channel is a check/fail-safe
// tps = "20 - AN volt 5"
engineConfiguration->tps1_1AdcChannel = EFI_ADC_13;
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
// Throttle pedal inputs
// Idle/Up/Closed (no pressure on pedal) pin
engineConfiguration->throttlePedalUpPin = GPIO_UNASSIGNED;
// If the ETB has analog feedback we can use it for closed loop control.
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_2;
// Manifold Air Pressure sensor input
// EFI_ADC_10: "27 - AN volt 1"
engineConfiguration->map.sensor.hwChannel = EFI_ADC_10;
// Air Fuel Ratio (exhaust gas oxygen) sensor input
// EFI_ADC_14: "32 - AN volt 6"
engineConfiguration->afr.hwChannel = EFI_ADC_14;
// Coolant Temp
// clt = "18 - AN temp 1"
engineConfiguration->clt.adcChannel = EFI_ADC_0;
engineConfiguration->clt.config.bias_resistor = 2700;
// Intake Air Temperature, IAT
// iat = "23 - AN temp 2"
engineConfiguration->iat.adcChannel = EFI_ADC_1;
engineConfiguration->iat.config.bias_resistor = 2700;
}
void setPinConfigurationOverrides(void) {
}
// Future: configure USART3 for LIN bus and UART4 for console
void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = false;
engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED;
engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED;
engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED;
engineConfiguration->consoleSerialRxPin = GPIO_UNASSIGNED;
}
/**
* @brief Board-specific configuration overrides.
*
* See also setDefaultEngineConfiguration
*
* @todo Add any board-specific code
*/
void setBoardConfigurationOverrides(void) {
// Set indicator LED pins.
// This is often redundant with efifeatures.h or the run-time config
boardConfiguration->triggerErrorPin = GPIOE_1;
engineConfiguration->communicationLedPin = GPIOE_2;
engineConfiguration->FatalErrorPin = GPIOE_3;
engineConfiguration->runningLedPin = GPIOE_4;
// Set injector pins and the pin output mode
boardConfiguration->injectionPinMode = OM_DEFAULT;
boardConfiguration->injectionPins[0] = GPIOE_14;
boardConfiguration->injectionPins[1] = GPIOE_13;
boardConfiguration->injectionPins[2] = GPIOE_12;
boardConfiguration->injectionPins[3] = GPIOE_11;
// Disable the remainder only when they may never be assigned
for (int i = 4; i < INJECTION_PIN_COUNT;i++) {
boardConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
}
// Do the same for ignition outputs
boardConfiguration->ignitionPinMode = OM_DEFAULT;
boardConfiguration->ignitionPins[0] = GPIOD_4;
boardConfiguration->ignitionPins[1] = GPIOD_3;
boardConfiguration->ignitionPins[2] = GPIOD_2;
boardConfiguration->ignitionPins[3] = GPIOD_1;
// Disable remainder
for (int i = 4; i < IGNITION_PIN_COUNT; i++) {
boardConfiguration->ignitionPins[i] = GPIO_UNASSIGNED;
}
// Board-specific scaling values to convert ADC fraction to Volts.
// It is good to make the math explicit, but still compile time constants
// The ADC reference voltage
engineConfiguration->adcVcc = 3.30f;
// This is a board with 6.8 Kohm and 10 Kohm resistor dividers
engineConfiguration->analogInputDividerCoefficient = (10.0+6.8) / 10.0f;
// Vbatt is the voltage of the 12V battery.
// Here the hardware has a 39 Kohm high side/10 Kohm low side divider,
// with the second divider also applied.
engineConfiguration->vbattDividerCoeff =
(49.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
engineConfiguration->vbattAdcChannel = EFI_ADC_11;
setupTle8888();
setupEtb();
// The MRE uses the TLE8888 fixed-function main relay control pin.
// This firmware is not involved with main relay control, although
// the pin inputs can be over-ridden through the TLE8888 Cmd0 register.
// ToDo: consider EFI_MAIN_RELAY_CONTROL to FALSE for MRE configuration
// Configure the TLE8888 half bridges (pushpull, lowside, or high-low)
// TLE8888_IN11 -> TLE8888_OUT21
// GPIOE_8: "35 - GP Out 1"
boardConfiguration->fuelPumpPin = GPIOE_8;
// TLE8888 high current low side: VVT2 IN9 / OUT5
// GPIOE_10: "3 - Lowside 2"
boardConfiguration->idle.solenoidPin = GPIOE_10;
// TLE8888_PIN_22: "34 - GP Out 2"
boardConfiguration->fanPin = TLE8888_PIN_22;
// "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;
}
void setAdcChannelOverrides(void) {
}
/*
* Local variables:
* c-basic-indent: 4
* tab-width: 4
* End:
*/

View File

@ -0,0 +1,404 @@
/**
* @file efifeatures.h
*
* @brief Configure which firmware modules are used.
* @author Donald Becker October 2019
* @author Hugo Becker November 2019
*
* This configuration is a "skeleton" example for RusEFI boards.
*
*/
#ifndef EFIFEATURES_SKELRUSEFI_H_
#define EFIFEATURES_SKELRUSEFI_H_
// General software features
// Use the GPIO port setup code -- almost always set.
#define EFI_GPIO_HARDWARE TRUE
// Internal ADC -- almost always set.
#define EFI_INTERNAL_ADC TRUE
#define EFI_ANALOG_SENSORS TRUE
// Console I/O features to monitor formulas and pin state
#define EFI_FSIO TRUE
// Log crank/cam sensor events, a frequently needed diag for new installations
#define EFI_TOOTH_LOGGER TRUE
// Log other events, see also EFI_PRINT_MESSAGES_TO_TERMINAL
#define EFI_TEXT_LOGGING TRUE
// Monitor changes to Default settings that create failures -- note spelling
#define EFI_DEFAILED_LOGGING FALSE
// Build the logic analyzer support.
// A logic analyzer viewer is included in the java console.
#define EFI_WAVE_ANALYZER TRUE
// A development feature to test output jitter and consistency
#define EFI_PWM_TESTER FALSE
#define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE
#define EFI_ENABLE_ENGINE_WARNING TRUE
#define EFI_CAN_SUPPORT TRUE
// Internal MCU features
// Use STM32 Core Coupled Memory as general purpose RAM.
#define EFI_USE_CCM TRUE
// Support USB Mass Storage Devices
// Typically off as it requires USB OTG and power output.
#define HAL_USE_USB_MSD FALSE
// Hardware feature and chip support
// Some require a non-zero count to include support, others are TRUE/FALSE
// Other inconsistencies, such as naming, abound.
// Capacitive Discharge Module ion sense for detontation/knock detection
#define EFI_CDM_INTEGRATION FALSE
// MCP42010 digital potentiometer
#define EFI_POTENTIOMETER FALSE
// MC33816 Programmable Gate Driver over SPI
#define EFI_MC33816 FALSE
// MAX31855 Thermocouple interface over SPI
#define EFI_MAX_31855 FALSE
// MCP3208 ADC over SPI
#define EFI_MCP_3208 FALSE
// HIP9011 Knock / Detonation Detector SPI config
#define EFI_HIP_9011 FALSE
// Bosch CJ125 Wideband Exhaust Gas Oxygen Sensor interface
#define EFI_CJ125 FALSE
// LIS302DL MEMS Accelerometer over SPI, as on F4 Discovery board.
#define EFI_MEMS FALSE
// HD44780 Character LCD, the only client of EFI_LCD
#define EFI_HD44780_LCD FALSE
#define EFI_LCD FALSE
// and the closely related joystick input for the LCD menu system.
#define EFI_JOYSTICK FALSE
#define BOARD_TLE6240_COUNT 0
#define BOARD_MC33972_COUNT 0
#define BOARD_TLE8888_COUNT 0
// Future: move these outside of efifeatures.h
#define BOARD_EXT_GPIOCHIPS (BOARD_TLE6240_COUNT + BOARD_MC33972_COUNT + BOARD_TLE8888_COUNT)
#define BOARD_EXT_PINREPOPINS 24
/**
* if you have a 60-2 trigger, or if you just want better performance, you
* probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
* CH_DBG_ENABLE_CHECKS
* CH_DBG_ENABLE_ASSERTS
* CH_DBG_ENABLE_TRACE
* in chconf.h
*
*/
#if !defined(EFI_ENABLE_ASSERTS)
#define EFI_ENABLE_ASSERTS TRUE
#endif /* EFI_ENABLE_ASSERTS */
#if !defined(EFI_ENABLE_MOCK_ADC)
#define EFI_ENABLE_MOCK_ADC TRUE
#endif /* EFI_ENABLE_MOCK_ADC */
//#define EFI_UART_ECHO_TEST_MODE TRUE
#define EFI_ICU_INPUTS TRUE
#ifndef HAL_TRIGGER_USE_PAL
#define HAL_TRIGGER_USE_PAL FALSE
#endif /* HAL_TRIGGER_USE_PAL */
// TunerStudio support.
#define EFI_TUNER_STUDIO TRUE
#define EFI_TUNER_STUDIO_VERBOSE TRUE // Debugging output
// HC-06 Bluetooth module UART setup (output an initial configuration string)
#define EFI_BLUETOOTH_SETUP FALSE
// Serial port NMEA GPS reporting
#define EFI_UART_GPS FALSE
/**
* Dev console support.
*/
#define EFI_CLI_SUPPORT TRUE
#define EFI_RTC TRUE
#define EFI_ALTERNATOR_CONTROL TRUE
#define EFI_AUX_PID TRUE
#define EFI_SIGNAL_EXECUTOR_SLEEP FALSE
#define EFI_SIGNAL_EXECUTOR_ONE_TIMER TRUE
#define EFI_SIGNAL_EXECUTOR_HW_TIMER FALSE
#define FUEL_MATH_EXTREME_LOGGING FALSE
#define SPARK_EXTREME_LOGGING FALSE
#define TRIGGER_EXTREME_LOGGING FALSE
#ifndef EFI_INTERNAL_FLASH
#define EFI_INTERNAL_FLASH TRUE
#endif
/**
* Usually you need shaft position input, but maybe you do not need it?
*/
#ifndef EFI_SHAFT_POSITION_INPUT
#define EFI_SHAFT_POSITION_INPUT TRUE
#endif
#define EFI_ENGINE_CONTROL TRUE
#define EFI_SPEED_DENSITY TRUE
#define EFI_ANALOG_SENSORS TRUE
#define EFI_NARROW_EGO_AVERAGING TRUE
#define EFI_DENSO_ADC FALSE
#ifndef EFI_IDLE_CONTROL
#define EFI_IDLE_CONTROL TRUE
#endif
#define EFI_IDLE_INCREMENTAL_PID_CIC FALSE
/**
* Control the main power relay based on measured ignition voltage (Vbatt)
*/
#ifndef EFI_MAIN_RELAY_CONTROL
#define EFI_MAIN_RELAY_CONTROL FALSE
#endif
#ifndef EFI_PWM
#define EFI_PWM TRUE
#endif
#ifndef EFI_VEHICLE_SPEED
#define EFI_VEHICLE_SPEED TRUE
#endif
#define EFI_FUEL_PUMP TRUE
#ifndef EFI_ENGINE_EMULATOR
#define EFI_ENGINE_EMULATOR TRUE
#endif
#ifndef EFI_EMULATE_POSITION_SENSORS
#define EFI_EMULATE_POSITION_SENSORS TRUE
#endif
/**
* This macros is used to hide hardware-specific pieces of the code from unit tests and simulator, so it only makes
* sense in folders exposed to the tests projects (simulator and unit tests).
* This macros is NOT about taking out logging in general.
* See also EFI_UNIT_TEST
* See also EFI_SIMULATOR
* todo: do we want to rename any of these three options?
*/
#define EFI_PROD_CODE TRUE
/**
* Do we need file logging (like SD card) logic?
*/
#ifndef EFI_FILE_LOGGING
#define EFI_FILE_LOGGING TRUE
#endif
#define EFI_USB_SERIAL TRUE
// For now we can still embed all car configurations into the firmware binary.
// These give us control over which configurations go in.
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#ifndef EFI_ENGINE_SNIFFER
#define EFI_ENGINE_SNIFFER TRUE
#endif
#define EFI_HISTOGRAMS FALSE
#define EFI_SENSOR_CHART TRUE
#if defined __GNUC__
#define EFI_PERF_METRICS FALSE
#define DL_OUTPUT_BUFFER 6500
#else
#define EFI_PERF_METRICS FALSE
#define DL_OUTPUT_BUFFER 8000
#endif
/**
* Do we need GPS logic?
*/
//#define EFI_UART_GPS FALSE
#define EFI_SERVO TRUE
#define EFI_ELECTRONIC_THROTTLE_BODY TRUE
// MIL Malfunction Indicator Lamp logic
#define EFI_MALFUNCTION_INDICATOR TRUE
#define CONSOLE_MAX_ACTIONS 180
#define EFI_MAP_AVERAGING TRUE
// todo: most of this should become configurable
// todo: switch to continuous ADC conversion for slow ADC?
// https://github.com/rusefi/rusefi/issues/630
#define EFI_INTERNAL_SLOW_ADC_PWM &PWMD8
// todo: switch to continues ADC conversion for fast ADC?
#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4
#define EFI_SPI1_AF 5
#define EFI_SPI2_AF 5
/**
* This section is for right-side center SPI
*/
#define EFI_SPI3_AF 6
#define EFI_I2C_SCL_BRAIN_PIN GPIOB_6
#define EFI_I2C_SDA_BRAIN_PIN GPIOB_7
#define EFI_I2C_AF 4
/**
* Patched version of ChibiOS/RT support extra details in the system error messages
*/
#define EFI_CUSTOM_PANIC_METHOD TRUE
#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
/**
* currently ChibiOS uses only first and second channels of each timer for input capture
*
* So, our options are:
*
* TIM2_CH1
* PA5
*
* TIM4_CH1
* PB6
* PD12
*
* TIM9_CH1
* PE5
*/
// Future: Consistently use consoleUartDevice
#ifndef EFI_CONSOLE_SERIAL_DEVICE
#define EFI_CONSOLE_SERIAL_DEVICE (&SD3)
#endif
/**
* Use 'HAL_USE_UART' DMA-mode driver instead of 'HAL_USE_SERIAL'
*
* See also
* STM32_SERIAL_USE_USARTx
* STM32_UART_USE_USARTx
* in mcuconf.h
*/
#define TS_UART_DMA_MODE FALSE
#define TS_UART_DEVICE (&UARTD3)
#define TS_SERIAL_DEVICE (&SD3)
// todo: add DMA-mode for Console?
#if (TS_UART_DMA_MODE || TS_UART_MODE)
#undef EFI_CONSOLE_SERIAL_DEVICE
#endif
#ifndef LED_ERROR_BRAIN_PIN
#define LED_ERROR_BRAIN_PIN GPIOD_14
#endif
// USART1 -> check defined STM32_SERIAL_USE_USART1
// For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX
#define GPS_SERIAL_DEVICE &SD1
#define GPS_SERIAL_SPEED 38400
#ifndef CONFIG_RESET_SWITCH_PORT
// looks like this feature is not extremely popular, we can try living without it now :)
//#define CONFIG_RESET_SWITCH_PORT GPIOD
#endif
#ifndef CONFIG_RESET_SWITCH_PIN
#define CONFIG_RESET_SWITCH_PIN 6
#endif
/**
* This is the size of the MemoryStream used by chvprintf
*/
#define INTERMEDIATE_LOGGING_BUFFER_SIZE 2000
// Enable file logging (like SD card) logic
#define EFI_FILE_LOGGING FALSE
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
#define EFI_USB_SERIAL TRUE
// GPS reporting NMEA protocol on a serial port
#undef EFI_UART_GPS
#define EFI_UART_GPS FALSE
// consoleUartDevice is unused but provided on UART4 Tx:PC10 Rx:PC11
// USART3 would work on the same pins but is reserved for future LIN bus use.
// ToDo: Fix so that UART4 will work here.
#define HAL_USE_SERIAL_USB TRUE
#undef EFI_CONSOLE_SERIAL_DEVICE
#undef TS_UART_DEVICE
#undef TS_SERIAL_DEVICE
#undef TS_UART_MODE
#define EFI_CONSOLE_SERIAL_DEVICE (&SD1)
//#define EFI_CONSOLE_SERIAL_DEVICE (&SDU1)
#define EFI_UART_ECHO_TEST_MODE TRUE
#define TS_UART_DEVICE (&UARTD3)
#define TS_SERIAL_DEVICE (&SD3)
// USART3 is Alternate Function 7, UART4 is AF8
// todo: start using consoleSerial{Tx,Rx}Pin
#define EFI_CONSOLE_AF 7
#define TS_SERIAL_AF 7
#define EFI_CONSOLE_TX_PORT GPIOC
#define EFI_CONSOLE_TX_PIN 10
#define EFI_CONSOLE_RX_PORT GPIOC
#define EFI_CONSOLE_RX_PIN 11
// todo: document the limitations of DMA mode for the UART.
#undef TS_UART_DMA_MODE
#define TS_UART_DMA_MODE FALSE
// todo: add DMA-mode for Console?
#if (TS_UART_DMA_MODE || TS_UART_MODE)
#undef EFI_CONSOLE_SERIAL_DEVICE
#endif
#endif /* EFIFEATURES_MICRORUSEFI_H_ */

View File

@ -0,0 +1,54 @@
outputs:
# TLE8888 injector channels
GPIOE_14: "37 - Injector 1"
GPIOE_13: "38 - Injector 2"
GPIOE_12: "41 - Injector 3"
GPIOE_11: "42 - Injector 4"
# TC4427 ignition outputs (5v)
GPIOD_4: "9 - Ignition 1"
GPIOD_3: "10 - Ignition 2"
GPIOD_2: "11 - Ignition 3"
GPIOD_1: "12 - Ignition 4"
# TC4427 general purpose output (selectable 5v/12v)
GPIOD_7: "14 - GP Out 5"
GPIOD_6: "13 - GP Out 6"
# TLE8888 high current low side: VVT1 TLE8888_IN10 / TLE8888_OUT6
GPIOE_9: "7 - Lowside 1"
# TLE8888 high current low side: VVT2 TLE8888_IN9 / TLE8888_OUT5
GPIOE_10: "3 - Lowside 2"
# TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21
GPIOE_8: "35 - GP Out 1"
# TLE8888 half bridges (pushpull, lowside, or high-low) IN? / TLE8888_OUT22
# this should work but it does not GPIOE_7: "34 - GP Out 2"
TLE8888_PIN_22: "34 - GP Out 2"
TLE8888_PIN_23: "33 - GP Out 3"
TLE8888_PIN_24: "43 - GP Out 4"
event_inputs:
# RC filter input for hall
GPIOA_5: "25 - Hall Cam"
# TLE8888 VR/hall conditioner
GPIOC_6: "45 - VR/Hall Crank"
switch_inputs:
GPIOE_10: "Brake Switch"
GPIOG_1: "Clutch Switch"
analog_inputs:
EFI_ADC_0: "18 - AN temp 1"
EFI_ADC_1: "23 - AN temp 2"
EFI_ADC_2: "24 - AN temp 3"
EFI_ADC_3: "22 - AN temp 4"
EFI_ADC_4: "28 - AN volt 10"
EFI_ADC_6: "26 - AN volt 2"
EFI_ADC_7: "31 - AN volt 3"
EFI_ADC_8: "36 - AN volt 8"
EFI_ADC_9: "40 - AN volt 9"
EFI_ADC_10: "27 - AN volt 1"
EFI_ADC_11: "Battery Sense"
EFI_ADC_12: "19 - AN volt 4"
EFI_ADC_13: "20 - AN volt 5"
EFI_ADC_14: "32 - AN volt 6"
EFI_ADC_15: "30 - AN volt 7"

View File

@ -0,0 +1,8 @@
#define ts_show_hip9011 false
#define ts_show_cj125 false
#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

View File

@ -0,0 +1,11 @@
This directory contains an example of the files needed to configure the
firmware for a specific RusEFI board.
The files here
- select specific features to be included into the firmware
- firmware to configure and support unique features of the board
- set communication channels (USB, serial, CAN) and parameters e.g. speed
- set the default GPIO pin configuration for use at startup
Note that many settings may be immediately reconfigured by the engine
configuration.

View File

@ -1,9 +1,15 @@
In TunerStudio or rusEfi console please use "Popular Vehicles" dialog to apply some of these presets.
This directory contains pre-defined configurations for popular engines.
These configurations are a convenience, not a limit. Most engine types
can be manually configured.
Please do not be afraid of the content of this folder. You would NOT need your own file to start your own engine.
In TunerStudio or rusEfi console use the "Popular Vehicles" dialog to
apply one of these presets.
See http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
This folder is also used by continutes integration testing suite.
This folder is also used by the continuous integration testing suite.
New configurations should follow the pattern of <make>_<model>.cpp for
consistency. A future change may rename these to <make>_<engine>.cpp

View File

@ -0,0 +1,4 @@
This directory contains the core calculations for engine operation.

View File

@ -3,4 +3,50 @@
[Q&A on source code](https://rusefi.com/forum/viewtopic.php?f=5&t=10)
See also [../unit_tests](../unit_tests)
See also [../unit_tests](../unit_tests)
This directory contains the source code for the RusEFI firmware.
The ideal is that typical end users should be able to use pre-built
firmware. They should not need to modify or even rebuild from the
source code for basic use, but building from the source code provides
the opportunity for optimization, supporting unexpected engine
configurations, and specialized enhancements.
TL;DR
make PROJECT_BOARD=microrusefi PROJECT_CPU=ARCH_STM32F4
Environment
Rebuilding from source code requires this firmware, a modern C/C++
compiler for embedded ARM systems, and a platform that supports 'make'
based builds.
While many compilers have the potential to work, we suggest using the
official ARM version of GCC available at launchpad.net.
Linux and MacOS systems should have the software development tools,
primarily 'make', pre-installed or readily installed. MS-Windows
requires selecting and installing a Unix-compatible system environment.
Note that the developers are volunteers, with varied motivations.
These motivations often include using leading-edge language and build
system concepts, requiring recent versions of tools. Should you
encounter build problems, review the latest version of this document.
Expected Future Changes
The firmware build is moving toward a system that separates board
features from processor features. This will require specifying both
the board type and specific processor.
The existing system evolved based on the original RusEFI boards. Those
used 'STM32 Discovery' development boards plugged into base boards
that held the ECU-specific chips. That approach resulted in hard-coded
assumption about pin assignments, and associations of hardware with a
specific processor variant. That legacy is slowly being cleaned up,
but is still evident in some settings and limitations.

View File

@ -1,3 +1,16 @@
This directory contains the initialization and configuration files for the
RusEFI interface to TunerStudio.
The primary contents are a set ```rusefi*.ini``` initialization files, used to
configure TunerStudio to setup and monitor a specific ECU board. These are
the only files a typical end user needs.
The ```translations``` directory contains non-English-language translations
for TunerStudio.
The initialization files are automatically generated from a combination
of input files located both in this directory and in the board-specific
directories .
```rusefi*.ini``` files are generated based on the following four inputs:
1) ```rusefi_config.txt``` contains configuration region definition in proprietary text format.
@ -7,5 +20,5 @@ line - here you will see all top level menus defined with internal IDs and visib
4) ```prepend.txt``` is a minor detail which allows you to hide elements of the UI using ```@@if_XXX``` syntax.
rusefi.ini file is generated by ConfigDefinition.jar tool.
On Windows you simply invoke ```gen_config.bat```
The combined file is generated by ConfigDefinition.jar tool.
On Windows this may be run with ```gen_config.bat```.

View File

@ -1,11 +1,14 @@
; this is TunerStudio project for www.rusefi.com DIY engine management system
;
; rusefi.ini is generated by invoking gen_config.bat (look inside for the exact command to run it outside of Windows)
; inputs are rusefi.input template and rusefi_config.txt file
; This is a TunerStudio project for the RusEFI.com engine management system
;
; This file has been generated by invoking gen_config.bat.
; The input files are
; rusefi.input the common template
; rusefi_config.txt the project specific file
;
; In TunerStudio some fields have little question mark on the left of the name for additional field tips.
; Those tips are defined in ../integraion/rusefi_config.txt file for example
; Those tips are defined in ../integraion/rusefi_config.txt
;
; For example
;
; float bias_resistor;+Pull-up resistor value on your board;"Ohm"
; here 'bias_resistor' is internal field name and the text between semicolons is what produces the tooltip

View File

@ -996,8 +996,8 @@ page = 1
cylinderBore = "Cylinder diameter, in mm."
sensorSnifferRpmThreshold = "Disable sensor sniffer above this rpm"
fuelAlgorithm = "This setting controls which fuel quantity control algorithm is used.\nSee also useTPSAdvanceTable\nset algorithm X"
crankingInjectionMode = "This is the type of injection strategy (See Fuel/Injection settings for more detail) it is suggested to use "Simultaneous" for easiest starting."
injectionMode = "This is where the fuel injection type is defined: "Simultaneous" means all injectors will fire together at once. "Sequential" fires the injectors on a per cylinder basis, only use this if you have individually wired injectors. "batched" will fire the injectors in groups, if your injectors are individually wired you will also need to enable "Two wire batch emulation". \nset injection_mode X\nSee also twoWireBatchInjection"
crankingInjectionMode = "This is the injection strategy during engine start. See Fuel/Injection settings for more detail. It is suggested to use "Simultaneous"."
injectionMode = "This is where the fuel injection type is defined: "Simultaneous" means all injectors will fire together at once. "Sequential" fires the injectors on a per cylinder basis, which requires individually wired injectors. "Batched" will fire the injectors in groups. If your injectors are individually wired you will also need to enable "Two wire batch emulation". \nset injection_mode X\nSee also twoWireBatchInjection"
extraInjectionOffset = "this is about deciding when the injector starts it's squirt\nSee also injectionPhase map\ntodo: do we need even need this since we have the map anyway?"
crankingTimingAngle = "Ignition advance angle used during engine cranking, 5-10 degrees will work as a base setting for most engines.\nset cranking_timing_angle X"
ignitionMode = ""One Coil" is for use on distributed ignition system. "Individual Coils" is to be used when you have one coil per cylinder (COP or similar). "Wasted" means one coil is driving two spark plugs in two cylinders, with one of the sparks not doing anything since it's happening on the exhaust cycle\nset ignition_mode X"