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:
NOx-z 2020-05-11 18:11:16 -07:00 committed by GitHub
parent 8069605091
commit 2e3c142993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 6 deletions

View File

@ -191,16 +191,23 @@ static bool check_flash() {
return true;
}
static unsigned short readDriverStatus(){
// Note: There is a config at 0x1CE & 1 that can reset this status reg on read
// otherwise the reload/recheck occurs with a write
// resetting it is necessary to reload - if the interrupt condition has been resolved
static void mcClearDriverStatus(){
// Note: There is a config at 0x1CE & 1 that can reset this status config register on read
// otherwise the reload/recheck occurs with this write
// 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;
setup_spi(); // ensure on common page?
spiSelect(driver);
spi_writew((0x8000 | 0x1D2 << 5) + 1);
driverStatus = recv_16bit_spi();
spi_writew((0x8000 | 0x1D2 << 5) + 1);
driverStatus = recv_16bit_spi();
spiUnselect(driver);
return driverStatus;
}
@ -451,6 +458,7 @@ static void mcRestart() {
setup_spi();
mcClearDriverStatus();
mcDriverStatus = readDriverStatus();
if(checkUndervoltV5(mcDriverStatus)){
firmwareError(OBD_PCM_Processor_Fault, "MC33 5V Under-Voltage!");