Hall mode for TLE88888 - VRSConfig1 VRSM #915

This commit is contained in:
rusefi 2019-09-04 00:27:19 -04:00
parent c1c1e59006
commit 07cc3cffff
3 changed files with 16 additions and 3 deletions

View File

@ -85,6 +85,7 @@ typedef enum {
#define CMD_LOCK CMD_WR(0x1e, 0x02)
*/
#define CMD_UNLOCK CMD_WR(0x1e, 0x01)
#define CMD_HALL_MODE CMD_WR(0x4a, 0x3 << 2)
#define CMD_INCONFIG(n, d) CMD_WR(0x53 + (n & 0x03), d)
#define CMD_DDCONFIG(n, d) CMD_WR(0x57 + (n & 0x03), d)
#define CMD_OECONFIG(n, d) CMD_WR(0x5b + (n & 0x03), d)
@ -451,6 +452,15 @@ int tle8888SpiStartupExchange(void * data) {
/* enable outputs */
tle8888_spi_rw(chip, CMD_OE_SET, NULL);
if (cfg->hallMode) {
/**
* By default "auto detection mode for VR sensor signals" is used
* We know that for short Hall signals like Miata NB2 crank sensor this does not work well above certain RPM.
*/
tle8888_spi_rw(chip, CMD_HALL_MODE, NULL);
}
return 0;
}

View File

@ -1,8 +1,8 @@
/*
* tle8888.h
* @file tle8888.h
*
* Created on: Mar 25, 2019
* Author: garage
* Mar 25, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef HW_LAYER_DRIVERS_GPIO_TLE8888_H_
@ -39,6 +39,7 @@ struct tle8888_config {
/* ...used to drive output (starts from 1, as in DS, coders gonna hate) */
int output;
} direct_io[TLE8888_DIRECT_MISC];
bool hallMode;
};
#ifdef __cplusplus

View File

@ -179,6 +179,8 @@ void initSmartGpio() {
tle8888_cfg.spi_config.sspad = getHwPin("tle8888 CS", engineConfiguration->tle8888_cs);
tle8888_cfg.spi_bus = getSpiDevice(engineConfiguration->tle8888spiDevice);
tle8888_cfg.hallMode = engineConfiguration->useTLE8888_hall_mode;
/* spi_bus == null checked in _add function */
ret = tle8888_add(0, &tle8888_cfg);