Mc33 vccp uv (#1445)
* mc33 flash check * DI sanity checks for setting HV config * mc33 VccP (7v) under voltage detection - before and after DRIVEN, useful for regulator broken - or DC-DC logic converter broken Co-authored-by: Christopher W. Anderson <gitstuff@pswitch.com>
This commit is contained in:
parent
94e63e7c43
commit
d43bc81c24
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
EXTERN_CONFIG;
|
EXTERN_CONFIG;
|
||||||
|
|
||||||
|
|
||||||
static OutputPin chipSelect;
|
static OutputPin chipSelect;
|
||||||
static OutputPin resetB;
|
static OutputPin resetB;
|
||||||
static OutputPin driven;
|
static OutputPin driven;
|
||||||
|
@ -212,6 +213,10 @@ static unsigned short readDriverStatus(){
|
||||||
return driverStatus;
|
return driverStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool checkUndervoltVccP(unsigned short driverStatus){
|
||||||
|
return (driverStatus & (1<<0));
|
||||||
|
}
|
||||||
|
|
||||||
static bool checkUndervoltV5(unsigned short driverStatus){
|
static bool checkUndervoltV5(unsigned short driverStatus){
|
||||||
return (driverStatus & (1<<1));
|
return (driverStatus & (1<<1));
|
||||||
}
|
}
|
||||||
|
@ -458,16 +463,18 @@ static void mcRestart() {
|
||||||
|
|
||||||
setup_spi();
|
setup_spi();
|
||||||
|
|
||||||
mcClearDriverStatus();
|
mcClearDriverStatus(); // Initial clear necessary
|
||||||
mcDriverStatus = readDriverStatus();
|
mcDriverStatus = readDriverStatus();
|
||||||
if(checkUndervoltV5(mcDriverStatus)){
|
if(checkUndervoltV5(mcDriverStatus)){
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "MC33 5V Under-Voltage!");
|
firmwareError(OBD_PCM_Processor_Fault, "MC33 5V Under-Voltage!");
|
||||||
|
mcShutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcChipId = readId();
|
mcChipId = readId();
|
||||||
if (!validateChipId()) {
|
if (!validateChipId()) {
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "No comm with MC33");
|
firmwareError(OBD_PCM_Processor_Fault, "No comm with MC33");
|
||||||
|
mcShutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +489,7 @@ static void mcRestart() {
|
||||||
flag0after = efiReadPin(CONFIG(mc33816_flag0));
|
flag0after = efiReadPin(CONFIG(mc33816_flag0));
|
||||||
if (flag0before || !flag0after) {
|
if (flag0before || !flag0after) {
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "MC33 flag0 transition no buena");
|
firmwareError(OBD_PCM_Processor_Fault, "MC33 flag0 transition no buena");
|
||||||
|
mcShutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -491,22 +498,44 @@ static void mcRestart() {
|
||||||
download_register(REG_CH2); // download channel 2 register configurations
|
download_register(REG_CH2); // download channel 2 register configurations
|
||||||
download_register(REG_IO); // download IO register configurations
|
download_register(REG_IO); // download IO register configurations
|
||||||
download_register(REG_DIAG); // download diag register configuration
|
download_register(REG_DIAG); // download diag register configuration
|
||||||
|
|
||||||
// Finished downloading, let's run the code
|
// Finished downloading, let's run the code
|
||||||
enable_flash();
|
enable_flash();
|
||||||
if(!check_flash())
|
if(!check_flash())
|
||||||
{
|
{
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "MC33 no flash");
|
firmwareError(OBD_PCM_Processor_Fault, "MC33 no flash");
|
||||||
|
mcShutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mcDriverStatus = readDriverStatus();
|
||||||
|
if(checkUndervoltVccP(mcDriverStatus)){
|
||||||
|
firmwareError(OBD_PCM_Processor_Fault, "MC33 VccP (7V) Under-Voltage!");
|
||||||
|
mcShutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drive High Voltage if possible
|
||||||
setBoostVoltage(CONFIG(mc33_hvolt));
|
setBoostVoltage(CONFIG(mc33_hvolt));
|
||||||
driven.setValue(1); // driven = HV
|
driven.setValue(1); // driven = HV
|
||||||
|
chThdSleepMilliseconds(10); // Give it a moment
|
||||||
mcDriverStatus = readDriverStatus();
|
mcDriverStatus = readDriverStatus();
|
||||||
if(!checkDrivenEnabled(mcDriverStatus)){
|
if(!checkDrivenEnabled(mcDriverStatus)){
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "MC33 Driven did not stick!");
|
firmwareError(OBD_PCM_Processor_Fault, "MC33 Driven did not stick!");
|
||||||
|
mcShutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mcDriverStatus = readDriverStatus();
|
||||||
|
if(checkUndervoltVccP(mcDriverStatus)){
|
||||||
|
firmwareError(OBD_PCM_Processor_Fault, "MC33 VccP Under-Voltage After Driven"); // Likely DC-DC LS7 is dead!
|
||||||
|
mcShutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mcShutdown() {
|
||||||
|
driven.setValue(0); // ensure HV is off
|
||||||
|
resetB.setValue(0); // turn off the chip
|
||||||
|
}
|
||||||
#endif /* EFI_MC33816 */
|
#endif /* EFI_MC33816 */
|
||||||
|
|
|
@ -25,4 +25,5 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
void initMc33816(Logging *logger);
|
void initMc33816(Logging *logger);
|
||||||
|
static void mcShutdown();
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ const unsigned short MC33816_data_RAM[128] =
|
||||||
const unsigned short MC33816_main_config[29] =
|
const unsigned short MC33816_main_config[29] =
|
||||||
{
|
{
|
||||||
0x0003, 0x1FFE, 0x0000, 0x1200, 0x0000, 0x0000, 0x0001, 0x0000, 0x001F, 0x0000,
|
0x0003, 0x1FFE, 0x0000, 0x1200, 0x0000, 0x0000, 0x0001, 0x0000, 0x001F, 0x0000,
|
||||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue