From cb488d28ce569f7d8b75a22dbee59e426da63b7c Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 16 Aug 2019 23:21:03 -0400 Subject: [PATCH] TLE8888 should be re-initialized every time we get +12 volts fix #901 fuel pump test passed, also longer start-up timeout is needed for reliable start --- firmware/config/engines/custom_engine.cpp | 4 ++++ firmware/hw_layer/drivers/gpio/tle8888.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index ed12ade1f8..3d82df208e 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -487,6 +487,10 @@ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) { boardConfiguration->ignitionPins[7] = GPIO_UNASSIGNED; + // fuel pump is useful to test power on/off scenario +// boardConfiguration->fuelPumpPin = TLE8888_PIN_22; + + // LED #1 // GPIOE_7: "34 - GP Out 2" boardConfiguration->injectionPins[1 - 1] = TLE8888_PIN_22;//GPIOE_7; diff --git a/firmware/hw_layer/drivers/gpio/tle8888.c b/firmware/hw_layer/drivers/gpio/tle8888.c index 5bd430361c..27eaac075d 100644 --- a/firmware/hw_layer/drivers/gpio/tle8888.c +++ b/firmware/hw_layer/drivers/gpio/tle8888.c @@ -360,7 +360,11 @@ int tle8888SpiStartupExchange(void * data) { struct tle8888_priv *chip = (struct tle8888_priv *)data; const struct tle8888_config *cfg = chip->cfg; - chThdSleepMilliseconds(3); + /** + * We need around 50ms to get reliable TLE8888 start if MCU is powered externally but +12 goes gown and then goes up + * again + */ + chThdSleepMilliseconds(50); /* Software reset */ // first packet: 0x335=821 > 0xFD=253 uint16_t response = 0;