fome-fw/firmware/config/engines/lada_kalina.cpp

83 lines
2.5 KiB
C++
Raw Normal View History

2016-01-21 15:03:40 -08:00
/*
* @file lada_kalina.cpp
*
2017-01-06 07:04:41 -08:00
* set engine_type 39
2016-01-21 15:03:40 -08:00
*
* @date Jan 21, 2016
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2016-01-21 15:03:40 -08:00
*/
#include "lada_kalina.h"
2016-03-21 13:01:49 -07:00
#include "custom_engine.h"
#include "fsio_impl.h"
EXTERN_CONFIG;
2016-01-21 15:03:40 -08:00
Tle8888 big update 1 (#1892) * smart gpio: fix tle8888 direct pin mapping for MRE * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 * TLE8888: cleanup * TLE8888: do not reset driver private data on WD/undervoltage reset * TLE8888: diagnostic updates * TLE8888 driver: BIG driver rework * TLE8888: check SPI answers for abnormal states Reply with other than requested register can be a sign of: -Power-On-Reset, then OpStat0 will be replyed -WatchDog reset, then FWDStat1 will be replyed -Invalid communication frame, then Diag0 will be replyed Keep tracking last accessed register and check with the next reply. * TLE8888: debug clean-up * TLE8888: implement spi array write This reduce CS inactive state time between two consequent accesses from 8.8 uS to 1.4 uS * TLE8888: fix PP outputs in OD mode * TLE8888: cleanup register definitions * TLE8888: run separate driver thread for each chip instance Calculating poll interval for few chips become more complex, avoid this running thread for each device. * TLE8888: fix cypress and kinetic compilation Both platforms define its own MAX and cause redifination error if common.h is included in driver. * MRE: update mapping.yaml and fix direct pin mapping for TLE8888 * TLE8888: diagnnostic: disable switch off in case of overcurrent For all output, use current limiting instead * TLE8888: check for overvoltage on OUT8..OUT13 * TLE8888: add TODO note about how to recover from failure condition Currently TLE8888 automaticly recovers only from overcurrent and (may be) overtemperature conditions. Short to bat cause output disable (bit in OECONFIG is reset) and needs driver/host intervention. * TLE8888: save few bytes of RAM * TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888 Don't forget to enable PP mode for TLE8888 outputs 21..24: uncomment line 1087 in tle8888.c * TLE8888: reorder code, cleanup * TLE8888: mode all debug/statisctic to per-chip struct * TLE8888: rework poll interval calculation * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 09:25:30 -07:00
#if (BOARD_TLE8888_COUNT > 0)
void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
/* MRE uses TLE8888_PIN_21 for fuel pump */
engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
/* PRE uses TLE8888_PIN_22 for fan */
engineConfiguration->fanPin = GPIO_UNASSIGNED;
// TLE8888 two bridge drivers for stepper
2020-11-16 17:05:35 -08:00
engineConfiguration->stepperDcIo[0].directionPin1 = TLE8888_PIN_21;
engineConfiguration->stepperDcIo[0].directionPin2 = TLE8888_PIN_22;
engineConfiguration->stepperDcIo[1].directionPin1 = TLE8888_PIN_23;
engineConfiguration->stepperDcIo[1].directionPin2 = TLE8888_PIN_24;
Tle8888 big update 1 (#1892) * smart gpio: fix tle8888 direct pin mapping for MRE * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 * TLE8888: cleanup * TLE8888: do not reset driver private data on WD/undervoltage reset * TLE8888: diagnostic updates * TLE8888 driver: BIG driver rework * TLE8888: check SPI answers for abnormal states Reply with other than requested register can be a sign of: -Power-On-Reset, then OpStat0 will be replyed -WatchDog reset, then FWDStat1 will be replyed -Invalid communication frame, then Diag0 will be replyed Keep tracking last accessed register and check with the next reply. * TLE8888: debug clean-up * TLE8888: implement spi array write This reduce CS inactive state time between two consequent accesses from 8.8 uS to 1.4 uS * TLE8888: fix PP outputs in OD mode * TLE8888: cleanup register definitions * TLE8888: run separate driver thread for each chip instance Calculating poll interval for few chips become more complex, avoid this running thread for each device. * TLE8888: fix cypress and kinetic compilation Both platforms define its own MAX and cause redifination error if common.h is included in driver. * MRE: update mapping.yaml and fix direct pin mapping for TLE8888 * TLE8888: diagnnostic: disable switch off in case of overcurrent For all output, use current limiting instead * TLE8888: check for overvoltage on OUT8..OUT13 * TLE8888: add TODO note about how to recover from failure condition Currently TLE8888 automaticly recovers only from overcurrent and (may be) overtemperature conditions. Short to bat cause output disable (bit in OECONFIG is reset) and needs driver/host intervention. * TLE8888: save few bytes of RAM * TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888 Don't forget to enable PP mode for TLE8888 outputs 21..24: uncomment line 1087 in tle8888.c * TLE8888: reorder code, cleanup * TLE8888: mode all debug/statisctic to per-chip struct * TLE8888: rework poll interval calculation * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 09:25:30 -07:00
/* IDLE configuration */
engineConfiguration->useStepperIdle = true;
engineConfiguration->useHbridges = true;
engineConfiguration->idleMode = IM_AUTO;
engineConfiguration->useTLE8888_stepper = true;
Tle8888 big update 1 (#1892) * smart gpio: fix tle8888 direct pin mapping for MRE * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 * TLE8888: cleanup * TLE8888: do not reset driver private data on WD/undervoltage reset * TLE8888: diagnostic updates * TLE8888 driver: BIG driver rework * TLE8888: check SPI answers for abnormal states Reply with other than requested register can be a sign of: -Power-On-Reset, then OpStat0 will be replyed -WatchDog reset, then FWDStat1 will be replyed -Invalid communication frame, then Diag0 will be replyed Keep tracking last accessed register and check with the next reply. * TLE8888: debug clean-up * TLE8888: implement spi array write This reduce CS inactive state time between two consequent accesses from 8.8 uS to 1.4 uS * TLE8888: fix PP outputs in OD mode * TLE8888: cleanup register definitions * TLE8888: run separate driver thread for each chip instance Calculating poll interval for few chips become more complex, avoid this running thread for each device. * TLE8888: fix cypress and kinetic compilation Both platforms define its own MAX and cause redifination error if common.h is included in driver. * MRE: update mapping.yaml and fix direct pin mapping for TLE8888 * TLE8888: diagnnostic: disable switch off in case of overcurrent For all output, use current limiting instead * TLE8888: check for overvoltage on OUT8..OUT13 * TLE8888: add TODO note about how to recover from failure condition Currently TLE8888 automaticly recovers only from overcurrent and (may be) overtemperature conditions. Short to bat cause output disable (bit in OECONFIG is reset) and needs driver/host intervention. * TLE8888: save few bytes of RAM * TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888 Don't forget to enable PP mode for TLE8888 outputs 21..24: uncomment line 1087 in tle8888.c * TLE8888: reorder code, cleanup * TLE8888: mode all debug/statisctic to per-chip struct * TLE8888: rework poll interval calculation * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 09:25:30 -07:00
}
#else
void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
2019-08-06 14:12:15 -07:00
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
disableLCD(engineConfiguration);
2016-03-21 13:01:49 -07:00
engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
2016-03-22 12:02:03 -07:00
2016-03-21 13:01:49 -07:00
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
2016-03-22 11:03:44 -07:00
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->triggerInputPins[0] = GPIOA_5;
engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
2016-03-22 11:03:44 -07:00
engineConfiguration->globalTriggerAngleOffset = 114;
engineConfiguration->ignitionPins[0] = GPIOE_14;
engineConfiguration->ignitionPins[1] = GPIOC_7;
engineConfiguration->ignitionPins[2] = GPIOC_9;
engineConfiguration->ignitionPins[3] = GPIOE_12;
2016-03-22 11:03:44 -07:00
engineConfiguration->useStepperIdle = true;
engineConfiguration->fuelPumpPin = GPIOC_13;
engineConfiguration->mainRelayPin = GPIOD_7;
2016-03-22 11:03:44 -07:00
engineConfiguration->idle.stepperDirectionPin = GPIOE_15;
engineConfiguration->idle.stepperStepPin = GPIOE_13;
2016-03-22 11:03:44 -07:00
engineConfiguration->stepperEnablePin = GPIOE_11;
2016-03-21 13:01:49 -07:00
// starter relay solenoid
2019-04-12 19:10:57 -07:00
#if EFI_FSIO
2016-03-21 13:01:49 -07:00
/**
* to test
2017-03-12 11:47:21 -07:00
* set_fsio_setting 1 5000
2016-03-21 13:01:49 -07:00
*/
engineConfiguration->fsio_setting[0] = 500;
2017-03-08 21:05:52 -08:00
// set_rpn_expression 1 "rpm 0 fsio_setting <"
setFsioExt(0, GPIOE_3, RPM_BELOW_USER_SETTING_1, 0 PASS_CONFIG_PARAMETER_SUFFIX);
#endif /* EFI_FSIO */
2016-01-21 15:03:40 -08:00
}
Tle8888 big update 1 (#1892) * smart gpio: fix tle8888 direct pin mapping for MRE * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 * TLE8888: cleanup * TLE8888: do not reset driver private data on WD/undervoltage reset * TLE8888: diagnostic updates * TLE8888 driver: BIG driver rework * TLE8888: check SPI answers for abnormal states Reply with other than requested register can be a sign of: -Power-On-Reset, then OpStat0 will be replyed -WatchDog reset, then FWDStat1 will be replyed -Invalid communication frame, then Diag0 will be replyed Keep tracking last accessed register and check with the next reply. * TLE8888: debug clean-up * TLE8888: implement spi array write This reduce CS inactive state time between two consequent accesses from 8.8 uS to 1.4 uS * TLE8888: fix PP outputs in OD mode * TLE8888: cleanup register definitions * TLE8888: run separate driver thread for each chip instance Calculating poll interval for few chips become more complex, avoid this running thread for each device. * TLE8888: fix cypress and kinetic compilation Both platforms define its own MAX and cause redifination error if common.h is included in driver. * MRE: update mapping.yaml and fix direct pin mapping for TLE8888 * TLE8888: diagnnostic: disable switch off in case of overcurrent For all output, use current limiting instead * TLE8888: check for overvoltage on OUT8..OUT13 * TLE8888: add TODO note about how to recover from failure condition Currently TLE8888 automaticly recovers only from overcurrent and (may be) overtemperature conditions. Short to bat cause output disable (bit in OECONFIG is reset) and needs driver/host intervention. * TLE8888: save few bytes of RAM * TLE8888: Lada Kalina is test mule for IDLE stepper on TLE8888 Don't forget to enable PP mode for TLE8888 outputs 21..24: uncomment line 1087 in tle8888.c * TLE8888: reorder code, cleanup * TLE8888: mode all debug/statisctic to per-chip struct * TLE8888: rework poll interval calculation * MRE: use TLE8888 pins instead of MCU gpios that drives TLE8888 #2
2020-10-23 09:25:30 -07:00
#endif