rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
board_configuration.cpp
Go to the documentation of this file.
1/**
2 * @file boards/microrusefi/board_configuration.cpp
3 *
4 *
5 * @brief Configuration defaults for the microRusefi board
6 *
7 * MICRO_RUS_EFI
8 * set engine_type 60
9 *
10 * MRE_BOARD_OLD_TEST
11 * set engine_type 30
12 *
13 * MRE_BOARD_NEW_TEST
14 * set engine_type 31
15 *
16 * See https://github.com/rusefi/rusefi/wiki/Hardware-microRusEfi-wiring
17 *
18 * @author Matthew Kennedy, (c) 2019
19 */
20
21#include "pch.h"
22#include "mre_meta.h"
23#include "defaults.h"
24#include "board_overrides.h"
25
26static void setInjectorPins() {
27 engineConfiguration->injectionPins[0] = MRE_INJ_1;
28 engineConfiguration->injectionPins[1] = MRE_INJ_2;
29 engineConfiguration->injectionPins[2] = MRE_INJ_3;
30 engineConfiguration->injectionPins[3] = MRE_INJ_4;
31}
32
39
41 return Gpio::E2; // d23 = blue
42}
43
45 // D22 = green
46 return Gpio::E4;
47}
48
50 // D27 = orange or yellow
51 return Gpio::E1;
52}
53
54static void setupVbatt() {
55/*
56 below 0.4
57 // 1k high side/1.5k low side = 1.6667 ratio divider
58 engineConfiguration->analogInputDividerCoefficient = 2.5f / 1.5f;
59*/
60
61 // 6.8k high side/10k low side = 1.68 ratio divider
63
64 // set vbatt_divider 8.23
65 // R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.232f
67 // PC1, pin #1 input +12 from Main Relay. Main Relay controlled by TLE8888
69
71}
72
73static void setupTle8888() {
74 // on microRusEFI SPI3 is exposed on PC10/PC11 and there is interest to use SD card there
75 // PB3/PB4 could be either SPI1 or SP3, let's use not SPI3 to address the contention
76
77 // Enable and wire up SPI1
82
83 // Chip select
85
86 // SPI device
88}
89
90static void setupEtb() {
91 setupTLE9201(/*PWM controlPin*/Gpio::C7, Gpio::A8, Gpio::C8);
92}
93
95 // trigger inputs
96 // tle8888 VR conditioner
99 // Direct hall-only cam input
101
102 // open question if it's great to have TPS in default TPS - the down-side is for
103 // vehicles without TPS or for first start without TPS one would have to turn in off
104 // to avoid cranking corrections based on wrong TPS data
106
108
109 // EFI_ADC_14: "32 - AN volt 6"
110 engineConfiguration->afr.hwChannel = EFI_ADC_14;
111
112 engineConfiguration->clt.adcChannel = MRE_IN_CLT;
113
114 engineConfiguration->iat.adcChannel = MRE_IN_IAT;
115
116#ifndef EFI_BOOTLOADER
117 setCommonNTCSensor(&engineConfiguration->auxTempSensor1, MRE_DEFAULT_AT_PULLUP);
118 setCommonNTCSensor(&engineConfiguration->auxTempSensor2, MRE_DEFAULT_AT_PULLUP);
119#endif // EFI_BOOTLOADER
120}
121
123 setupVbatt();
124 setupTle8888();
125 setupEtb();
126
129
132
133 // SPI2 for onboard SD card on v0.6.0
138
139 // SPI3 for expansion header
140 // Don't override enable since you might want these pins for something else
144}
145
146/**
147 * @brief Board-specific configuration defaults.
148 *
149 * See also setDefaultEngineConfiguration
150 *
151
152 */
156
157 // MRE has a special main relay control low side pin
158 // rusEfi firmware is totally not involved with main relay control on microRusEfi board
159 // todo: maybe even set EFI_MAIN_RELAY_CONTROL to FALSE for MRE configuration
160 // TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21
161 // Gpio::TLE8888_PIN_21: "35 - GP Out 1"
162 engineConfiguration->fuelPumpPin = MRE_GPOUT_1;
163
164// engineConfiguration->isSdCardEnabled = true;
165
166 // TLE8888 high current low side: VVT2 IN9 / OUT5
167 // Gpio::E10: "3 - Lowside 2"
169
170
171 // Gpio::TLE8888_PIN_22: "34 - GP Out 2"
172 engineConfiguration->fanPin = MRE_GPOUT_2;
173
174 // "required" hardware is done - set some reasonable defaults
176
177 // Enable onboard SD card on v0.6.0
178 engineConfiguration->sdCardSpiDevice = SPI_DEVICE_2;
181
182 // Don't enable expansion header SPI by default
184
186 engineConfiguration->firingOrder = FO_1_3_4_2;
187
188 engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK
190 engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL;
191}
192
193static Gpio MRE_OUTPUTS[] = {
194MRE_INJ_1,
195MRE_INJ_2,
196MRE_INJ_3,
197MRE_INJ_4,
198MRE_LS_1,
199};
200
201static Gpio M111_OUTPUTS[] = {
202MRE_INJ_1, // green
203MRE_INJ_2, // white
204MRE_INJ_3, // blue
205MRE_INJ_4, //
206#if HW_MICRO_RUSEFI
207MRE_AV9_REUSE, // brown boost control
208MRE_LS_1, // VVT
209MRE_LS_2, // SC clutch
210//MRE_GPOUT_3, // SC Bypass
211#endif // HW_MICRO_RUSEFI
212};
213
216 return efi::size(M111_OUTPUTS);
217 }
218 return efi::size(MRE_OUTPUTS);
219}
220
227
229 return 1;
230}
231
Gpio getWarningLedPin()
Gpio getCommsLedPin()
Gpio getRunningLedPin()
void setup_custom_board_overrides()
@ Unassigned
void setupTLE9201(Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)
std::optional< setup_custom_board_overrides_type > custom_board_ConfigOverrides
std::optional< setup_custom_board_overrides_type > custom_board_DefaultConfiguration
static constexpr engine_configuration_s * engineConfiguration
static void setupDefaultSensorInputs()
static void setIgnitionPins()
int getBoardMetaOutputsCount()
Gpio * getBoardMetaOutputs()
static void setInjectorPins()
int getBoardMetaDcOutputsCount()
static void setupEtb()
static void microrusefi_boardConfigOverrides()
static void setupVbatt()
static Gpio M111_OUTPUTS[]
static void microrusefi_boardDefaultConfiguration()
Board-specific configuration defaults.
static Gpio MRE_OUTPUTS[]
static void setupTle8888()
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup)