BV HiZ: broaden voltage range used during tests

This commit is contained in:
King Kévin 2018-04-02 20:44:19 +02:00
parent 72c3fc8677
commit ee184b0144
1 changed files with 7 additions and 5 deletions

View File

@ -186,20 +186,20 @@ static bool busvoodoo_hiz_test_self(bool halt)
sleep_ms(10); // let the voltage regulator start and voltage settle
voltage = busvoodoo_vreg_get(BUSVOODOO_HV_CHANNEL); // get HV voltage
// without being driven it should be around the default voltage
if (voltage<BUSVOODOO_HV_DEFAULT-0.3) {
if (voltage<BUSVOODOO_HV_DEFAULT-0.4) {
printf("HV voltage is lower (%.2fV) than expected (%.2fV) when regulator is enabled\n", voltage, BUSVOODOO_HV_DEFAULT);
goto error;
} else if (voltage>BUSVOODOO_HV_DEFAULT+0.3) {
} else if (voltage>BUSVOODOO_HV_DEFAULT+0.4) {
printf("HV voltage is higher (%.2fV) than expected (%.2fV) when regulator is enabled\n", voltage, BUSVOODOO_HV_DEFAULT);
goto error;
}
// check if we can control HV voltage regulator
voltage = busvoodoo_hv_set(BUSVOODOO_HV_TEST); // set voltage on HV voltage regulator
if (voltage<BUSVOODOO_HV_TEST-0.3) {
if (voltage<BUSVOODOO_HV_TEST-0.4) {
printf("HV voltage is lower (%.2fV) than set (%.2fV)\n", voltage, BUSVOODOO_HV_TEST);
goto error;
} else if (voltage>BUSVOODOO_HV_TEST+0.3) {
} else if (voltage>BUSVOODOO_HV_TEST+0.4) {
printf("HV voltage is higher (%.2fV) than set (%.2fV)\n", voltage, BUSVOODOO_HV_TEST);
goto error;
}
@ -576,7 +576,7 @@ static bool busvoodoo_hiz_test_pins(bool halt)
gpio_set(GPIO(BUSVOODOO_CAN_TX_PORT), GPIO(BUSVOODOO_CAN_TX_PIN)); // set TX high
sleep_us(100); // let voltage settle
voltage = busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL); // get output voltage
if (voltage<0.5) { // normally the lower limit is 2V, put pin 4 pulls it down because it is not strongly driven
if (voltage<0.4) { // normally the lower limit is 2V, put pin 4 pulls it down because it is not strongly driven
printf("CAN L output is low while it should be at recessive 2.5V\n");
goto error;
}
@ -786,6 +786,7 @@ static void busvoodoo_hiz_command_test_self(void* argument)
halt = true;
} else {
printf("malformed argument\n");
return;
}
}
printf("performing self-test\n");
@ -821,6 +822,7 @@ static void busvoodoo_hiz_command_test_pins(void* argument)
halt = true;
} else {
printf("malformed argument\n");
return;
}
}
printf("performing pins test\n");