Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX541 USBDevice
Diff: main.cpp
- Revision:
- 5:82037e281451
- Parent:
- 3:8913cb4a8b9f
- Child:
- 6:dc823dc85234
--- a/main.cpp Mon Jun 10 17:41:01 2019 +0000 +++ b/main.cpp Thu Jun 20 00:26:29 2019 +0000 @@ -31,18 +31,6 @@ ******************************************************************************* */ -#include "mbed.h" -#include "USBSerial.h" - -#include "CmdLine.h" -#include "MaximTinyTester.h" - -#include "MAX5715.h" - -// TODO: trim cruft - - - //---------------------------------------------------------------------- // mbed-os compatability tests... //---------------------------------------------------------------------- @@ -424,15 +412,7 @@ #include "MAX541.h" -#ifndef USE_MAXIMTINYTESTER -#define USE_MAXIMTINYTESTER 1 -#endif // USE_MAXIMTINYTESTER -#if USE_MAXIMTINYTESTER #include "MaximTinyTester.h" -#endif // USE_MAXIMTINYTESTER -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -#endif // USE_MAXIMTINYTESTER //-------------------------------------------------- // Option to dedicate SPI port pins @@ -3493,42 +3473,8 @@ //-------------------------------------------------- // TODO1: use MaximTinyTester encapsulate SelfTest support functions -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -int g_SelfTest_nPass = 0; // PASS test counter used by SelfTest() -int g_SelfTest_nFail = 0; // FAIL test counter used by SelfTest() -#endif // USE_MAXIMTINYTESTER -//-------------------------------------------------- -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -void SelfTest_PASS(CmdLine& cmdLine) -{ - ++g_SelfTest_nPass; - cmdLine.serial().printf("\r\n+PASS "); -} -#endif // USE_MAXIMTINYTESTER -//-------------------------------------------------- -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -void SelfTest_FAIL(CmdLine& cmdLine) -{ - ++g_SelfTest_nFail; - cmdLine.serial().printf("\r\n-FAIL "); -#if USE_LEDS - rgb_led.red(); // diagnostic rbg led RED - //~ rgb_led.green(); // diagnostic rbg led GREEN - //~ rgb_led.blue(); // diagnostic rbg led BLUE - //~ rgb_led.white(); // diagnostic rbg led RED+GREEN+BLUE=WHITE - //~ rgb_led.cyan(); // diagnostic rbg led GREEN+BLUE=CYAN - //~ rgb_led.magenta(); // diagnostic rbg led RED+BLUE=MAGENTA - //~ rgb_led.yellow(); // diagnostic rbg led RED+GREEN=YELLOW - //~ rgb_led.black(); // diagnostic rbg led BLACK -#endif // USE_LEDS -} -#endif // USE_MAXIMTINYTESTER //-------------------------------------------------- #if APPLICATION_MAX5715 // SelfTest -#if USE_MAXIMTINYTESTER // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ @@ -3553,22 +3499,18 @@ // void (*fn_MAX5715_CODEnLOADn)(uint8_t channel_0_3, uint16_t dacCodeLsbs) = [](uint8_t channel_0_3, uint16_t dacCodeLsbs){ return g_MAX5715_device.CODEnLOADn(channel_0_3, dacCodeLsbs); }; void fn_MAX5715_CODEnLOADn (uint8_t channel_0_3, uint16_t dacCodeLsbs) { return g_MAX5715_device.CODEnLOADn(channel_0_3, dacCodeLsbs); }; // -#endif // USE_MAXIMTINYTESTER #endif // APPLICATION_MAX5715 // SelfTest //-------------------------------------------------- #if APPLICATION_MAX11131 // SelfTest -#if USE_MAXIMTINYTESTER // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ // // define function under test using C++11 lambda expression [](){} // -#endif // USE_MAXIMTINYTESTER #endif // APPLICATION_MAX11131 // SelfTest //-------------------------------------------------- #if APPLICATION_MAX5171 // SelfTest -#if USE_MAXIMTINYTESTER // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ @@ -3594,29 +3536,24 @@ uint8_t fn_MAX5171_CODE_LOAD(uint16_t dacCodeLsbs) { return g_MAX5171_device.CODE_LOAD(dacCodeLsbs); }; // // -#endif // USE_MAXIMTINYTESTER #endif // APPLICATION_MAX5171 // SelfTest //-------------------------------------------------- #if APPLICATION_MAX11410 // SelfTest -#if USE_MAXIMTINYTESTER // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ // // define function under test using C++11 lambda expression [](){} // -#endif // USE_MAXIMTINYTESTER #endif // APPLICATION_MAX11410 // SelfTest //-------------------------------------------------- #if APPLICATION_MAX12345 // SelfTest -#if USE_MAXIMTINYTESTER // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ // // define function under test using C++11 lambda expression [](){} // -#endif // USE_MAXIMTINYTESTER #endif // APPLICATION_MAX12345 // SelfTest //-------------------------------------------------- void SelfTest_print_DACCodeOfVoltage(CmdLine& cmdLine, double voltageV) @@ -3629,252 +3566,13 @@ //~ cmdLine.serial().printf("V)"); } //-------------------------------------------------- -#if APPLICATION_MAX5715 // SelfTest -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -void SelfTest_DACCodeOfVoltage_Expect(CmdLine& cmdLine, double voltageV, uint16_t expect_result) -{ - uint16_t actual_result = g_MAX5715_device.DACCodeOfVoltage(voltageV); - if (actual_result != expect_result) - { - SelfTest_FAIL(cmdLine); - SelfTest_print_DACCodeOfVoltage(cmdLine, voltageV); - cmdLine.serial().printf(" expect %d", expect_result); - cmdLine.serial().printf(" but got %d", actual_result); - } - else - { - SelfTest_PASS(cmdLine); - SelfTest_print_DACCodeOfVoltage(cmdLine, voltageV); - cmdLine.serial().printf(" expect %d", expect_result); - } - //~ cmdLine.serial().printf("\r\n"); -} -#endif // APPLICATION_MAX5715 -#endif // USE_MAXIMTINYTESTER -//-------------------------------------------------- -#if APPLICATION_MAX5171 // SelfTest -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -void SelfTest_DACCodeOfVoltage_Expect(CmdLine& cmdLine, double voltageV, uint16_t expect_result) -{ - uint16_t actual_result = g_MAX5171_device.DACCodeOfVoltage(voltageV); - if (actual_result != expect_result) - { - SelfTest_FAIL(cmdLine); - SelfTest_print_DACCodeOfVoltage(cmdLine, voltageV); - cmdLine.serial().printf(" expect %d", expect_result); - cmdLine.serial().printf(" but got %d", actual_result); - } - else - { - SelfTest_PASS(cmdLine); - SelfTest_print_DACCodeOfVoltage(cmdLine, voltageV); - cmdLine.serial().printf(" expect %d", expect_result); - } - //~ cmdLine.serial().printf("\r\n"); -} -#endif // USE_MAXIMTINYTESTER -#endif // APPLICATION_MAX5171 -//-------------------------------------------------- -#if APPLICATION_MAX5715 // SelfTest -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -void SelfTest_print_VoltageOfCode(CmdLine& cmdLine, uint16_t value_u12) -{ - cmdLine.serial().printf("VoltageOfCode(%d)", value_u12); - //~ dtostrf(voltageV, 6, 4, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - //~ cmdLine.serial().printf(")"); -} -/* SelfTest_VoltageOfCode_Expect - * - * TODO: document this function - * This header was inserted by uncrustify; see uncrustify_func_header.txt. - * - */ -void SelfTest_VoltageOfCode_Expect(CmdLine& cmdLine, uint16_t value_u12, double expect_result) -{ - double actual_result = g_MAX5715_device.VoltageOfCode(value_u12); - double err_result = (actual_result - expect_result); - double one_LSB = (g_MAX5715_device.VRef / 4095); // 12-bit DAC FS - double err_threshold = one_LSB; - if (( -err_threshold < err_result) && ( err_result < err_threshold)) - { - SelfTest_PASS(cmdLine); - SelfTest_print_VoltageOfCode(cmdLine, value_u12); - cmdLine.serial().printf(" expect %6.6f", expect_result); - //~ dtostrf(expect_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - } - else - { - SelfTest_FAIL(cmdLine); - SelfTest_print_VoltageOfCode(cmdLine, value_u12); - cmdLine.serial().printf(" expect %6.6f", expect_result); - //~ dtostrf(expect_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - cmdLine.serial().printf(" but got %6.6f", actual_result); - //~ dtostrf(actual_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - cmdLine.serial().printf(" err=%6.6f", err_result); - //~ dtostrf( err_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - } - //~ cmdLine.serial().printf("\r\n"); -} -#endif // USE_MAXIMTINYTESTER -#endif // APPLICATION_MAX5715 -//-------------------------------------------------- #if APPLICATION_MAX5171 // SelfTest void SelfTest_print_VoltageOfCode(CmdLine& cmdLine, uint16_t value_u14) { cmdLine.serial().printf("VoltageOfCode(%d)", value_u14); } -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -/* SelfTest_VoltageOfCode_Expect - * - * TODO: document this function - * This header was inserted by uncrustify; see uncrustify_func_header.txt. - * - */ -void SelfTest_VoltageOfCode_Expect(CmdLine& cmdLine, uint16_t value_u14, double expect_result) -{ - double actual_result = g_MAX5171_device.VoltageOfCode(value_u14); - double err_result = (actual_result - expect_result); - double one_LSB = (g_MAX5171_device.VRef / 16383); // 14-bit DAC FS - double err_threshold = one_LSB; - if (( -err_threshold < err_result) && ( err_result < err_threshold)) - { - SelfTest_PASS(cmdLine); - SelfTest_print_VoltageOfCode(cmdLine, value_u14); - cmdLine.serial().printf(" expect %6.6f", expect_result); - //~ dtostrf(expect_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - } - else - { - SelfTest_FAIL(cmdLine); - SelfTest_print_VoltageOfCode(cmdLine, value_u14); - cmdLine.serial().printf(" expect %6.6f", expect_result); - //~ dtostrf(expect_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - cmdLine.serial().printf(" but got %6.6f", actual_result); - //~ dtostrf(actual_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - cmdLine.serial().printf(" err=%6.6f", err_result); - //~ dtostrf( err_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - } - //~ cmdLine.serial().printf("\r\n"); -} -#endif // USE_MAXIMTINYTESTER #endif // APPLICATION_MAX5171 //-------------------------------------------------- -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -bool SelfTest_AnalogInput_Expect_ch_V(CmdLine& cmdLine, int pinIndex, double expect_result, - double err_threshold = 0.030) -{ -#if analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. - // low range channels AIN0, AIN1, AIN2, AIN3 - int pinIndexL = ((pinIndex >= 4) ? (pinIndex - 4) : (pinIndex + 0)); - // high range channels AIN4, AIN5 - int pinIndexH = ((pinIndex >= 4) ? (pinIndex + 0) : (pinIndex + 4)); - // - // low range channels AIN0, AIN1, AIN2, AIN3 - int cPinIndexL = '0' + pinIndexL; - AnalogIn& analogInPinL = find_analogInPin(cPinIndexL); - float adc_full_scale_voltageL = analogInPin_fullScaleVoltage[pinIndexL]; - float normValueL_0_1 = analogInPinL.read(); - // - // high range channels AIN4, AIN5 - int cPinIndexH = '0' + pinIndexH; - AnalogIn& analogInPinH = find_analogInPin(cPinIndexH); - float adc_full_scale_voltageH = analogInPin_fullScaleVoltage[pinIndexH]; - float normValueH_0_1 = analogInPinH.read(); - // - double actual_result = (pinIndex >= 4) - ? (normValueH_0_1 * adc_full_scale_voltageH) - : (normValueL_0_1 * adc_full_scale_voltageL); -#else // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses simple analog inputs - int cPinIndex = '0' + pinIndex; - AnalogIn& analogInPin = find_analogInPin(cPinIndex); - float adc_full_scale_voltage = analogInPin_fullScaleVoltage[pinIndex]; - float normValue_0_1 = analogInPin.read(); - double actual_result = normValue_0_1 * adc_full_scale_voltage; -#endif // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - double err_result = (actual_result - expect_result); - //double err_threshold = 0.030; // 30mV - if (( -err_threshold < err_result) && ( err_result < err_threshold)) - { - SelfTest_PASS(cmdLine); - //~ SelfTest_print_VoltageOfCode(cmdLine, value_u12); -#if analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. - cmdLine.serial().printf("AIN%c = %7.3f%% = %1.3fV AIN%c = %7.3f%% = %1.3fV ", - cPinIndexL, - normValueL_0_1 * 100.0, - normValueL_0_1 * adc_full_scale_voltageL, - cPinIndexH, - normValueH_0_1 * 100.0, - normValueH_0_1 * adc_full_scale_voltageH - ); -#else // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses simple analog inputs - cmdLine.serial().printf("AIN%c = %7.3f%% = %1.3fV ", - cPinIndex, - normValue_0_1 * 100.0, - normValue_0_1 * adc_full_scale_voltage - ); -#endif // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // - cmdLine.serial().printf(" expect %6.6f +/- %6.6f", expect_result, err_threshold); - //~ dtostrf(expect_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - return true; - } - else - { - SelfTest_FAIL(cmdLine); - //~ SelfTest_print_VoltageOfCode(cmdLine, value_u12); -#if analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. - cmdLine.serial().printf("AIN%c = %7.3f%% = %1.3fV AIN%c = %7.3f%% = %1.3fV ", - cPinIndexL, - normValueL_0_1 * 100.0, - normValueL_0_1 * adc_full_scale_voltageL, - cPinIndexH, - normValueH_0_1 * 100.0, - normValueH_0_1 * adc_full_scale_voltageH - ); -#else // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses simple analog inputs - cmdLine.serial().printf("AIN%c = %7.3f%% = %1.3fV ", - cPinIndex, - normValue_0_1 * 100.0, - normValue_0_1 * adc_full_scale_voltage - ); -#endif // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // - cmdLine.serial().printf(" expect %6.6f +/- %6.6f", expect_result, err_threshold); - //~ dtostrf(expect_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - cmdLine.serial().printf(" but got %6.6f", actual_result); - //~ dtostrf(actual_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - cmdLine.serial().printf(" err=%6.6f", err_result); - //~ dtostrf( err_result, 6, 6, strOutLineBuffer); // value, width, precision, char* buffer - //~ cmdLine.serial().printf(strOutLineBuffer); - } - //~ cmdLine.serial().printf("\r\n"); - return false; -} -#endif // USE_MAXIMTINYTESTER -//-------------------------------------------------- #if APPLICATION_MAX5715 // SelfTest void SelfTest_print_Vref(CmdLine & cmdLine) { @@ -3909,7 +3607,6 @@ // cmdLine.serial().printf("\r\n Test Fixture: MAX541 set output to %1.3fV = code 0x%4.4x", max541.Get_Voltage(), max541.Get_Code()); cmdLine.serial().printf("\r\n Test Fixture: MAX541 set output to 0x%4.4x = %1.3fV", max541.Get_Code(), max541.Get_Voltage()); -#if USE_MAXIMTINYTESTER #if analogIn4_IS_HIGH_RANGE_OF_analogIn0 // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. MaximTinyTester tinyTester(cmdLine, analogIn4, analogIn5, analogIn2, analogIn3, analogIn0, analogIn4); @@ -3930,68 +3627,15 @@ tinyTester.analogInPin_fullScaleVoltage[4] = analogInPin_fullScaleVoltage[4]; // board support tinyTester.analogInPin_fullScaleVoltage[5] = analogInPin_fullScaleVoltage[5]; // board support #endif + tinyTester.Wait_Output_Settling(); // wait for MAX541 to settle // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; return tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - return SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, voltageV, 0.100); -#endif // USE_MAXIMTINYTESTER } //-------------------------------------------------- -#if APPLICATION_MAX11131 -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -bool SelfTest_MAX11131_EOC_expect(CmdLine & cmdLine, int expect_EOC_value, const char *expect_description) -{ - int actual_EOC_value = -1; - for (int retry_count = 0; retry_count < 10; retry_count++) { - actual_EOC_value = g_MAX11131_device.EOCinputValue(); - if (actual_EOC_value == expect_EOC_value) { - SelfTest_PASS(cmdLine); - cmdLine.serial().printf("EOC signal=%d %s", expect_EOC_value, expect_description); - return true; - } - // EOC condition not met, retry for a while until give up - wait_ms(100); // delay - } - cmdLine.serial().printf("\r\n!WARN "); // SelfTest_FAIL(cmdLine); - cmdLine.serial().printf("expected EOC signal=%d %s", expect_EOC_value, expect_description); - cmdLine.serial().printf(", but got actual EOC=%d", actual_EOC_value); - cmdLine.serial().printf(", missing CNVST or EOC connections?"); - return false; -} -#endif // USE_MAXIMTINYTESTER -#endif -//-------------------------------------------------- -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -#if APPLICATION_MAX5171 -bool SelfTest_Expect_Input_UPO_pin(CmdLine & cmdLine, int expect_UPO_value, const char *expect_description) -{ - int actual_UPO_value = -1; - for (int retry_count = 0; retry_count < 10; retry_count++) { - actual_UPO_value = UPO_pin.read(); // g_MAX5171_device.UPOinputValue(); - if (actual_UPO_value == expect_UPO_value) { - SelfTest_PASS(cmdLine); - cmdLine.serial().printf("UPO signal=%d %s", expect_UPO_value, expect_description); - return true; - } - // UPO condition not met, retry for a while until give up - wait_ms(100); // delay - } - cmdLine.serial().printf("\r\n!WARN "); // SelfTest_FAIL(cmdLine); - cmdLine.serial().printf("expected UPO signal=%d %s", expect_UPO_value, expect_description); - cmdLine.serial().printf(", but got actual UPO=%d", actual_UPO_value); - cmdLine.serial().printf(", missing UPO connections?"); - return false; -} -#endif // APPLICATION_MAX5171 -#endif // USE_MAXIMTINYTESTER -//-------------------------------------------------- void SelfTest(CmdLine & cmdLine) { //-------------------------------------------------- -#if USE_MAXIMTINYTESTER #if analogIn4_IS_HIGH_RANGE_OF_analogIn0 // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. // MaximTinyTester(Stream& AssociatedSerialPort, const char *Name); @@ -4014,11 +3658,6 @@ tinyTester.analogInPin_fullScaleVoltage[4] = analogInPin_fullScaleVoltage[4]; // board support tinyTester.analogInPin_fullScaleVoltage[5] = analogInPin_fullScaleVoltage[5]; // board support #endif -#else // USE_MAXIMTINYTESTER - //-------------------------------------------------- - g_SelfTest_nPass = 0; - g_SelfTest_nFail = 0; -#endif // USE_MAXIMTINYTESTER #if USE_LEDS //~ rgb_led.red(); // diagnostic rbg led RED //~ rgb_led.green(); // diagnostic rbg led GREEN @@ -4031,8 +3670,7 @@ #endif // USE_LEDS #if APPLICATION_MAX5715 // SelfTest // - // TODO: tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect -#if USE_MAXIMTINYTESTER + // tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ @@ -4052,19 +3690,6 @@ // void MAX5715::CODEnLOADn(uint8_t channel_0_3, uint16_t dacCodeLsbs) //void (*fn_MAX5715_CODEnLOADn)(uint8_t channel_0_3, uint16_t dacCodeLsbs) = [](uint8_t channel_0_3, uint16_t dacCodeLsbs){ return g_MAX5715_device.CODEnLOADn(channel_0_3, dacCodeLsbs); }; // -#else // USE_MAXIMTINYTESTER - // - // VERIFY: self-test uint16_t MAX5715_DACCodeOfVoltage(double voltageV) - // @pre g_MAX5715_device.VRef = Voltage of REF input, in Volts - // @param[in] voltage = physical voltage in Volts - // @returns raw 12-bit MAX5715 code (right justified). - // - // VERIFY: self-test double MAX5715_VoltageOfCode(uint16_t value_u12) - // @pre g_MAX5715_device.VRef = Voltage of REF input, in Volts - // @param[in] value_u12: raw 12-bit MAX5715 code (right justified). - // @Returns physical voltage corresponding to MAX5715 code. - // -#endif // USE_MAXIMTINYTESTER // // // @@ -4074,7 +3699,6 @@ SelfTest_print_Vref(cmdLine); //~ cmdLine.serial().printf("\r\n"); // -#if USE_MAXIMTINYTESTER // tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, 10.0, 0x0FFF); // overrange FS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, 4.0950, 0x0FFF); @@ -4108,42 +3732,7 @@ tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -0.0001, 0x0000); // overrange ZS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -0.0002, 0x0000); // overrange ZS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -1.0, 0x0000); // overrange ZS -#else // USE_MAXIMTINYTESTER - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 10.0, 0x0FFF); // overrange FS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0950, 0x0FFF); // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0945, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0944, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0943, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0942, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0941, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0940, 0x0FFE); // search for code transition - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0939, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0938, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0937, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0936, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0935, 0x0FFD); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 4.0930, 0x0FFD); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0480, 0x0800); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0470, 0x07FF); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.0000, 0x03E8); // 1.0 volt - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0030, 0x0003); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0020, 0x0002); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0010, 0x0001); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0000, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -0.0001, 0x0000); // overrange ZS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -0.0002, 0x0000); // overrange ZS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -1.0, 0x0000); // overrange ZS -#endif // USE_MAXIMTINYTESTER - // -#if USE_MAXIMTINYTESTER // tinyTester.FunctionCall_Expect replaces SelfTest_VoltageOfCode_Expect tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0FFF, 4.0950); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0FFE, 4.0940); @@ -4152,22 +3741,12 @@ tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x03E8, 1.0000); // 1.0 volt tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0001, 0.0010); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0000, 0.0000); -#else // USE_MAXIMTINYTESTER - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFF, 4.0950); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFE, 4.0940); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0800, 2.0480); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x07FF, 2.0470); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x03E8, 1.0000); // 1.0 volt - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0001, 0.0010); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0000, 0.0000); -#endif // USE_MAXIMTINYTESTER // //------------------------------------------------------------ cmdLine.serial().printf("\r\n"); g_MAX5715_device.VRef = 2.048; // 12-bit LSB = 0.0005V SelfTest_print_Vref(cmdLine); //~ cmdLine.serial().printf("\r\n"); -#if USE_MAXIMTINYTESTER // tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, 10.0, 0x0FFF); // overrange FS // @@ -4222,62 +3801,6 @@ tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -0.0001, 0x0000); // overrange ZS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -0.0002, 0x0000); // overrange ZS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -1.0, 0x0000); // overrange ZS -#else // USE_MAXIMTINYTESTER - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 10.0, 0x0FFF); // overrange FS - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0480, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0479, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0478, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0477, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0476, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0475, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0474, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0473, 0x0FFF); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0472, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0471, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0470, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0469, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0468, 0x0FFE); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0467, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0466, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0465, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0464, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.0463, 0x0FFD); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.0240, 0x0800); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.0235, 0x07FF); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.0000, 0x07D0); // 1.0 volt - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0017, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0016, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0015, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0014, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0013, 0x0003); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0012, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0011, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0010, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0009, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0008, 0x0002); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0007, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0006, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0005, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0004, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0003, 0x0001); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0002, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0001, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0000, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -0.0001, 0x0000); // overrange ZS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -0.0002, 0x0000); // overrange ZS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -1.0, 0x0000); // overrange ZS -#endif // USE_MAXIMTINYTESTER -#if USE_MAXIMTINYTESTER // tinyTester.FunctionCall_Expect replaces SelfTest_VoltageOfCode_Expect tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0FFF, 2.0475); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0FFE, 2.0470); @@ -4288,17 +3811,6 @@ tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0002, 0.0010); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0001, 0.0005); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0000, 0.0000); -#else // USE_MAXIMTINYTESTER - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFF, 2.0475); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFE, 2.0470); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFD, 2.0465); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0800, 1.0240); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x07FF, 1.0235); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x07D0, 1.0000); // 1.0 volt - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0002, 0.0010); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0001, 0.0005); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0000, 0.0000); -#endif // USE_MAXIMTINYTESTER // // //------------------------------------------------------------ @@ -4306,7 +3818,6 @@ g_MAX5715_device.VRef = 2.500; // 12-bit LSB = 0.0006105006105006105V SelfTest_print_Vref(cmdLine); //~ cmdLine.serial().printf("\r\n"); -#if USE_MAXIMTINYTESTER // tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, 10.0, 0x0FFF); // overrange FS // @@ -4378,79 +3889,6 @@ tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -0.0001, 0x0000); // overrange ZS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -0.0002, 0x0000); // overrange ZS tinyTester.FunctionCall_Expect("MAX5715.DACCodeOfVoltage", fn_MAX5715_DACCodeOfVoltage, -1.0, 0x0000); // overrange ZS -#else // USE_MAXIMTINYTESTER - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 10.0, 0x0FFF); // overrange FS - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.5000, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4999, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4998, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4997, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4996, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4995, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4994, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4993, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4992, 0x0FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4991, 0x0FFF); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4990, 0x0FFE); // search for code transitions - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4989, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4988, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4987, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4986, 0x0FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4985, 0x0FFE); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4984, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4983, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4982, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4981, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4980, 0x0FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4979, 0x0FFD); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4978, 0x0FFC); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4977, 0x0FFC); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4976, 0x0FFC); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4975, 0x0FFC); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4974, 0x0FFC); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4973, 0x0FFC); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4972, 0x0FFB); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4971, 0x0FFB); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4970, 0x0FFB); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.2500, 0x0800); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.2494, 0x07FF); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.0000, 0x0666); // 1.0 volt - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0019, 0x0003); // search for code transitions - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0018, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0017, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0016, 0x0003); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0015, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0014, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0013, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0012, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0011, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0010, 0x0002); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0009, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0008, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0007, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0006, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0005, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0004, 0x0001); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0003, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0002, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0001, 0x0000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.0000, 0x0000); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -0.0001, 0x0000); // overrange ZS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -0.0002, 0x0000); // overrange ZS - SelfTest_DACCodeOfVoltage_Expect(cmdLine, -1.0, 0x0000); // overrange ZS -#endif // USE_MAXIMTINYTESTER -#if USE_MAXIMTINYTESTER // tinyTester.FunctionCall_Expect replaces SelfTest_VoltageOfCode_Expect tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0FFF, 2.5000); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0FFE, 2.4988); @@ -4465,21 +3903,6 @@ tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0002, 0.0012); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0001, 0.0006); tinyTester.FunctionCall_Expect("MAX5715.VoltageOfCode", fn_MAX5715_VoltageOfCode, 0x0000, 0.0000); -#else // USE_MAXIMTINYTESTER - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFF, 2.5000); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFE, 2.4988); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0FFD, 2.4976); - // - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0800, 1.2500); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x07FF, 1.2494); - // - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0667, 1.0000); // 1.0 volt - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0666, 1.0000); // 1.0 volt - // - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0002, 0.0012); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0001, 0.0006); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0000, 0.0000); -#endif // USE_MAXIMTINYTESTER // // // Device Testing: DAC commands, verify using on-board ADC inputs @@ -4498,43 +3921,28 @@ // cmdLine.serial().printf("\r\n MAX5715.REF(MAX5715::REF_AlwaysOn_2V048)"); g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V048); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.030; // 30mV tinyTester.AnalogIn0_Read_Expect_voltageV(2.048); -#else // USE_MAXIMTINYTESTER - wait_ms(100); // delay - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, 2.048); -#endif // USE_MAXIMTINYTESTER // cmdLine.serial().printf("\r\n MAX5715.REF(MAX5715::REF_AlwaysOn_4V096)"); g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_4V096); // MAX32625MBED 4.096V may be as low as 3.3V supply -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.50; // 30mV tinyTester.AnalogIn0_Read_Expect_voltageV(3.750); // accept 3.25V to 4.25V -#else // USE_MAXIMTINYTESTER - wait_ms(100); // delay - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, 3.750, 0.50); // accept 3.25V to 4.25V -#endif // USE_MAXIMTINYTESTER // cmdLine.serial().printf("\r\n MAX5715.REF(MAX5715::REF_AlwaysOn_2V500)"); g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V500); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.030; // 30mV tinyTester.AnalogIn0_Read_Expect_voltageV(2.500); -#else // USE_MAXIMTINYTESTER - wait_ms(100); // delay - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, 2.500); -#endif // USE_MAXIMTINYTESTER // // test the individual channel outputs ch = 0; @@ -4542,85 +3950,54 @@ code = g_MAX5715_device.DACCodeOfVoltage(voltageV); cmdLine.serial().printf("\r\n MAX5715.CODEnLOADn ch=%d code=%d", ch, code); g_MAX5715_device.CODEnLOADn(ch, code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.030; // 30mV tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, ch, voltageV); -#endif // USE_MAXIMTINYTESTER // ch = 1; voltageV = 0.2; code = g_MAX5715_device.DACCodeOfVoltage(voltageV); cmdLine.serial().printf("\r\n MAX5715.CODEnLOADn ch=%d code=%d", ch, code); g_MAX5715_device.CODEnLOADn(ch, code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.030; // 30mV tinyTester.AnalogIn1_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, ch, voltageV); -#endif // USE_MAXIMTINYTESTER // ch = 2; voltageV = 0.4; code = g_MAX5715_device.DACCodeOfVoltage(voltageV); cmdLine.serial().printf("\r\n MAX5715.CODEnLOADn ch=%d code=%d", ch, code); g_MAX5715_device.CODEnLOADn(ch, code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.030; // 30mV tinyTester.AnalogIn2_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, ch, voltageV); -#endif // USE_MAXIMTINYTESTER // ch = 3; voltageV = 0.25; code = g_MAX5715_device.DACCodeOfVoltage(voltageV); cmdLine.serial().printf("\r\n MAX5715.CODEnLOADn ch=%d code=%d", ch, code); g_MAX5715_device.CODEnLOADn(ch, code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.030; // 30mV tinyTester.AnalogIn3_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, ch, voltageV); -#endif // USE_MAXIMTINYTESTER // // test that the channels are independent -#if USE_MAXIMTINYTESTER tinyTester.AnalogIn0_Read_Expect_voltageV(g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[0])); tinyTester.AnalogIn1_Read_Expect_voltageV(g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[1])); tinyTester.AnalogIn2_Read_Expect_voltageV(g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[2])); tinyTester.AnalogIn3_Read_Expect_voltageV(g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[3])); -#else // USE_MAXIMTINYTESTER - for (ch = 0; ch < 4; ch++) { - voltageV = g_MAX5715_device.VoltageOfCode(g_MAX5715_device.CODE[ch]); - SelfTest_AnalogInput_Expect_ch_V(cmdLine, ch, voltageV); - } -#endif // USE_MAXIMTINYTESTER // #elif APPLICATION_MAX11131 // // MAX11131BOB self-test functions -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -#endif // USE_MAXIMTINYTESTER -// -#if USE_MAXIMTINYTESTER -#else // USE_MAXIMTINYTESTER -#endif // USE_MAXIMTINYTESTER -// //~ SelfTest_FAIL(cmdLine); //~ cmdLine.serial().printf("test program not implemented yet"); int16_t value_u12; @@ -4666,28 +4043,20 @@ int actual_channelId = (g_MAX11131_device.RAW_misoData16[channelIndex] >> 12) & 0x000F; if (actual_channelId != expect_channelId) { -#if USE_MAXIMTINYTESTER tinyTester.FAIL(); -#else // USE_MAXIMTINYTESTER - SelfTest_FAIL(cmdLine); -#endif // USE_MAXIMTINYTESTER cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); cmdLine.serial().printf(" but got 0x%1.1xxxx", actual_channelId); } else { -#if USE_MAXIMTINYTESTER tinyTester.PASS(); -#else // USE_MAXIMTINYTESTER - SelfTest_PASS(cmdLine); -#endif // USE_MAXIMTINYTESTER cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); } } // - // TODO1: MAX11131 SelfTest: MAX11131 Supports Internal Clock Modes (CNVST, EOC) + // MAX11131 SelfTest: MAX11131 Supports Internal Clock Modes (CNVST, EOC) cmdLine.serial().printf("\r\n"); cmdLine.serial().printf( "\r\n 1.1: Test SCAN_0011_StandardInt -- verify Internal Clock signals (CNVST, EOC)"); @@ -4697,12 +4066,8 @@ g_MAX11131_device.RAW_misoData16[0] = g_MAX11131_device.SPIread16bits(); g_MAX11131_device.SPIoutputCS(1); // drive CS high // -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect + // tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect tinyTester.DigitalIn_Read_Expect_WarnOnly(EOCb_pin, "EOC", 1, "initial value before sending commands"); -#else // USE_MAXIMTINYTESTER - SelfTest_MAX11131_EOC_expect(cmdLine, 1, "initial value before sending commands"); // TODO1: MAX11131 SelfTest false failure here? -#endif // USE_MAXIMTINYTESTER // // Send MOSI data Expect MISO data Description // 1000_0000_0000_0000 xxxx_xxxx_xxxx_xxxx ADC_CONFIGURATION REFSEL=0 SPM[1:0]=0 ECHO=0 No Averaging @@ -4731,47 +4096,31 @@ //~ wait_ms(100); // delay //~ g_MAX11131_device.CNVSToutputValue(1); // g_MAX11131_device.EOCinputWaitUntilLow(); // infinite wait hazard, need to fail if timeout exceeded -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect + // tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect tinyTester.DigitalIn_Read_Expect_WarnOnly(EOCb_pin, "EOC", 0, "after CNVST pulse"); -#else // USE_MAXIMTINYTESTER - SelfTest_MAX11131_EOC_expect(cmdLine, 0, "after CNVST pulse"); -#endif // USE_MAXIMTINYTESTER g_MAX11131_device.SPIoutputCS(0); // drive CS low g_MAX11131_device.RAW_misoData16[channelIndex] = g_MAX11131_device.SPIread16bits(); g_MAX11131_device.SPIoutputCS(1); // drive CS high -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect + // tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect tinyTester.DigitalIn_Read_Expect_WarnOnly(EOCb_pin, "EOC", 1, "after SPI read"); -#else // USE_MAXIMTINYTESTER - SelfTest_MAX11131_EOC_expect(cmdLine, 1, "after SPI read"); -#endif // USE_MAXIMTINYTESTER int expect_channelId = channelIndex; int actual_channelId = (g_MAX11131_device.RAW_misoData16[channelIndex] >> 12) & 0x000F; if (actual_channelId != expect_channelId) { -#if USE_MAXIMTINYTESTER tinyTester.FAIL(); -#else // USE_MAXIMTINYTESTER - SelfTest_FAIL(cmdLine); -#endif // USE_MAXIMTINYTESTER cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); cmdLine.serial().printf(" but got 0x%1.1xxxx", actual_channelId); } else { -#if USE_MAXIMTINYTESTER tinyTester.PASS(); -#else // USE_MAXIMTINYTESTER - SelfTest_PASS(cmdLine); -#endif // USE_MAXIMTINYTESTER cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); } } // - // TODO1: MAX11131 SelfTest: Test Fixture: MAX541ACPA+ to MAX32625MBED.AIN0/AIN4 + // MAX11131 SelfTest: Test Fixture: MAX541ACPA+ to MAX32625MBED.AIN0/AIN4 // Test Fixture: MAX541 connected to spi2 // SPI spi2_max541(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 TARGET_MAX32635MBED: P2_5 P2_6 P2_4 Arduino 2x3-pin header; microSD // DigitalOut spi2_max541_cs(SPI2_SS); // TARGET_MAX32635MBED: P2_7 Arduino 2x3-pin header @@ -4782,6 +4131,8 @@ // Check actual MAX541 reference voltage cmdLine.serial().printf("\r\n Test Fixture: MAX541 midscale voltage measure with MAX32625MBED AIN0/4"); max541.Set_Code(0x8000); // we don't know the fullscale voltage yet, so set code to midscale + tinyTester.Wait_Output_Settling(); // wait for MAX541 to settle + // double max541_midscale_V = analogInPin_fullScaleVoltage[4] * analogIn4.read(); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V const int average_count = 100; const double average_K = 0.25; @@ -4802,7 +4153,7 @@ SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { - voltageV = 3.0f; + voltageV = 2.7f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { @@ -4873,15 +4224,11 @@ value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId); // -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, voltageV, 0.100); -#endif // USE_MAXIMTINYTESTER // } // @@ -4914,15 +4261,11 @@ value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId); // -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, voltageV, 0.100); -#endif // USE_MAXIMTINYTESTER // // cmdLine.serial().printf("\r\n"); @@ -4957,24 +4300,20 @@ cmdLine.serial().printf("\r\n MAX11131.ReadAINcode"); // @post RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data // @post AINcode[NUM_CHANNELS] contains the latest readings in LSBs - // TODO: expect g_MAX11131_device.NumWords == g_MAX11131_device.channelNumber_0_15 + 1; - // TODO: expect RAW_misoData16[index] msnybble 0,1,2,3,... + // expect g_MAX11131_device.NumWords == g_MAX11131_device.channelNumber_0_15 + 1; + // expect RAW_misoData16[index] msnybble 0,1,2,3,... AINcode_print_value_externalClock(cmdLine, g_MAX11131_device.NumWords); - // TODO: compare with mbed/Arduino AIN0-AIN3 + // compare with mbed/Arduino AIN0-AIN3 // MAX32625MBED.AIN4 = MAX11131.AIN0 channelId = 0; value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV); -#else // USE_MAXIMTINYTESTER - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, voltageV, 0.100); -#endif // USE_MAXIMTINYTESTER - // TODO: compare MAX32625MBED.AIN5 = MAX11131.AIN1 + // compare MAX32625MBED.AIN5 = MAX11131.AIN1 //channelId = 1; //value_u12 = g_MAX11131_device.AINcode[channelId]; //voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId); @@ -4982,8 +4321,7 @@ // #elif APPLICATION_MAX5171 -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect + // tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect // // Note: ide.mbed.com does not support C++11 Lambda Expressions // -- see https://os.mbed.com/questions/82580/Is-there-solution-for-defining-of-interr/ @@ -5005,16 +4343,13 @@ // //double one_LSB = (g_MAX5171_device.VRef / 16383); // 14-bit DAC FS tinyTester.err_threshold = (g_MAX5171_device.VRef / 16383); // 14-bit DAC FS - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.settle_time_msec = 250; -#else // USE_MAXIMTINYTESTER -#endif // USE_MAXIMTINYTESTER g_MAX5171_device.VRef = 2.500; // MAX5171 14-bit LSB = 0.00015V SelfTest_print_Vref(cmdLine); // -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect + // tinyTester.FunctionCall_Expect replaces SelfTest_DACCodeOfVoltage_Expect tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, 2.499847412109375, 0x3FFF); tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, 2.49969482421875, 0x3FFE); tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, 2.499542236328125, 0x3FFD); @@ -5029,25 +4364,8 @@ tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, 0.00030517578125, 0x0002); tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, 0.000152587890625, 0x0001); tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, 0.00000, 0x0000); -#else // USE_MAXIMTINYTESTER - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.499847412109375, 0x3FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.49969482421875, 0x3FFE); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.499542236328125, 0x3FFD); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 2.4993896484375, 0x3FFC); // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.250152587890625, 0x2001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.25, 0x2000); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.249847412109375, 0x1FFF); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 1.24969482421875, 0x1FFE); - // - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.000457763671875, 0x0003); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.00030517578125, 0x0002); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.000152587890625, 0x0001); - SelfTest_DACCodeOfVoltage_Expect(cmdLine, 0.00000, 0x0000); -#endif // USE_MAXIMTINYTESTER - // -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.FunctionCall_Expect replaces SelfTest_VoltageOfCode_Expect + // tinyTester.FunctionCall_Expect replaces SelfTest_VoltageOfCode_Expect tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, 0x3FFF, 2.499847412109375); tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, 0x3FFE, 2.49969482421875); tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, 0x3FFD, 2.499542236328125); @@ -5062,22 +4380,6 @@ tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, 0x0002, 0.00030517578125); tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, 0x0001, 0.000152587890625); tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, 0x0000, 0.00000); -#else // USE_MAXIMTINYTESTER - SelfTest_VoltageOfCode_Expect(cmdLine, 0x3FFF, 2.499847412109375); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x3FFE, 2.49969482421875); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x3FFD, 2.499542236328125); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x3FFC, 2.4993896484375); - // - SelfTest_VoltageOfCode_Expect(cmdLine, 0x2001, 1.250152587890625); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x2000, 1.25); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x1FFF, 1.249847412109375); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x1FFE, 1.24969482421875); - // - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0003, 0.000457763671875); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0002, 0.00030517578125); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0001, 0.000152587890625); - SelfTest_VoltageOfCode_Expect(cmdLine, 0x0000, 0.00000); -#endif // USE_MAXIMTINYTESTER // // Device Testing: DAC commands, verify using on-board ADC inputs // @@ -5090,97 +4392,46 @@ // cmdLine.serial().printf("\r\n MAX5171.CODE_LOAD code=%d", code); g_MAX5171_device.CODE_LOAD(code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.AnalogIn0_Read_Expect_voltageV(2.500); -#else // USE_MAXIMTINYTESTER - wait_ms(250); // delay -#if analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. - // low range channels AIN0, AIN1, AIN2, AIN3 - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, 2.500); -#else // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses simple analog inputs - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 0, 2.500); -#endif -#endif // USE_MAXIMTINYTESTER // code = 0x0000; cmdLine.serial().printf("\r\n MAX5171.CODE_LOAD code=%d", code); g_MAX5171_device.CODE_LOAD(code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.AnalogIn0_Read_Expect_voltageV(0.0000); -#else // USE_MAXIMTINYTESTER - wait_ms(250); // delay -#if analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. - // low range channels AIN0, AIN1, AIN2, AIN3 - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, 0.0000); -#else // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses simple analog inputs - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 0, 0.0000); -#endif -#endif // USE_MAXIMTINYTESTER // code = 0x1FFF; cmdLine.serial().printf("\r\n MAX5171.CODE_LOAD code=%d", code); g_MAX5171_device.CODE_LOAD(code); -#if USE_MAXIMTINYTESTER - // TODO: tinyTester.Wait_Output_Settling replaces wait_ms + // tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V + // tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.AnalogIn0_Read_Expect_voltageV(1.2500); -#else // USE_MAXIMTINYTESTER - wait_ms(250); // delay -#if analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses AIN4,AIN5,.. as high range of AIN0,AIN1,.. - // low range channels AIN0, AIN1, AIN2, AIN3 - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 4, 1.2500); -#else // analogIn4_IS_HIGH_RANGE_OF_analogIn0 - // Platform board uses simple analog inputs - SelfTest_AnalogInput_Expect_ch_V(cmdLine, 0, 1.2500); -#endif -#endif // USE_MAXIMTINYTESTER // // test UPO User Programmable Output, verify using digital input D2 // cmdLine.serial().printf("\r\n MAX5171.UPO_HIGH"); g_MAX5171_device.UPO_HIGH(); -#if USE_MAXIMTINYTESTER tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_Expect_Input_UPO_pin + // tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_Expect_Input_UPO_pin tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"); -#else // USE_MAXIMTINYTESTER - wait_ms(100); // delay - SelfTest_Expect_Input_UPO_pin(cmdLine, 1, "UPO_pin is high after MAX5171 UPO_HIGH command"); -#endif // USE_MAXIMTINYTESTER // cmdLine.serial().printf("\r\n MAX5171.UPO_LOW"); g_MAX5171_device.UPO_LOW(); -#if USE_MAXIMTINYTESTER tinyTester.Wait_Output_Settling(); - // TODO: tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_Expect_Input_UPO_pin + // tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_Expect_Input_UPO_pin tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 0, "UPO_pin is low after MAX5171 UPO_LOW command"); -#else // USE_MAXIMTINYTESTER - wait_ms(100); // delay - SelfTest_Expect_Input_UPO_pin(cmdLine, 0, "UPO_pin is low after MAX5171 UPO_LOW command"); -#endif // USE_MAXIMTINYTESTER // cmdLine.serial().printf("\r\n MAX5171.UPO_HIGH"); g_MAX5171_device.UPO_HIGH(); -#if USE_MAXIMTINYTESTER tinyTester.Wait_Output_Settling(); // wait_ms(100); // delay - // TODO: tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_Expect_Input_UPO_pin + // tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_Expect_Input_UPO_pin tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"); -#else // USE_MAXIMTINYTESTER - wait_ms(100); // delay - SelfTest_Expect_Input_UPO_pin(cmdLine, 1, "UPO_pin is high after MAX5171 UPO_HIGH command"); -#endif // USE_MAXIMTINYTESTER // #elif APPLICATION_MAX11410 // @@ -5205,7 +4456,6 @@ #endif // // Report number of pass and number of fail test results -#if USE_MAXIMTINYTESTER tinyTester.Report_Summary(); #if USE_LEDS if (tinyTester.nFail == 0) { @@ -5215,25 +4465,6 @@ rgb_led.red(); // diagnostic rbg led RED } #endif // USE_LEDS -#else // USE_MAXIMTINYTESTER - cmdLine.serial().printf("\r\nSummary: %d PASS %d FAIL\r\n", g_SelfTest_nPass, g_SelfTest_nFail); - //~ cmdLine.serial().printf(g_SelfTest_nPass); - //~ cmdLine.serial().printf(" PASS "); - //~ cmdLine.serial().printf(g_SelfTest_nFail); - //~ cmdLine.serial().printf(" FAIL\r\n"); - if (g_SelfTest_nFail == 0) { -#if USE_LEDS - //~ rgb_led.red(); // diagnostic rbg led RED - rgb_led.green(); // diagnostic rbg led GREEN - //~ rgb_led.blue(); // diagnostic rbg led BLUE - //~ rgb_led.white(); // diagnostic rbg led RED+GREEN+BLUE=WHITE - //~ rgb_led.cyan(); // diagnostic rbg led GREEN+BLUE=CYAN - //~ rgb_led.magenta(); // diagnostic rbg led RED+BLUE=MAGENTA - //~ rgb_led.yellow(); // diagnostic rbg led RED+GREEN=YELLOW - //~ rgb_led.black(); // diagnostic rbg led BLACK -#endif // USE_LEDS - } -#endif // USE_MAXIMTINYTESTER }