MC restart

This commit is contained in:
rusefi 2020-04-14 19:23:53 -04:00
parent ca7017107d
commit ae8936b93b
2 changed files with 25 additions and 3 deletions

View File

@ -528,10 +528,12 @@ void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// default spi3sckPin PB3 // default spi3sckPin PB3
CONFIG(triggerSimulatorPins[0]) = GPIO_UNASSIGNED;
// blue // blue
CONFIG(mc33816_cs) = GPIOD_7; CONFIG(mc33816_cs) = GPIOD_7;
// green // green
CONFIG(mc33816_rstb) = GPIOD_5; CONFIG(mc33816_rstb) = GPIOD_4;
// yellow // yellow
CONFIG(mc33816_driven) = GPIOD_6; CONFIG(mc33816_driven) = GPIOD_6;

View File

@ -65,6 +65,9 @@ static void showStats() {
} }
} }
static void mcRestart();
// Mostly unused // Mostly unused
unsigned short recv_16bit_spi() { unsigned short recv_16bit_spi() {
unsigned short ret; unsigned short ret;
@ -316,13 +319,16 @@ void initMc33816(Logging *sharedLogger) {
if (CONFIG(mc33816_driven) == GPIO_UNASSIGNED) if (CONFIG(mc33816_driven) == GPIO_UNASSIGNED)
return; return;
if (CONFIG(mc33816_flag0) != GPIO_UNASSIGNED) {
efiSetPadMode("mc33816 flag0", CONFIG(mc33816_flag0), getInputMode(PI_DEFAULT));
}
chipSelect.initPin("mc33 CS", engineConfiguration->mc33816_cs /*, &engineConfiguration->csPinMode*/);
// Initialize the chip via ResetB // Initialize the chip via ResetB
resetB.initPin("mc33 RESTB", engineConfiguration->mc33816_rstb); resetB.initPin("mc33 RESTB", engineConfiguration->mc33816_rstb);
// High Voltage via DRIVEN // High Voltage via DRIVEN
driven.initPin("mc33 DRIVEN", engineConfiguration->mc33816_driven); driven.initPin("mc33 DRIVEN", engineConfiguration->mc33816_driven);
driven.setValue(0); // ensure driven is off
chipSelect.initPin("mc33 CS", engineConfiguration->mc33816_cs /*, &engineConfiguration->csPinMode*/);
spiCfg.ssport = getHwPort("hip", CONFIG(mc33816_cs)); spiCfg.ssport = getHwPort("hip", CONFIG(mc33816_cs));
spiCfg.sspad = getHwPin("hip", CONFIG(mc33816_cs)); spiCfg.sspad = getHwPin("hip", CONFIG(mc33816_cs));
@ -336,11 +342,25 @@ void initMc33816(Logging *sharedLogger) {
return; return;
} }
spiStart(driver, &spiCfg); spiStart(driver, &spiCfg);
addConsoleAction("mc33_stats", showStats); addConsoleAction("mc33_stats", showStats);
addConsoleAction("mc33_restart", mcRestart);
//addConsoleActionI("mc33_send", sendWord); //addConsoleActionI("mc33_send", sendWord);
mcRestart();
}
static void mcRestart() {
scheduleMsg(logger, "MC Restart");
showStats();
driven.setValue(0); // ensure driven is off
// Does starting turn this high to begin with?? // Does starting turn this high to begin with??
spiUnselect(driver); spiUnselect(driver);