153 float dc2430_A0_fval=0;
154 float dc2430_A1_fval=0;
155 float dc2430_A2_fval=0;
162 Serial.begin(115200);
171 dc2430_A0_fval = (5.0*dc2430_A0_val)/1023;
174 dc2430_A1_fval = (5.0*dc2430_A1_val)/1023;
178 if ((dc2430_A0_fval>3.0) && (dc2430_A0_fval<3.6) && (dc2430_A1_fval>1.5) && (dc2430_A1_fval<1.8))
180 Serial.println(F(
"--- DC2430 Connected ---"));
198 Serial.println(F(
"\n********************************************************"));
204 dc2430_A2_fval = (5.0*dc2430_A2_val)/1023;
205 Serial.print(F(
"Linduino's JP3 VCCIO voltage = "));
206 Serial.println(dc2430_A2_fval);
208 Serial.println(F(
"Linduino's SPI Frequency = 4MHz, max DC2430 SPI speed"));
209 Serial.print(F(
"\nDC2248 FOUND ON DC2430 SITE "));
210 Serial.println(site_select);
217 Serial.print(F(
"\nDC2248 NOT FOUND ON DC2430 SITE "));
218 Serial.print(site_select);
222 while (site_select<8);
228 Serial.println(F(
"\n\nConnect DC2248 demo board to DC2430, then press the reset button."));
235 Serial.println(F(
"DC2248A CONNECTED TO LINDUINO"));
239 Serial.println(F(
"Linduino's SPI Frequency = 8MHz, max speed"));
258 if (Serial.available())
266 if (user_command !=
'm')
267 Serial.println(user_command);
269 switch (user_command)
305 Serial.println(F(
"Incorrect Option"));
308 Serial.println(F(
"\n*****************************************************************"));
333 while (field_num != 0)
335 Serial.print(F(
"\n*****************************************************************"));
336 Serial.print(F(
"\n************* Select LTC6951 Configuration *****************"));
337 Serial.println(F(
"\n*****************************************************************"));
340 Serial.print(F(
"1- OUT[4:0] = 600MHZ, EZSync\n"));
341 Serial.print(F(
"2- OUT[4:0] = 600MHZ, EZSync Ref Aligned\n"));
342 Serial.print(F(
"3- OUT[4:0] = 600MHZ, EZParallelSync\n"));
343 Serial.print(F(
"4- OUT[4:0] = 600MHZ, ParallelSync\n"));
344 Serial.print(F(
"5- OUT[3:0] = 2500MHZ, OUT4:625MHz, EZSync\n"));
345 Serial.print(F(
"6- OUT[3:0] = 2500MHZ, OUT4:625MHz, EZSync Ref Aligned\n"));
346 Serial.print(F(
"7- OUT[3:1] = 2400MHZ, OUT0&OUT4 = 600MHz, EZParallelSync\n"));
347 Serial.print(F(
"8- OUT[3:0] = 2500MHZ, OUT4 = 625MHz, ParallelSync\n"));
348 Serial.print(F(
"9- OUT[4:0] = Same frequencies as DC2226 U10, JESD204B SC1, ParallelSync\n"));
349 Serial.print(F(
"10- OUT[4:0] = Same frequencies as DC2226 U13, JESD204B SC1, ParallelSync\n"));
350 Serial.println(F(
"0 - Return to Main Menu\n"));
352 Serial.println(F(
"Load LTC6951 register settings from a look up table (Settings created from LTC6951Wizard)"));
353 Serial.println(F(
"Enter a command (1-10), or '0' to return to Main Menu): "));
355 Serial.println(field_num);
360 field_num=field_num-1;
362 field_num=field_num+1;
384 uint8_t
i, regval, user_regval, num_reg;
385 uint16_t user_address;
390 while (user_address != 0)
392 Serial.println(F(
"\n*****************************************************************"));
394 for (i=0; i<num_reg; i++)
399 Serial.print(F(
"- ADDR0"));
401 Serial.print(F(
"- ADDR"));
402 Serial.print(i, HEX);
403 Serial.print(F(
" = 0x"));
404 if (regval<16) Serial.print(F(
"0"));
405 Serial.print(regval, HEX);
406 if (i==3) Serial.print(F(
" (warning: if D2=1 it resets all registers. RES6951 Bit)"));
407 if ((i==0)||(i==(num_reg-1))) Serial.print(F(
" (read only) "));
410 Serial.print(F(
"0 - Return to Main Menu\n\n"));
412 Serial.print(F(
"Enter a command (1-19 to modify register, or '0' to return to Main Menu): "));
414 Serial.println(user_address);
417 if (user_address >0 && user_address<(num_reg-1))
419 Serial.print(F(
"What value should ADDR"));
420 Serial.print(user_address);
421 Serial.print(F(
" be set to (ex: HEX format 0xff): "));
423 Serial.println(user_regval);
443 uint8_t field_size,
i;
444 long max_num=1, pow2=1;
446 Serial.print(
"CURRENT STATE (HEX): ");
447 Serial.print(field_name);
448 Serial.print(
"= 0x");
449 Serial.println(field_val, HEX);
454 for (i=1; i<field_size; i++)
457 max_num=max_num + pow2;
460 Serial.print(
"What value should ");
461 Serial.print(field_name);
462 Serial.print(
" be set to or type '-1' to exit: (ex: HEX format 0x00 to 0x");
463 Serial.print(max_num, HEX);
467 if (usr_field_val>=0 && usr_field_val<=max_num)
469 Serial.println(usr_field_val);
470 return usr_field_val;
506 while (field_num != 0)
508 Serial.println(F(
"\n*****************************************************************"));
510 Serial.print(F(
"1-ALCCAL 25-LKWIN 49-PART *\n"));
511 Serial.print(F(
"2-ALCEN 26-LOCK * 50-PD\n"));
512 Serial.print(F(
"3-ALCHI * 27-!LOCK * 51-PDALL\n"));
513 Serial.print(F(
"4-ALCLO * 28-MCO 52-PDOUT\n"));
514 Serial.print(F(
"5-ALCMON 29-MC1 53-PDPLL\n"));
515 Serial.print(F(
"6-ALCULOK 30-MC2 54-PDREFPK\n"));
516 Serial.print(F(
"7-AUTOCAL 31-MC3 55-PDVCO\n"));
517 Serial.print(F(
"8-BD 32-MC4 56-POR\n"));
518 Serial.print(F(
"9-BST 33-MD0 57-RAO\n"));
519 Serial.print(F(
"10-CAL 34-MD1 58-RD\n"));
520 Serial.print(F(
"11-CP 35-MD2 59-REFOK *\n"));
521 Serial.print(F(
"12-CPDN 36-MD3 60-!REFOK *\n"));
522 Serial.print(F(
"13-CPMID 37-MD4 61-REV *\n"));
523 Serial.print(F(
"14-CPRST 38-MUTE0 62-SN\n"));
524 Serial.print(F(
"15-CPUP 39-MUTE1 63-SR\n"));
525 Serial.print(F(
"16-CPWIDE 40-MUTE2 64-SSYNC\n"));
526 Serial.print(F(
"17-DLY0 41-MUTE3 65-SYNCEN0\n"));
527 Serial.print(F(
"18-DLY1 42-MUTE4 66-SYNCEN1\n"));
528 Serial.print(F(
"19-DLY2 43-ND 67-SYNCEN2\n"));
529 Serial.print(F(
"20-DLY3 44-OINV0 68-SYNCEN3\n"));
530 Serial.print(F(
"21-DLY4 45-OINV1 69-SYNCEN4\n"));
531 Serial.print(F(
"22-FILT 46-OINV2 70-UNLOCK *\n"));
532 Serial.print(F(
"23-INVSTAT 47-OINV3 71-x\n"));
533 Serial.print(F(
"24-LKCT 48-OINV4 \n"));
535 Serial.print(F(
"0 - Return to Main Menu\n"));
536 Serial.print(F(
"* = READ ONLY FIELD\n\n"));
538 Serial.print(F(
"Enter a command (1-71 to modify register, or '0' to return to Main Menu): "));
540 Serial.println(field_num);
577 for (uint8_t
i = 0;
i <= num_reg ;
i++)
582 Serial.println(F(
"PLL Settings Stored to EEPROM"));
594 uint8_t user_address;
610 for (uint8_t
i = 0;
i <= num_reg ;
i++)
616 Serial.println(F(
"LTC6951 Settings Restored"));
618 Serial.println(F(
"Calibrate LTC6951 VCO"));
622 Serial.println(F(
"Syncs LTC6951 OUTPUTS"));
628 Serial.println(F(
"PLL Settings not found"));
654 uint8_t lkup_tbl_row;
660 while (lkup_tbl_row != 0)
662 Serial.println(F(
"\n*****************************************************************"));
663 Serial.println(F(
"This option is good for measuring calibration and settling time"));
664 Serial.println(F(
"It allows one to hop back and forth between 2 frequencies"));
665 Serial.println(F(
"For different frequencies - modify the lookup table in function"));
666 Serial.println(F(
"Fset_LTC6951_REGS_freq_jump. LTC6951Wizard exports register settings"));
667 Serial.println(F(
"in the correct format for an easy modification"));
668 Serial.println(F(
"For best timing results, set the SPI clock frequency to 8MHz (main menu: option 7)"));
671 Serial.println(F(
"1 - Frequency 1: 600MHz"));
672 Serial.println(F(
"2 - Frequency 2: 550MHz\n"));
673 Serial.print(F(
"0 - Return to Main Menu\n\n"));
674 Serial.print(F(
"Select an Option (0,1, or 2) : "));
676 Serial.println(lkup_tbl_row);
678 if ((lkup_tbl_row >2)|| (lkup_tbl_row <0))
680 Serial.println(F(
"Not an option - try again"));
682 else if (lkup_tbl_row == 0)
702 Serial.println(F(
"\nCommand Summary:"));
705 Serial.println(F(
" 1-8MHz NOT Available with DC2430"));
709 Serial.println(F(
" 1-SPI Clock = 8MHz"));
711 Serial.println(F(
" 2-SPI Clock = 4MHz"));
712 Serial.println(F(
" 3-SPI Clock = 2MHz"));
713 Serial.println(F(
" 4-SPI Clock = 1MHz"));
714 Serial.println(F(
" 5-SPI Clock = 500kHz"));
716 Serial.print(F(
"Enter a command: "));
724 Serial.println(F(
"incorrect option"));
749 Serial.println(F(
"Incorrect Option"));
764 Serial.println(F(
"\nCommand Summary:"));
765 Serial.println(F(
" 0-Site 0"));
766 Serial.println(F(
" 1-Site 1"));
767 Serial.println(F(
" 2-Site 2"));
768 Serial.println(F(
" 3-Site 3"));
769 Serial.println(F(
" 4-Site 4"));
770 Serial.println(F(
" 5-Site 5"));
771 Serial.println(F(
" 6-Site 6"));
772 Serial.println(F(
" 7-Site 7"));
775 Serial.print(F(
"Enter a command: "));
786 Serial.println(F(
"\n********************************************************"));
791 Serial.print(F(
"\nDC2248 NOT FOUND ON DC2430 SITE "));
792 Serial.print(temp_val);
854 Serial.println(F(
"Incorrect Option"));
865 Serial.println(F(
"\n****************************************************************************************************"));
866 Serial.println(F(
"* DC2248 Demonstration Program *"));
867 Serial.println(F(
"* - Input Voltage 6V-20V (J15/J16) *"));
868 Serial.println(F(
"* *"));
869 Serial.println(F(
"* This program demonstrates how to send data to the LTC6951 Ultralow Jitter *"));
870 Serial.println(F(
"* Multi-Output Clock Synthesizer with Integrated VCO. *"));
871 Serial.println(F(
"* *"));
872 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator. *"));
873 Serial.println(F(
"* *"));
874 Serial.println(F(
"* Recommendations on how to best use LTC6951Wizard and DC2248 Linduino code together *"));
875 Serial.println(F(
"* Use LTC6951Wizard to *"));
876 Serial.println(F(
"* - determine best SPI register values for specific frequenices and Sync Methods for all settings *"));
877 Serial.println(F(
"* - determine loop filter value *"));
878 Serial.println(F(
"* - Simulate LTC6951 Phase noise and Time Domain response *"));
879 Serial.println(F(
"* - initial engineering evaluation *"));
880 Serial.println(F(
"* Use DC2248 Linduino code *"));
881 Serial.println(F(
"* - Create a look up table of the SPI register values created from LTC6951Wizard (option 1) *"));
882 Serial.println(F(
"* - Software development for reading and writing to specific register/address (option 2 & 3) *"));
883 Serial.println(F(
"* - Storing demo board settings on the demo board EEPROM *"));
884 Serial.println(F(
"* - test that require a fast SPI clocks up to 8MHz, (i.e. settling time) *"));
885 Serial.println(F(
"* - starting place to use the DC2248 with the DC2430 *"));
886 Serial.println(F(
"****************************************************************************************************"));
896 Serial.println(F(
"\nCommand Summary:"));
897 Serial.println(F(
" 1-Load Default Settings from a Look-up Table"));
898 Serial.println(F(
" 2-READ/WRITE to Registers Addresses"));
899 Serial.println(F(
" 3-READ/WRITE to Registers Fields"));
900 Serial.println(F(
" 4-Store LTC6951 SPI settings to the DC2248's EEPROM"));
901 Serial.println(F(
" 5-Restore LTC6951 SPI settings from the DC2248's EEPROM"));
902 Serial.println(F(
" 6-Timing Measurement Aid: SPI WRITE + CALIBRAION + SETTLING TIME"));
903 Serial.println(F(
" 7-Adjust SPI frequency"));
906 Serial.println(F(
" 8-DC2430 Site Selector"));
909 Serial.print(F(
"Enter a command: "));
static void menu_6_multibytewrite()
Frequency change Timing test (SPI write + Calibration + Settling Time): Provides two frequency settin...
uint8_t eeprom_read_int16(uint8_t i2c_address, int16_t *read_data, uint16_t address)
Read the two byte integer data from the EEPROM starting at address.
unsigned char user_command
#define EEPROM_I2C_ADDRESS
uint8_t get_LTC6951_SPI_FIELD_RW(uint8_t f)
returns if the given field name is (0)read/write or (1)read_only field
uint8_t eeprom_write_byte(uint8_t i2c_address, char data, uint16_t address)
Write the data byte to the EEPROM with i2c_address starting at EEPROM address.
uint8_t get_LTC6951_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
LTC6951: Ultra-Low Jitter 2MHz to 2.7GHz Multi-Output Clock Synthesizer with Integrated VCO...
static void menu_3_RW_to_reg_field()
Menu 3: Reads and/or Writes individual SPI fields This function provides the user with a list of all ...
Header File for Linduino Libraries and Demo Code.
static void dc2430_site_select(int site_select)
Called from function menu_8_DC2430_site_select(), programs DC2430 to site selected.
void set_LTC6951_REGS_freq_jump(uint8_t lkup_tbl_row, uint8_t init_setup)
This function toggles between two frequencies.
void set_LTC6951_REGS_lkup_tbl(uint8_t lkup_tbl_row)
Writes values to ALL LTC6951 RW addresses from a look-up table.
void spi_enable(uint8_t spi_clock_divider)
Setup the processor for hardware SPI communication.
static void DUTsync(uint16_t delay_num)
Syncs LTC6951 Outputs using SSYNC bit.
static int dc2430_site_DA0_Pin
DC2430 digital pin allows Linduino to control which DC2430 site is selected.
#define LTC6951_SSYNC
for spi_map array, defines location for field specific information used to create the spi map ...
static void menu_7_SPI_speed()
Read stored PLL settings from nonvolatile EEPROM on demo board.
union LT_union_int32_4bytes data
static void menu_8_DC2430_site_select()
Read stored PLL settings from nonvolatile EEPROM on demo board.
static int dc2430_en_Pin
DC2430 digital pin enables Linduino to control which DC2430 site is selected & turns on DC2430 LED...
static void setup()
Initialize Linduino.
static int dc2430_site_DA2_Pin
DC2430 digital pin allows Linduino to control which DC2430 site is selected.
uint8_t eeprom_write_int16(uint8_t i2c_address, int16_t write_data, uint16_t address)
Write the 2 byte integer data to the EEPROM starting at address.
uint8_t LTC6951_read(uint8_t cs, int8_t address)
LTC6951 Read Single Address reads 8 bit Data field to LTC6951.
static int8_t demo_board_connected
Demo Board Name stored in QuikEval EEPROM.
uint8_t eeprom_read_byte(uint8_t i2c_address, char *data, uint16_t address)
Read a data byte at address from the EEPROM with i2c_address.
uint8_t get_LTC6951_REGSIZE()
returns # of addresses in parts register map (array size)
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
#define EEPROM_CAL_STATUS_ADDRESS
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
#define LTC6951_CS
Define the SPI CS pin.
static void print_title()
Prints the title block when program first starts.
static void menu_1_load_default_settings()
Menu 1: Load Default SPI Register Settings This function loads the register settings from a look up t...
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
static void menu_5_restore_settings()
Read stored PLL settings from nonvolatile EEPROM on demo board.
static int dc2430_site_A0_APin
DC2430 resistor tree, if it reads 3.3V then DC2430 connected.
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...
static void menu_2_RW_to_reg_addresss()
Menu 2: Reads and/or Writes the SPI register address This function reads and displays all SPI registe...
static uint8_t First_Run
if first time through loop = 0, otherwise=1
boolean Using_DC2430
Indicator if DC2430 (Linduino Expander) is connected.
static void print_prompt()
Prints main menu.
static int dc2430_site_A2_APin
DC2430 INFO ONLY, measures DC2226 (Linduino) VCCIO voltage.
void LTC6951_init()
Initializes the SPI MAP arrays The values set in initialization are used for all the LTC6951 SPI/WRIT...
void LTC6951_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6951 Write Single Address writes 8 bit Data field to LTC6951.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void set_LTC6951_SPI_FIELD(uint8_t cs, uint8_t f, long field_data)
Sets the LTC6951 SPI field value calls function LTC6951_read_field, which reads specific address/fiel...
long field_menu_RW(long field_val, char field_name[], uint8_t f)
Support function for function menu_3_RW_to_reg_field displays current state of select field provides ...
long get_LTC6951_SPI_FIELD(uint8_t cs, uint8_t f)
Gets the LTC6951 SPI field value calls function LTC6951_read_field, which reads specific address loca...
int8_t discover_demo_board_local(char *demo_name)
Read the ID string from the EEPROM and determine if any demo board is connected.
static int8_t dc2248_board_connected
Demo Board Name stored in QuikEval EEPROM.
#define LTC6951_CAL
for spi_map array, defines location for field specific information used to create the spi map ...
static void menu_4_store_settings()
Store PLL settings to nonvolatile EEPROM on demo board.
static int dc2430_site_DA1_Pin
DC2430 digital pin allows Linduino to control which DC2430 site is selected.
static void loop()
Repeats Linduino loop.
static int dc2430_site_A1_APin
DC2430 resistor tree, if it reads 1.66V then DC2430 connected.