Mc33 undervolt (#1423)
* mc33 flash check * DI sanity checks for setting HV config * mc33 under voltage check * mc33 under voltage check * mc33 clear driver status on startup Co-authored-by: Christopher W. Anderson <gitstuff@pswitch.com>
This commit is contained in:
parent
8069605091
commit
2e3c142993
|
@ -191,16 +191,23 @@ static bool check_flash() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short readDriverStatus(){
|
static void mcClearDriverStatus(){
|
||||||
// Note: There is a config at 0x1CE & 1 that can reset this status reg on read
|
// Note: There is a config at 0x1CE & 1 that can reset this status config register on read
|
||||||
// otherwise the reload/recheck occurs with a write
|
// otherwise the reload/recheck occurs with this write
|
||||||
// resetting it is necessary to reload - if the interrupt condition has been resolved
|
// resetting it is necessary to clear default reset behavoir, as well as if an issue has been resolved
|
||||||
|
setup_spi(); // ensure on common page?
|
||||||
|
spiSelect(driver);
|
||||||
|
spi_writew((0x0000 | 0x1D2 << 5) + 1); // write, location, one word
|
||||||
|
spi_writew(0x0000); // anything to clear
|
||||||
|
spiUnselect(driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned short readDriverStatus(){
|
||||||
unsigned short driverStatus;
|
unsigned short driverStatus;
|
||||||
setup_spi(); // ensure on common page?
|
setup_spi(); // ensure on common page?
|
||||||
spiSelect(driver);
|
spiSelect(driver);
|
||||||
spi_writew((0x8000 | 0x1D2 << 5) + 1);
|
spi_writew((0x8000 | 0x1D2 << 5) + 1);
|
||||||
driverStatus = recv_16bit_spi();
|
driverStatus = recv_16bit_spi();
|
||||||
spiUnselect(driver);
|
spiUnselect(driver);
|
||||||
return driverStatus;
|
return driverStatus;
|
||||||
}
|
}
|
||||||
|
@ -451,6 +458,7 @@ static void mcRestart() {
|
||||||
|
|
||||||
setup_spi();
|
setup_spi();
|
||||||
|
|
||||||
|
mcClearDriverStatus();
|
||||||
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!");
|
||||||
|
|
Loading…
Reference in New Issue