124 Serial.begin(115200);
134 Serial.println(F(
" was found"));
147 if (Serial.available())
155 if (user_command !=
'm')
156 Serial.println(user_command);
158 switch (user_command)
180 Serial.println(F(
"Incorrect Option"));
183 Serial.println(F(
"\n*****************************************************************"));
213 Serial.print(
"No default file for this board: ");
217 Serial.println(F(
"Registers Have Been Written"));
237 uint8_t
i, regval, user_regval, num_regs;
238 uint16_t user_address;
243 while (user_address != -1)
245 Serial.println(F(
"\n*****************************************************************"));
247 for (i=0; i<num_regs; i++)
252 Serial.print(F(
"- ADDR0"));
254 Serial.print(F(
"- ADDR"));
255 Serial.print(i, HEX);
256 Serial.print(F(
" = 0x"));
257 if (regval<16) Serial.print(F(
"0"));
258 Serial.print(regval, HEX);
259 if (i==(num_regs-1)) Serial.print(
" (read only) ");
262 Serial.print(
"-1 - Return to Main Menu\n\n");
264 Serial.print(
"Enter a command (0-6 to modify register, or '-1' to return to Main Menu): ");
266 Serial.println(user_address);
269 if (user_address >=0 && user_address<(num_regs-1))
271 Serial.print(
"What value should ADDR");
272 Serial.print(user_address);
273 Serial.print(
" be set to (ex: HEX format 0xff): ");
275 Serial.println(user_regval);
295 uint8_t field_size,
i;
296 long max_num=1, pow2=1;
298 Serial.print(
"CURRENT STATE (HEX): ");
299 Serial.print(field_name);
300 Serial.print(
"= 0x");
301 Serial.println(field_val, HEX);
306 for (i=1; i<field_size; i++)
309 max_num=max_num + pow2;
312 Serial.print(
"What value should ");
313 Serial.print(field_name);
314 Serial.print(
" be set to or type '-1' to exit: (ex: HEX format 0x00 to 0x");
315 Serial.print(max_num, HEX);
319 if (usr_field_val>=0 && usr_field_val<=max_num)
321 Serial.println(usr_field_val);
322 return usr_field_val;
356 while (field_num != 0)
358 Serial.println(F(
"\n*****************************************************************"));
360 Serial.print(F(
"1-CMSINV0 9-LVCS2 17-PD_DIV2\n"));
361 Serial.print(F(
"2-CMSINV1 10-M0 18-PD_OUT0\n"));
362 Serial.print(F(
"3-CMSINV2 11-M1 19-PD_OUT1\n"));
363 Serial.print(F(
"4-DEL0 12-M2 20-PD_OUT2\n"));
364 Serial.print(F(
"5-DEL1 13-PART * 21-REV *\n"));
365 Serial.print(F(
"6-DEL2 14-PDALL 22-SYNC_EN0\n"));
366 Serial.print(F(
"7-LVCS0 15-PD_DIV0 23-SYNC_EN1\n"));
367 Serial.print(F(
"8-LVCS1 16-PD_DIV1 24-SYNC_EN2\n"));
368 Serial.print(
"0 - Return to Main Menu\n");
369 Serial.print(
"* = READ ONLY FIELD\n\n");
371 Serial.print(
"Enter a command (1-24 to modify register, or '0' to return to Main Menu): ");
373 Serial.println(field_num);
616 for (uint8_t
i = 0;
i <= num_reg ;
i++)
621 Serial.println(F(
"PLL Settings Stored to EEPROM"));
634 uint8_t user_address;
648 for (uint8_t
i = 0;
i <= num_reg ;
i++)
654 Serial.println(F(
"PLL Settings Restored"));
658 Serial.println(F(
"PLL Settings not found"));
668 Serial.println(F(
"*****************************************************************"));
669 Serial.println(F(
"* DC1954 Demonstration Program *"));
670 Serial.println(F(
"* *"));
671 Serial.println(F(
"* This program demonstrates how to send data to the LTC6954 *"));
672 Serial.println(F(
"* Low Phase Noise, Triple Output Clock Distribution *"));
673 Serial.println(F(
"* Divider/Driver. *"));
674 Serial.println(F(
"* Set the baud rate to 115200 and select the newline terminator.*"));
675 Serial.println(F(
"* *"));
676 Serial.println(F(
"*****************************************************************"));
686 Serial.println(F(
"\nCommand Summary:"));
687 Serial.println(F(
" 1-Load Default Settings (same as the LTC6954 GUI's LTC6954.6954set settings)"));
688 Serial.println(F(
" 2-READ/WRITE to Registers Addresses"));
689 Serial.println(F(
" 3-READ/WRITE to Registers Fields"));
690 Serial.println(F(
" 4-Store LTC6954 SPI settings to the DC1954's EEPROM"));
691 Serial.println(F(
" 5-Restore LTC6954 SPI settings from the DC1954's EEPROM"));
693 Serial.print(F(
"Enter a command: "));
struct demo_board_type demo_board
Instantiate demo board structure.
static void print_title()
Prints the title block when program first starts.
static void menu_4_store_settings()
Store PLL settings to nonvolatile EEPROM on demo board.
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 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 LTC6954_read(uint8_t cs, int8_t address)
LTC6954 Read Single Address reads 8 bit Data field to LTC6954.
char name[15]
Demo Circuit number (DC1678)
#define LTC6954_PD_DIV1
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_PDALL
for spi_map array, defines location for field specific information used to create the spi map ...
static void menu_1_load_default_settings()
Menu 1: Load Default SPI Register Settings This function identifies which of the 4 LTC6954 frequency ...
#define LTC6954_SYNC_EN0
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_M2
for spi_map array, defines location for field specific information used to create the spi map ...
LTC6954: Low Phase Noise, Triple Output Clock Distribution Divider/Driver.
Header File for Linduino Libraries and Demo Code.
static void menu_5_restore_settings()
Read stored PLL settings from nonvolatile EEPROM on demo board.
#define LTC6954_PD_OUT0
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_LVCS1
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_SYNC_EN1
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_LVCS2
for spi_map array, defines location for field specific information used to create the spi map ...
static void print_prompt()
Prints main menu.
#define LTC6954_PART
for spi_map array, defines location for field specific information used to create the spi map ...
void LTC6954_init()
Initializes the SPI MAP arrays The values set in initialization are used all the LTC6954 SPI/WRITE an...
static void loop()
Repeats Linduino loop.
#define LTC6954_CMSINV0
for spi_map array, defines location for field specific information used to create the spi map ...
union LT_union_int32_4bytes data
uint8_t get_LTC6954_REGSIZE()
returns # of addresses in parts register map (array size)
#define LTC6954_PD_OUT2
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_DEL1
for spi_map array, defines location for field specific information used to create the spi map ...
static uint8_t First_Run
if first time through loop = 0, otherwise=1
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 ...
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 get_LTC6954_SPI_FIELD_RW(uint8_t f)
returns if the given field name is (0)read/write or (1)read_only field
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.
#define LTC6954_PD_DIV2
for spi_map array, defines location for field specific information used to create the spi map ...
long get_LTC6954_SPI_FIELD(uint8_t cs, uint8_t f)
Gets the LTC6954 SPI field value calls function LTC6954_read_field, which reads specific address loca...
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
#define LTC6954_M1
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_PD_OUT1
for spi_map array, defines location for field specific information used to create the spi map ...
#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 LTC6954_CS
Define the SPI CS pin.
#define LTC6954_SYNC_EN2
for spi_map array, defines location for field specific information used to create the spi map ...
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
static void setup()
Initialize Linduino.
void set_LTC6954_SPI_FIELD(uint8_t cs, uint8_t f, long field_data)
Sets the LTC6954 SPI field value calls function LTC6954_read_field, which reads specific address/fiel...
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 uint8_t ref_out
Used to keep track of reference out status.
void LTC6954_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6954 Write Single Address writes 8 bit Data field to LTC6954.
#define LTC6954_PD_DIV0
for spi_map array, defines location for field specific information used to create the spi map ...
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...
char product_name[15]
LTC Product (LTC2654-L16)
#define LTC6954_DEL0
for spi_map array, defines location for field specific information used to create the spi map ...
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
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 ...
#define LTC6954_REV
for spi_map array, defines location for field specific information used to create the spi map ...
void set_LTC6954_ALLREGS(uint8_t cs, uint8_t reg00, uint8_t reg01, uint8_t reg02, uint8_t reg03, uint8_t reg04, uint8_t reg05, uint8_t reg06)
Writes values to ALL LTC6954 RW address.
static int8_t demo_board_connected
Demo Board Name stored in QuikEval EEPROM.
#define LTC6954_CMSINV1
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_LVCS0
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_DEL2
for spi_map array, defines location for field specific information used to create the spi map ...
uint8_t get_LTC6954_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
#define LTC6954_M0
for spi_map array, defines location for field specific information used to create the spi map ...
#define LTC6954_CMSINV2
for spi_map array, defines location for field specific information used to create the spi map ...