84 #define READ_TIMEOUT 20 85 #define MISO_TIMEOUT 1000 94 #define RECORDING_SIZE 50 106 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F' 115 char id_string[51]=
"USBSPI,PIC,01,01,DC,DC590,----------------------\n\0";
118 '0',
'x',
'0',
'0',
'\0' 159 while (Serial.available() <= 0);
160 return(Serial.read());
169 if (command ==
'w') command=
'\1';
170 if (command ==
't') command=
'\1';
171 if (command ==
'v') command=
'\1';
172 if (command ==
'u') command=
'\1';
194 digitalWrite(2, LOW);
195 digitalWrite(3, LOW);
196 digitalWrite(4, LOW);
197 digitalWrite(5, LOW);
198 digitalWrite(6, LOW);
199 digitalWrite(7, LOW);
209 Serial.begin(115200);
215 Serial.print(
"hello - DC2430 prog\n");
263 if (
input(MISO)==1)
break;
280 #ifdef spoof_board_id 281 Serial.print(spoof_board_id);
292 Serial.print(
"\n\0");
312 digitalWrite(pin-0x30+2, pin_value ==
'0' ? LOW : HIGH);
324 Serial.print(digitalRead(pin-0x30+2));
328 int val = analogRead(pin -
'6');
349 pinMode(pin-0x30+2, pin_value ==
'0' ? INPUT : OUTPUT);
356 if (
input(MISO)==0)
break;
388 SPI.setDataMode(SPI_MODE0);
391 SPI.setDataMode(SPI_MODE1);
394 SPI.setDataMode(SPI_MODE2);
397 SPI.setDataMode(SPI_MODE3);
400 SPI.setClockDivider(SPI_CLOCK_DIV2);
403 SPI.setClockDivider(SPI_CLOCK_DIV4);
406 SPI.setClockDivider(SPI_CLOCK_DIV8);
409 SPI.setClockDivider(SPI_CLOCK_DIV16);
412 SPI.setClockDivider(SPI_CLOCK_DIV32);
415 SPI.setClockDivider(SPI_CLOCK_DIV64);
418 SPI.setClockDivider(SPI_CLOCK_DIV128);
490 if (
i2c_write(tx_data)==1) Serial.print(
'N');
493 if (
i2c_write(tx_data)==1) Serial.print(
'N');
544 Serial.print(
"hello\n");
575 char demo_name1[] =
"DC1954";
576 char demo_name2[] =
"DC2248";
586 Serial.println(
"1. Setting DC2430 to J5 site");
590 if (
demo_board_connected == 0) Serial.println(
"\n\n ***** LTC6954 Demo board not attached to J5, fix this and try again *****\n\n ");
593 Serial.println(
"\n2. Programming LTC6954");
597 Serial.println(
"\n3. Setting DC2430 to J6 site");
601 if (
demo_board_connected == 0) Serial.println(
"\n\n **** LTC6951 Demo board not attached to J6, fix this and try again ***** \n\n");
604 Serial.println(
"\n4. Programming LTC6951 #1");
608 Serial.println(
"\n5. Setting DC2430 to J7 site");
612 if (
demo_board_connected == 0) Serial.println(
"\n\n **** LTC6951 Demo board not attached to J7, fix this and try again ****\n\n");
615 Serial.println(
"\n6. Programming LTC6951 #2");
619 Serial.println(
"\n7. Performing ParallelSync");
620 digitalWrite(7, HIGH);
622 digitalWrite(7, LOW);
624 Serial.println(
"\n7. Done!");
638 uint8_t val_addr, val_reg;
639 uint8_t tx_input_array[7];
642 tx_input_array[0] = 0x00;
643 tx_input_array[1] = 0x80;
644 tx_input_array[2] = 0x00;
645 tx_input_array[3] = 0x80;
646 tx_input_array[4] = 0x00;
647 tx_input_array[5] = 0x80;
648 tx_input_array[6] = 0x00;
652 *rx = SPI.transfer(val_addr);
656 *rx = SPI.transfer(tx_input_array[
i]);
674 uint8_t val_addr, val_reg;
675 uint8_t tx_input_array[19];
678 tx_input_array[0] = 1<<1;
679 tx_input_array[1] = 0xba;
680 tx_input_array[2] = 0x00;
681 tx_input_array[3] = 0x74;
682 tx_input_array[4] = 0xb3;
683 tx_input_array[5] = 0x04;
684 tx_input_array[6] = 0x02;
685 tx_input_array[7] = 0x07;
686 tx_input_array[8] = 0x00;
687 tx_input_array[9] = 0x14;
688 tx_input_array[10] = 0xc0;
689 tx_input_array[11] = 0x96;
690 tx_input_array[12] = 0x06;
691 tx_input_array[13] = 0x96;
692 tx_input_array[14] = 0x0c;
693 tx_input_array[15] = 0x96;
694 tx_input_array[16] = 0x06;
695 tx_input_array[17] = 0x30;
696 tx_input_array[18] = 0x00;
701 *rx = SPI.transfer(tx_input_array[
i]);
709 *rx = SPI.transfer(val_addr);
711 *rx = SPI.transfer(val_reg);
724 Serial.println(F(
"***************************"));
725 Serial.println(F(
"* START OF TEST *"));
726 Serial.println(F(
"***************************"));
741 Serial.print(F(
"Bin = "));
751 float dc2430_Aval_V0;
752 float dc2430_Aval_V1;
753 float dc2430_Aval_V2;
755 Serial.println(F(
"\n *** Testing Linduino Supplies on DC2430A board ***"));
762 dc2430_Aval = analogRead(0);
763 dc2430_Aval_V0 = (5.0*dc2430_Aval)/1023;
765 dc2430_Aval = analogRead(1);
766 dc2430_Aval_V1 = (5.0*dc2430_Aval)/1023;
768 dc2430_Aval_V2=-9.99;
769 if ((dc2430_Aval_V0>3.0) && (dc2430_Aval_V0<3.6) && (dc2430_Aval_V1>1.5) && (dc2430_Aval_V1<1.8))
771 Serial.println(F(
"PASS: EEVCC voltage = 5V"));
776 Serial.print(F(
"\n**** FAIL: EVCC voltage test "));
777 Serial.println(dc2430_Aval_V0);
778 Serial.println(dc2430_Aval_V1);
783 dc2430_Aval = analogRead(2);
784 dc2430_Aval_V2 = (5.0*dc2430_Aval)/1023;
785 if ((dc2430_Aval_V2>3.0) && (dc2430_Aval_V2<3.6))
787 Serial.print(F(
"PASS: VCCIO voltage = "));
792 Serial.println(F(
"\nIs the DC2026C JP3 jumper set to the 3.3V location?"));
793 Serial.print(F(
"**** FAIL: VCCIO voltage = "));
795 Serial.println(dc2430_Aval_V2);
797 Serial.print(F(
"\n\0"));
805 char command1, command2;
806 Serial.println(F(
"\n\n *** Testing DC2430 SYNC circuitry ***"));
808 digitalWrite(7, LOW);
809 Serial.println(F(
"Measure output voltages at J21 (SYNC1) & J22 (SYNC2)"));
810 Serial.println(F(
"Are both voltages < 0.2V? [Y/N]"));
816 digitalWrite(7, HIGH);
817 Serial.println(F(
"Measure output voltages at J21 (SYNC1) & J22 (SYNC2)"));
818 Serial.println(F(
"Are both voltages > 3.1V and < 3.5V? [Y/N]"));
823 digitalWrite(7, LOW);
825 if ((command1==
'y') && (command2==
'y'))
827 Serial.print(F(
"PASS: SYNC Test "));
832 Serial.print(F(
"**** FAIL: SYNC Test "));
845 byte tx_data, rx_data;
847 uint8_t val_addr, val_reg;
848 uint8_t rx_data_array[5];
849 uint8_t tx_input_array[5];
851 if (
DC2430_testmode_ctr==0) Serial.println(F(
"\n\n *** Testing QuickEval Connectors ***"));
856 Serial.print(F(
"\n>>>>>>>> Move Quickeval Connector to DC2430 connector J"));
858 Serial.println(F(
"Press Enter when complete"));
866 Serial.print(F(
"\nEnsure a DC2248 is connected to DC2430 Connector J"));
868 Serial.print(F(
"**** FAIL: EEPROM I2C pins connector J"));
873 Serial.print(F(
"PASS: EEPROM I2C pins connecter J"));
883 *rx = SPI.transfer(val_addr);
885 *rx = SPI.transfer(val_reg);
890 tx_input_array[0] = 0x49;
891 tx_input_array[1] = 0x80;
892 tx_input_array[2] = 0x00;
893 tx_input_array[3] = 0xaa;
894 tx_input_array[4] = 0x55;
898 *rx = SPI.transfer(val_addr);
901 *rx = SPI.transfer(tx_input_array[
i]);
908 *rx = SPI.transfer(val_addr);
914 if (tx_input_array[i]!=rx_data_array[i])
DC2430_Bin=5;
921 *rx = SPI.transfer(val_addr);
923 *rx = SPI.transfer(val_reg);
928 Serial.print(F(
"**** FAIL: SPI pins connector J"));
933 Serial.print(F(
"PASS: SPI pins connecter J"));
948 int manual_site_selection;
950 int did_not_follow_instructions;
952 Serial.println(F(
"\n\n *** Testing Manual Switch (SW1) ***"));
956 if (
i==0) manual_site_selection=5;
957 if (
i==1) manual_site_selection=2;
959 did_not_follow_instructions=0;
963 if (jj>0) Serial.println(
"\n\n OOPS!!!!! - please read instructions");
964 Serial.print(F(
">> STEP 1: Move Quickeval Connector to DC2430 connector J"));
965 Serial.println(manual_site_selection);
966 Serial.print(F(
">> STEP 2: Turn SW1 so that LED by J"));
967 Serial.print(manual_site_selection);
968 Serial.println(F(
" turns on"));
969 Serial.println(F(
"Press Enter when complete"));
983 did_not_follow_instructions=1;
986 while ((did_not_follow_instructions== 1) && (jj<2));
991 Serial.print(F(
"**** FAIL: Manual Switch Test - J"));
992 Serial.println(manual_site_selection);
996 Serial.print(F(
"PASS: Manual Switch Test - J"));
997 Serial.println(manual_site_selection);
1022 switch (site_select)
1025 digitalWrite(5, HIGH);
1026 digitalWrite(4, LOW);
1027 digitalWrite(3, LOW);
1028 digitalWrite(2, LOW);
1032 digitalWrite(5, HIGH);
1033 digitalWrite(4, LOW);
1034 digitalWrite(3, LOW);
1035 digitalWrite(2, HIGH);
1039 digitalWrite(5, HIGH);
1040 digitalWrite(4, LOW);
1041 digitalWrite(3, HIGH);
1042 digitalWrite(2, LOW);
1046 digitalWrite(5, HIGH);
1047 digitalWrite(4, LOW);
1048 digitalWrite(3, HIGH);
1049 digitalWrite(2, HIGH);
1053 digitalWrite(5, HIGH);
1054 digitalWrite(4, HIGH);
1055 digitalWrite(3, LOW);
1056 digitalWrite(2, LOW);
1060 digitalWrite(5, HIGH);
1061 digitalWrite(4, HIGH);
1062 digitalWrite(3, LOW);
1063 digitalWrite(2, HIGH);
1067 digitalWrite(5, HIGH);
1068 digitalWrite(4, HIGH);
1069 digitalWrite(3, HIGH);
1070 digitalWrite(2, LOW);
1074 digitalWrite(5, HIGH);
1075 digitalWrite(4, HIGH);
1076 digitalWrite(3, HIGH);
1077 digitalWrite(2, HIGH);
1081 digitalWrite(5, LOW);
1082 digitalWrite(4, LOW);
1083 digitalWrite(3, LOW);
1084 digitalWrite(2, LOW);
char recording_buffer[RECORDING_SIZE]
static int DC2430_testmode_ctr
char hex_to_byte_buffer[5]
const byte i2c_auxiliary_mode
static void DC2430_test_manualmode()
DC2430_test_manualmode() - verified.
#define output_high(pin)
Set "pin" high.
static int8_t demo_board_connected
Demo Board Name stored in QuikEval EEPROM.
static void Prog_LTC6954_parallelsync_example()
This function programs LTC6954-2 SPI registers.
char byte_to_hex_buffer[3]
Header File for Linduino Libraries and Demo Code.
void spi_write(int8_t data)
Write a data byte using the SPI hardware.
static void byte_to_hex(byte value)
static void changeDC2430site(int site_select)
Function to set DC2430 to a site based on the DC2430_testmode_ctr number.
void i2c_stop()
Write stop bit to the hardware I2C port.
static void DC2430_testprog()
DC2430 TEST SECTION.
static void DC2430_test_supply()
Function to check DC2430 voltages generated from the EEVCC and VCCIO Linduion supply voltages...
int8_t i2c_start()
Write start bit to the hardware I2C port.
static void loop()
Repeats Linduino loop.
union LT_union_int32_4bytes data
#define WITH_NACK
Use with i2c_read(WITH_NACK) to read without an acknowledge.
unsigned char pseudo_reset
static void DC2430_test_swmode()
DC2430_test_swmode() - verified.
static void setup()
Initialize Linduino.
#define QUIKEVAL_GPIO
Linduino QuikEval GPIO pin (QuikEval connector pin 14) connects to Arduino pin 9. ...
int8_t i2c_write(uint8_t data)
Send a data byte to hardware I2C port.
#define output_low(pin)
Set "pin" low.
#define input(pin)
Return the state of pin "pin".
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
static int8_t discover_demo_board_local(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
int8_t spi_read(int8_t data)
The data byte to be written.
static void DC2430_parallelsync_example()
DC2430 PARALLELSYNC EXAMPLE: SOFTWARE SITE SELECTION MODE.
uint8_t i2c_read(int8_t ack)
Read a data byte from the hardware I2C port.
static void DC2430_test_SYNC()
Function to verify that the DC2430 ref to sync circtuiry is functional.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
static void Prog_LTC6951_parallelsync_example()
Prog_LTC6951_parallelsync_example() This function programs the LTC6951 registers for ParallelSYNC mod...
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
#define WITH_ACK
Use with i2c_read(WITH_ACK) to read with an acknowledge.
#define QUIKEVAL_CS
QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin...
uint8_t read_quikeval_id_string(char *buffer)
Read the id string from the EEPROM, then parse the product name, demo board name, and demo board opti...
char ui_buffer[UI_BUFFER_SIZE]
static int8_t demo_board_connected_man
Demo Board Name stored in QuikEval EEPROM.