| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

DC1959A.ino
Go to the documentation of this file.
1 /*!
2 DC1959A
3 LTC6948: Ultralow Noise and Spurious 0.37GHz to 6.39GHz FracN Synthesizer with Integrated VCO
4
5 @verbatim
6
7 Setup:
8 Set the terminal baud rate to 115200 and select the newline terminator.
9 Refer to Demo Manual DC1959A.
10 Ensure all jumpers are installed in the factory default positions.
11 Two power supplies are needed for this demo board: a 5v and a 3.3v supply.
12 A reference frequency is also needed for this demo board, refer to the
13 DC1959 Demo Manual for details.
14
15
16 Command Description:
17
18 *****Main Menu*****
19 1- Load Default Settings- Loads the SPI map that is identical to file
20 LTC6948-x_100MHz.fracnset that is supplied with the FracNWizard and mentioned
21 in the DC1959A user's manual. It assumes a 100MHz reference input and the
22 default DC1959A loop filter. It should output a 907MHz signal on RF+/-.
23
24 ** If you want to use a different loop filter, reference frequency or different
25 register settings. Please use FracNWizard for the loop filter design and initial
26 device setup. The register settings from FracNWizard can be entered into menu option 2.
27
28 2- READ/WRITE to Registers Addresses- Selecting this option will cause all the registers to
29 be read, stored to variables, and displayed. The user will then have the option
30 to write to one register address at a time.
31
32 3- READ/WRITE to Registers Fields- Selecting this option will allow the user
33 to read or write to one register field name at a time.
34
35 4- This function calculates and programs OD, ND, NUM based on the desired Frf,
36 the reference frequency, and the current RD value. Linduino One (Arduino Uno) are
37 limited to 32 bit floats, int and doubles. Significant rounding errors are created
38 with this 32 bit limitation. Therefore, this function uses 64bit math functions
39 specifically created to overcome this limitation. After OD, ND, and NUM are programmed,
40 the program calibrates the LTC6948. If other register need change see menu 2 or menu 3.
41
42 5- This function stores the current SPI settings in the demo boards EEPROM
43
44 6- This function loads SPI settings from the demo boards EEPROM to the device
45
46 USER INPUT DATA FORMAT:
47 decimal : 1024
48 hex : 0x400
49 octal : 02000 (leading 0 "zero")
50 binary : B10000000000
51 float : 1024.0
52
53 @endverbatim
54
55 http://www.linear.com/product/LTC6948
56
57 http://www.linear.com/product/LTC6948#demoboards
58
59
60 Copyright 2018(c) Analog Devices, Inc.
61
62 All rights reserved.
63
64 Redistribution and use in source and binary forms, with or without
65 modification, are permitted provided that the following conditions are met:
66 - Redistributions of source code must retain the above copyright
67 notice, this list of conditions and the following disclaimer.
68 - Redistributions in binary form must reproduce the above copyright
69 notice, this list of conditions and the following disclaimer in
70 the documentation and/or other materials provided with the
71 distribution.
72 - Neither the name of Analog Devices, Inc. nor the names of its
73 contributors may be used to endorse or promote products derived
74 from this software without specific prior written permission.
75 - The use of this software may or may not infringe the patent rights
76 of one or more patent holders. This license does not release you
77 from the requirement that you obtain separate licenses from these
78 patent holders to use this software.
79 - Use of the software either in source or binary form, must be run
80 on or directly connected to an Analog Devices Inc. component.
81
82 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
83 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
84 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
85 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
86 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
87 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
88 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
89 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
90 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
91 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
92 */
93
94 /*! @file
95 @ingroup LTC6948
96 */
97
98 #include <Arduino.h>
99 #include <stdint.h>
100 #include "Linduino.h"
101 #include "LT_SPI.h"
102 #include "UserInterface.h"
103 #include "LT_I2C.h"
104 #include "QuikEval_EEPROM.h"
105 #include "LTC6948.h"
106 #include <SPI.h>
107 #include <Wire.h>
108
109 // Function Declaration
110 void print_title(); // Print the title block
111 void print_prompt(); // Print the main menu
112 void menu_1_load_default_settings(); // Sub-menus
113 void menu_2_RW_to_reg_addresss();
114 void menu_3_RW_to_reg_field();
115 void menu_4_set_frf();
116 void menu_5_store_settings();
117 void menu_6_restore_settings();
118
119 // Global Variables
120 static uint8_t ref_out = 0; //!< Used to keep track of reference out status
121 static int8_t demo_board_connected; //!< Demo Board Name stored in QuikEval EEPROM
122 uint8_t First_Run=0; //!< if first time through loop = 0, otherwise=1
123
124
125 /* ------------------------------------------------------------------------- */
126 //! Initialize Linduino
127 //! @return void
128 void setup()
129 {
130 char demo_name[] = "DC1959"; // Demo Board Name stored in QuikEval EEPROM
131 uint8_t data;
132
133 quikeval_SPI_init(); //! Configure the spi port for 4MHz SCK
134 quikeval_SPI_connect(); //! Connect SPI to main data port
135 quikeval_I2C_init(); //! Configure the EEPROM I2C port for 100kHz
136 Serial.begin(115200); //! Initialize the serial port to the PC
137 LTC6948_init();
138 print_title();
139
140 demo_board_connected = discover_demo_board(demo_name); //! Checks if correct demo board is connected.
141
142 if (!demo_board_connected)
143 while (1); //! Does nothing if the demo board is not connected
144
145 Serial.print(demo_board.name);
146 Serial.println(F(" was found"));
147
148 print_prompt();
149 } // end of setup()
150
151
152 /* ------------------------------------------------------------------------- */
153 //! Repeats Linduino loop
154 //! @return void
155 void loop()
156 {
157 uint16_t user_command; // User input command
158
159 if (Serial.available()) // Check for user input
160 {
161 if (First_Run==0)
162 {
163 First_Run=1;
164 }
165
166 user_command = read_int(); //! Reads the user command
167 if (user_command != 'm')
168 Serial.println(user_command);
169
170 switch (user_command) //! Prints the appropriate submenu
171 {
172 case 1:
173 menu_1_load_default_settings();
174 break;
175
176 case 2:
177 menu_2_RW_to_reg_addresss();
178 break;
179
180 case 3:
181 menu_3_RW_to_reg_field();
182 break;
183
184 case 4:
185 menu_4_set_frf();
186 break;
187
188 case 5:
189 menu_5_store_settings();
190 break;
191
192 case 6:
193 menu_6_restore_settings();
194 break;
195
196 default:
197 Serial.println(F("Incorrect Option"));
198 break;
199 } // end of switch statement
200 Serial.println(F("\n*****************************************************************"));
201 print_prompt();
202 } // end of if statement
203 } // end of loop()
204
205 // Function Definitions
206 /* ------------------------------------------------------------------------- */
207 //! Menu 1: Load Default SPI Register Settings
208 //! This function identifies which of the 4 LTC6948 frequency versions are connected.
209 //! Based on the version connected, this function loads the register settings referenced
210 //! in the DC1959A demo manual's quick start section.
211 //! The register settings loaded are the same as FRACN WIZARDS fracnset files
212 //! LTC6948-x_100MHz.fracnset (where x=1,2,3,or 4)
213 //! The setting loaded with this function assume the LTC6948's reference is set to 100MHz and
214 //! the DC1959A's loop filter has not been modified.
215 //! @return void
216 void menu_1_load_default_settings()
217 {
218
219 // select which default register setting to load based on part number
220 if (demo_board.product_name[8]=='1') // if this is a LTC6948-1
221 set_LTC6948_ALLREGS(LTC6948_CS,0x04,0x04,0x3E,0x6E,0x11,0x10,0x48,0x23,0xD7,0x10,0x1C,0x0D,0x00);
222 else if (demo_board.product_name[8]=='2') // if this is a LTC6948-2
223 set_LTC6948_ALLREGS(LTC6948_CS, 0x04,0x04,0x3E,0x5E,0x11,0x10,0x5A,0x2C,0xCC,0xD0,0x1D,0x0D,0xC0);
224 else if (demo_board.product_name[8]=='3') // if this is a LTC6948-3
225 set_LTC6948_ALLREGS(LTC6948_CS,0x04,0x04,0x3E,0x4E,0x11,0x10,0x6C,0x35,0xC2,0x90,0x1E,0x0D,0xC0);
226 else if (demo_board.product_name[8]=='4') // if this is a LTC6948-4
227 set_LTC6948_ALLREGS(LTC6948_CS,0x04,0x04,0x3E,0x4E,0x11,0x10,0x6C,0x35,0xC2,0x90,0x1E,0x0D,0xC0);
228 else
229 {
230 Serial.print("No default file for this board: ");
231 Serial.println(demo_board.product_name);
232 } // end if-then-else statement
233
234 Serial.println(F("Registers Have Been Written"));
235 } // end menu_1_load_default_settings function
236
237
238 /* ------------------------------------------------------------------------- */
239 //! Menu 2: Reads and/or Writes the SPI register address
240 //! This function reads and displays all SPI register address settings in HEX format.
241 //! It then provides an option to modify(write to) individual registers one at time
242 //!
243 //! EXAMPLE:
244 //! - 0- ADDR00 = 0x04 (read only)
245 //! - 1- ADDR01 = 0x04
246 //! - ....
247 //! - 13- ADDR0D = 0x00
248 //! - 14- ADDR0E = 0x11 (read only)
249 //! - 0 - Return to Main Menu
250 //! - Enter a command (1-13 to modify register, or '0' to return to Main Menu):
251 //! @return void
252 void menu_2_RW_to_reg_addresss()
253 {
254 uint8_t i, regval, user_regval,num_reg;
255 uint16_t user_address; // User input command
256
257 num_reg = get_LTC6948_REGSIZE();
258 user_address=1;
259 // Read/Write loop, can exit loop by choosing '0'
260 while (user_address != 0)
261 {
262 Serial.println(F("\n*****************************************************************"));
263 // Read All Registers and display results
264 for (i=0; i<num_reg; i++)
265 {
266 regval = LTC6948_read(LTC6948_CS,i);
267 Serial.print(i);
268 if (i<16)
269 Serial.print(F("- ADDR0"));
270 else
271 Serial.print(F("- ADDR"));
272 Serial.print(i, HEX);
273 Serial.print(F(" = 0x"));
274 if (regval<16) Serial.print(F("0"));
275 Serial.print(regval, HEX);
276 if ((i==0)||(i==(num_reg-1))) Serial.print(" (read only) ");
277 if (i==2) Serial.print(" (warning: if D0=1 it resets all registers. Power On Reset Bit)");
278 Serial.println("");
279 } // end for loop
280 Serial.print("0 - Return to Main Menu\n\n");
281 // User input: Select which register to modify, or return to main menu
282 Serial.print("Enter a command (1-13 to modify register, or '0' to return to Main Menu): ");
283 user_address = read_int(); //! Reads the user command
284 Serial.println(user_address);
285
286 // User input: enter new setting for selected register
287 if (user_address >0 && user_address<(num_reg-1))
288 {
289 Serial.print("What value should ADDR");
290 Serial.print(user_address);
291 Serial.print(" be set to (ex: HEX format 0xff): ");
292 user_regval = read_int(); //! Reads the user command
293 Serial.println(user_regval);
294
295 // writes new setting to part
296 LTC6948_write(LTC6948_CS, (uint8_t)user_address, user_regval);
297 } // end if statement
298 } // end while loop
299 } // end menu_2_RW_to_reg_addresss
300
301
302 /* ------------------------------------------------------------------------- */
303 //! Support function for function menu_3_RW_to_reg_field
304 //! displays current state of select field
305 //! provides user the option to write to that field or return to menu
306 //! @return field value (user input) that will be written to part
307 long field_menu_RW(long field_val, //!< current state of the selected field
308 char field_name[], //!< SPI Field name selected
309 uint8_t f //!< SPI field identifier identifies selected fields information in SPI MAP arrays
310 )
311 {
312 long usr_field_val;
313 uint8_t field_size, i;
314 long max_num=1, pow2=1;
315
316 Serial.print("CURRENT STATE (HEX): ");
317 Serial.print(field_name);
318 Serial.print("= 0x");
319 Serial.println(field_val, HEX);
320
321 if (get_LTC6948_SPI_FIELD_RW(f)==0)
322 {
323 field_size=get_LTC6948_SPI_FIELD_NUMBITS(f);
324 for (i=1; i<field_size; i++)
325 {
326 pow2=pow2*2;
327 max_num=max_num + pow2;
328 }
329
330 Serial.print("What value should ");
331 Serial.print(field_name);
332 Serial.print(" be set to or type '-1' to exit: (ex: HEX format 0x00 to 0x");
333 Serial.print(max_num, HEX);
334 Serial.print(")");
335 usr_field_val = read_int(); //! Reads the user command
336
337 if (usr_field_val>=0 && usr_field_val<=max_num)
338 {
339 Serial.println(usr_field_val);
340 return usr_field_val;
341 }
342 else
343 {
344 return field_val;
345 } // end of if statement
346 } // end of if statement
347 } // end of field_menu_RW
348
349
350 /* ------------------------------------------------------------------------- */
351 //! Menu 3: Reads and/or Writes individual SPI fields
352 //! This function provides the user with a list of all SPI fields.
353 //! The user can select a SPI field to read its current value.
354 //! Then the user will be provided with an option to write to that field
355 //! or return to the selection menu.
356 //!
357 //! EXAMPLE:
358 //! - 1-ALCCAL 18-CPMID 35-PART *
359 //! - 2-ALCEN 19-CPRST 36-PDALL
360 //! - ....
361 //! - 16-CPINV 33-OD 50-x
362 //! - 17-CPLE 34-OMUTE
363 //! - 0 - Return to Main Menu
364 //! - * = READ ONLY FIELD
365 //! - Enter a command (1-50 to modify register, or '0' to return to Main Menu):
366 //! @return void
367 void menu_3_RW_to_reg_field()
368 {
369 uint8_t field_num;
370 long field_val;
371
372 field_num=1;
373 // Read/Write loop, can exit loop by choosing 'm'
374 while (field_num != 0)
375 {
376 Serial.println(F("\n*****************************************************************"));
377 // Select Fields to read and write to
378 Serial.print(F("1-ALCCAL 18-CPMID 35-PART *\n"));
379 Serial.print(F("2-ALCEN 19-CPRST 36-PDALL\n"));
380 Serial.print(F("3-ALCHI * 20-CPUP 37-PDFN\n"));
381 Serial.print(F("4-ALCLO * 21-CPWIDE 38-PDOUT\n"));
382 Serial.print(F("5-ALCMON 22-DITHEN 39-PDPLL\n"));
383 Serial.print(F("6-ALCULOK 23-FILT 40-PDVCO\n"));
384 Serial.print(F("7-AUTOCAL 24-INTN 41-POR\n"));
385 Serial.print(F("8-AUTORST 25-LDOEN 42-RD\n"));
386 Serial.print(F("9-BD 26-LDOV 43-REV *\n"));
387 Serial.print(F("10-BST 27-LKCT 44-RFO\n"));
388 Serial.print(F("11-CAL 28-LKWIN 45-RSTFN\n"));
389 Serial.print(F("12-CP 29-LOCK * 46-SEED\n"));
390 Serial.print(F("13-CPCHI 30-MTCAL 47-THI *\n"));
391 Serial.print(F("14-CPCLO 31-ND 48-TLO *\n"));
392 Serial.print(F("15-CPDN 32-NUM 49-UNLOK *\n"));
393 Serial.print(F("16-CPINV 33-OD 50-x\n"));
394 Serial.print(F("17-CPLE 34-OMUTE\n"));
395 Serial.print("0 - Return to Main Menu\n");
396 Serial.print("* = READ ONLY FIELD\n\n");
397
398 Serial.print("Enter a command (1-50 to modify register, or '0' to return to Main Menu): ");
399 field_num = read_int(); //! Reads the user command
400 Serial.println(field_num);
401
402 // User input: enter new setting for selected register
403 if (field_num != 0)
404 {
405 switch (field_num) //! Prints the appropriate submenu
406 {
407 case LTC6948_ALCCAL:
408 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ALCCAL); // reads selected field
409 field_val=field_menu_RW(field_val,"ALCCAL",LTC6948_ALCCAL); // user interface control and printout
410 if (field_val>-1)
411 {
412 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ALCCAL, field_val); // updates selected field
413 }
414 break;
415
416 case LTC6948_ALCEN:
417 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ALCEN); // reads selected field
418 field_val=field_menu_RW(field_val,"ALCEN",LTC6948_ALCEN); // user interface control and printout
419 if (field_val>-1)
420 {
421 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ALCEN, field_val); // updates selected field
422 }
423 break;
424
425 case LTC6948_ALCHI:
426 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ALCHI); // reads selected field
427 field_val=field_menu_RW(field_val,"ALCHI",LTC6948_ALCHI); // user interface control and printout
428 if (field_val>-1)
429 {
430 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ALCHI, field_val); // updates selected field
431 }
432 break;
433
434 case LTC6948_ALCLO:
435 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ALCLO); // reads selected field
436 field_val=field_menu_RW(field_val,"ALCLO",LTC6948_ALCLO); // user interface control and printout
437 if (field_val>-1)
438 {
439 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ALCLO, field_val); // updates selected field
440 }
441 break;
442
443 case LTC6948_ALCMON:
444 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ALCMON); // reads selected field
445 field_val=field_menu_RW(field_val,"ALCMON",LTC6948_ALCMON); // user interface control and printout
446 if (field_val>-1)
447 {
448 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ALCMON, field_val); // updates selected field
449 }
450 break;
451
452 case LTC6948_ALCULOK:
453 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ALCULOK); // reads selected field
454 field_val=field_menu_RW(field_val,"ALCULOK",LTC6948_ALCULOK); // user interface control and printout
455 if (field_val>-1)
456 {
457 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ALCULOK, field_val); // updates selected field
458 }
459 break;
460
461 case LTC6948_AUTOCAL:
462 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_AUTOCAL); // reads selected field
463 field_val=field_menu_RW(field_val,"AUTOCAL",LTC6948_AUTOCAL); // user interface control and printout
464 if (field_val>-1)
465 {
466 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_AUTOCAL, field_val); // updates selected field
467 }
468 break;
469
470 case LTC6948_AUTORST:
471 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_AUTORST); // reads selected field
472 field_val=field_menu_RW(field_val,"AUTORST",LTC6948_AUTORST); // user interface control and printout
473 if (field_val>-1)
474 {
475 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_AUTORST, field_val); // updates selected field
476 }
477 break;
478
479 case LTC6948_BD:
480 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_BD); // reads selected field
481 field_val=field_menu_RW(field_val,"BD",LTC6948_BD); // user interface control and printout
482 if (field_val>-1)
483 {
484 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_BD, field_val); // updates selected field
485 }
486 break;
487
488 case LTC6948_BST:
489 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_BST); // reads selected field
490 field_val=field_menu_RW(field_val,"BST",LTC6948_BST); // user interface control and printout
491 if (field_val>-1)
492 {
493 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_BST, field_val); // updates selected field
494 }
495 break;
496
497 case LTC6948_CAL:
498 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CAL); // reads selected field
499 field_val=field_menu_RW(field_val,"CAL",LTC6948_CAL); // user interface control and printout
500 if (field_val>-1)
501 {
502 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CAL, field_val); // updates selected field
503 }
504 break;
505
506 case LTC6948_CP:
507 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CP); // reads selected field
508 field_val=field_menu_RW(field_val,"CP",LTC6948_CP); // user interface control and printout
509 if (field_val>-1)
510 {
511 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CP, field_val); // updates selected field
512 }
513 break;
514
515 case LTC6948_CPCHI:
516 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPCHI); // reads selected field
517 field_val=field_menu_RW(field_val,"CPCHI",LTC6948_CPCHI); // user interface control and printout
518 if (field_val>-1)
519 {
520 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPCHI, field_val); // updates selected field
521 }
522 break;
523
524 case LTC6948_CPCLO:
525 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPCLO); // reads selected field
526 field_val=field_menu_RW(field_val,"CPCLO",LTC6948_CPCLO); // user interface control and printout
527 if (field_val>-1)
528 {
529 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPCLO, field_val); // updates selected field
530 }
531 break;
532
533 case LTC6948_CPDN:
534 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPDN); // reads selected field
535 field_val=field_menu_RW(field_val,"CPDN",LTC6948_CPDN); // user interface control and printout
536 if (field_val>-1)
537 {
538 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPDN, field_val); // updates selected field
539 }
540 break;
541
542 case LTC6948_CPINV:
543 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPINV); // reads selected field
544 field_val=field_menu_RW(field_val,"CPINV",LTC6948_CPINV); // user interface control and printout
545 if (field_val>-1)
546 {
547 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPINV, field_val); // updates selected field
548 }
549 break;
550
551 case LTC6948_CPLE:
552 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPLE); // reads selected field
553 field_val=field_menu_RW(field_val,"CPLE",LTC6948_CPLE); // user interface control and printout
554 if (field_val>-1)
555 {
556 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPLE, field_val); // updates selected field
557 }
558 break;
559
560 case LTC6948_CPMID:
561 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPMID); // reads selected field
562 field_val=field_menu_RW(field_val,"CPMID",LTC6948_CPMID); // user interface control and printout
563 if (field_val>-1)
564 {
565 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPMID, field_val); // updates selected field
566 }
567 break;
568
569 case LTC6948_CPRST:
570 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPRST); // reads selected field
571 field_val=field_menu_RW(field_val,"CPRST",LTC6948_CPRST); // user interface control and printout
572 if (field_val>-1)
573 {
574 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPRST, field_val); // updates selected field
575 }
576 break;
577
578 case LTC6948_CPUP:
579 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPUP); // reads selected field
580 field_val=field_menu_RW(field_val,"CPUP",LTC6948_CPUP); // user interface control and printout
581 if (field_val>-1)
582 {
583 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPUP, field_val); // updates selected field
584 }
585 break;
586
587 case LTC6948_CPWIDE:
588 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_CPWIDE); // reads selected field
589 field_val=field_menu_RW(field_val,"CPWIDE",LTC6948_CPWIDE); // user interface control and printout
590 if (field_val>-1)
591 {
592 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_CPWIDE, field_val); // updates selected field
593 }
594 break;
595
596 case LTC6948_DITHEN:
597 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_DITHEN); // reads selected field
598 field_val=field_menu_RW(field_val,"DITHEN",LTC6948_DITHEN); // user interface control and printout
599 if (field_val>-1)
600 {
601 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_DITHEN, field_val); // updates selected field
602 }
603 break;
604
605 case LTC6948_FILT:
606 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_FILT); // reads selected field
607 field_val=field_menu_RW(field_val,"FILT",LTC6948_FILT); // user interface control and printout
608 if (field_val>-1)
609 {
610 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_FILT, field_val); // updates selected field
611 }
612 break;
613
614 case LTC6948_INTN:
615 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_INTN); // reads selected field
616 field_val=field_menu_RW(field_val,"INTN",LTC6948_INTN); // user interface control and printout
617 if (field_val>-1)
618 {
619 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_INTN, field_val); // updates selected field
620 }
621 break;
622
623 case LTC6948_LDOEN:
624 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_LDOEN); // reads selected field
625 field_val=field_menu_RW(field_val,"LDOEN",LTC6948_LDOEN); // user interface control and printout
626 if (field_val>-1)
627 {
628 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_LDOEN, field_val); // updates selected field
629 }
630 break;
631
632 case LTC6948_LDOV:
633 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_LDOV); // reads selected field
634 field_val=field_menu_RW(field_val,"LDOV",LTC6948_LDOV); // user interface control and printout
635 if (field_val>-1)
636 {
637 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_LDOV, field_val); // updates selected field
638 }
639 break;
640
641 case LTC6948_LKCT:
642 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_LKCT); // reads selected field
643 field_val=field_menu_RW(field_val,"LKCT",LTC6948_LKCT); // user interface control and printout
644 if (field_val>-1)
645 {
646 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_LKCT, field_val); // updates selected field
647 }
648 break;
649
650 case LTC6948_LKWIN:
651 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_LKWIN); // reads selected field
652 field_val=field_menu_RW(field_val,"LKWIN",LTC6948_LKWIN); // user interface control and printout
653 if (field_val>-1)
654 {
655 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_LKWIN, field_val); // updates selected field
656 }
657 break;
658
659 case LTC6948_LOCK:
660 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_LOCK); // reads selected field
661 field_val=field_menu_RW(field_val,"LOCK",LTC6948_LOCK); // user interface control and printout
662 if (field_val>-1)
663 {
664 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_LOCK, field_val); // updates selected field
665 }
666 break;
667
668 case LTC6948_MTCAL:
669 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_MTCAL); // reads selected field
670 field_val=field_menu_RW(field_val,"MTCAL",LTC6948_MTCAL); // user interface control and printout
671 if (field_val>-1)
672 {
673 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_MTCAL, field_val); // updates selected field
674 }
675 break;
676
677 case LTC6948_ND:
678 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_ND); // reads selected field
679 field_val=field_menu_RW(field_val,"ND",LTC6948_ND); // user interface control and printout
680 if (field_val>-1)
681 {
682 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_ND, field_val); // updates selected field
683 }
684 break;
685
686 case LTC6948_NUM:
687 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_NUM); // reads selected field
688 field_val=field_menu_RW(field_val,"NUM",LTC6948_NUM); // user interface control and printout
689 if (field_val>-1)
690 {
691 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_NUM, field_val); // updates selected field
692 }
693 break;
694
695 case LTC6948_OD:
696 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_OD); // reads selected field
697 field_val=field_menu_RW(field_val,"OD",LTC6948_OD); // user interface control and printout
698 if (field_val>-1)
699 {
700 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_OD, field_val); // updates selected field
701 }
702 break;
703
704 case LTC6948_OMUTE:
705 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_OMUTE); // reads selected field
706 field_val=field_menu_RW(field_val,"OMUTE",LTC6948_OMUTE); // user interface control and printout
707 if (field_val>-1)
708 {
709 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_OMUTE, field_val); // updates selected field
710 }
711 break;
712
713 case LTC6948_PART:
714 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_PART); // reads selected field
715 field_val=field_menu_RW(field_val,"PART",LTC6948_PART); // user interface control and printout
716 if (field_val>-1)
717 {
718 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_PART, field_val); // updates selected field
719 }
720 break;
721
722 case LTC6948_PDALL:
723 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_PDALL); // reads selected field
724 field_val=field_menu_RW(field_val,"PDALL",LTC6948_PDALL); // user interface control and printout
725 if (field_val>-1)
726 {
727 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_PDALL, field_val); // updates selected field
728 }
729 break;
730
731 case LTC6948_PDFN:
732 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_PDFN); // reads selected field
733 field_val=field_menu_RW(field_val,"PDFN",LTC6948_PDFN); // user interface control and printout
734 if (field_val>-1)
735 {
736 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_PDFN, field_val); // updates selected field
737 }
738 break;
739
740 case LTC6948_PDOUT:
741 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_PDOUT); // reads selected field
742 field_val=field_menu_RW(field_val,"PDOUT",LTC6948_PDOUT); // user interface control and printout
743 if (field_val>-1)
744 {
745 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_PDOUT, field_val); // updates selected field
746 }
747 break;
748
749 case LTC6948_PDPLL:
750 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_PDPLL); // reads selected field
751 field_val=field_menu_RW(field_val,"PDPLL",LTC6948_PDPLL); // user interface control and printout
752 if (field_val>-1)
753 {
754 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_PDPLL, field_val); // updates selected field
755 }
756 break;
757
758 case LTC6948_PDVCO:
759 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_PDVCO); // reads selected field
760 field_val=field_menu_RW(field_val,"PDVCO",LTC6948_PDVCO); // user interface control and printout
761 if (field_val>-1)
762 {
763 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_PDVCO, field_val); // updates selected field
764 }
765 break;
766
767 case LTC6948_POR:
768 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_POR); // reads selected field
769 field_val=field_menu_RW(field_val,"POR",LTC6948_POR); // user interface control and printout
770 if (field_val>-1)
771 {
772 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_POR, field_val); // updates selected field
773 }
774 break;
775
776 case LTC6948_RD:
777 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_RD); // reads selected field
778 field_val=field_menu_RW(field_val,"RD",LTC6948_RD); // user interface control and printout
779 if (field_val>-1)
780 {
781 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_RD, field_val); // updates selected field
782 }
783 break;
784
785 case LTC6948_REV:
786 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_REV); // reads selected field
787 field_val=field_menu_RW(field_val,"REV",LTC6948_REV); // user interface control and printout
788 if (field_val>-1)
789 {
790 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_REV, field_val); // updates selected field
791 }
792 break;
793
794 case LTC6948_RFO:
795 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_RFO); // reads selected field
796 field_val=field_menu_RW(field_val,"RFO",LTC6948_RFO); // user interface control and printout
797 if (field_val>-1)
798 {
799 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_RFO, field_val); // updates selected field
800 }
801 break;
802
803 case LTC6948_RSTFN:
804 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_RSTFN); // reads selected field
805 field_val=field_menu_RW(field_val,"RSTFN",LTC6948_RSTFN); // user interface control and printout
806 if (field_val>-1)
807 {
808 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_RSTFN, field_val); // updates selected field
809 }
810 break;
811
812 case LTC6948_SEED:
813 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_SEED); // reads selected field
814 field_val=field_menu_RW(field_val,"SEED",LTC6948_SEED); // user interface control and printout
815 if (field_val>-1)
816 {
817 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_SEED, field_val); // updates selected field
818 }
819 break;
820
821 case LTC6948_THI:
822 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_THI); // reads selected field
823 field_val=field_menu_RW(field_val,"THI",LTC6948_THI); // user interface control and printout
824 if (field_val>-1)
825 {
826 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_THI, field_val); // updates selected field
827 }
828 break;
829
830 case LTC6948_TLO:
831 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_TLO); // reads selected field
832 field_val=field_menu_RW(field_val,"TLO",LTC6948_TLO); // user interface control and printout
833 if (field_val>-1)
834 {
835 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_TLO, field_val); // updates selected field
836 }
837 break;
838
839 case LTC6948_UNLOK:
840 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_UNLOK); // reads selected field
841 field_val=field_menu_RW(field_val,"UNLOK",LTC6948_UNLOK); // user interface control and printout
842 if (field_val>-1)
843 {
844 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_UNLOK, field_val); // updates selected field
845 }
846 break;
847
848 case LTC6948_x:
849 field_val=get_LTC6948_SPI_FIELD(LTC6948_CS,LTC6948_x); // reads selected field
850 field_val=field_menu_RW(field_val,"x",LTC6948_x); // user interface control and printout
851 if (field_val>-1)
852 {
853 set_LTC6948_SPI_FIELD(LTC6948_CS, LTC6948_x, field_val); // updates selected field
854 }
855 break;
856 } // end of switch statement
857 } // end if user_command != 0 statement
858 } // end while loop
859 } // end menu_3_RW_to_reg_field function
860
861 /* ------------------------------------------------------------------------- */
862 //! verifies reference frequency is within datasheet specifications
863 void LTC6948_Ref_Freq_Verification()
864 {
865 unsigned long temp_val, temp_fref_MHz, temp_fref_Hz;
866 boolean valid_input=false;
867
868 // USER INPUT
869 valid_input=false;
870
871
872 while (valid_input==false)
873 {
874 temp_fref_MHz=get_LTC6948_global_fref_MHz();
875 temp_fref_Hz=get_LTC6948_global_fref_Hz();
876 Serial.print(F("\nThe Reference frequency will be entered with 2 integers\n"));
877 Serial.print(F("1st number is the MHZ portion, the 2nd number is Hz portion\n"));
878 Serial.print(F(" - Example: A. 100\n"));
879 Serial.print(F(" B. 25\n"));
880 Serial.print(F(" equates to 100.000025MHZ\n\n"));
881 Serial.print(F("A. What is the MHz portion of the Reference Input Frequency(MHZ)? ["));
882 Serial.print(temp_fref_MHz);
883 Serial.print(F("]: "));
884 temp_val = read_float(); //! Reads the user command
885 // if user selects enter, keep same Fref. Otherwise set Fref and verify
886 if (temp_val!=0) temp_fref_MHz = abs(temp_val);
887 Serial.println(temp_fref_MHz);
888
889 Serial.print(F("B. What is the sub-MHz portion of the Reference Input Frequency(HZ)? "));
890 temp_val = read_float(); //! Reads the user command
891 temp_fref_Hz = abs(temp_val);
892 Serial.println(temp_fref_Hz);
893
894 // if valid input print the following to the screen
895 if (temp_fref_MHz >=LTC6948_MIN_REF_FREQ & temp_fref_MHz <= LTC6948_MAX_REF_FREQ)
896 {
897 set_LTC6948_global_fref(temp_fref_MHz,temp_fref_Hz);
898 temp_val= temp_fref_MHz*OneMHz + temp_fref_Hz;
899 Serial.print(F("Reference Frequency set to "));
900 Serial.print(temp_val);
901 Serial.println(F("Hz"));
902 valid_input=true;
903 }
904 else
905 {
906 Serial.print(F("Reference Frequency must be between 10MHz and 425MHz\n"));
907 } // end of if-else
908 } // end of while
909 } // end of LTC6948_Ref_Freq_Verification
910
911
912 /* ------------------------------------------------------------------------- */
913 //! verifies frf frequency is within datasheet specifications
914 void LTC6948_Fout_Freq_Verification(char part_version[])
915 {
916 unsigned long odiv, temp_fout_MHz, temp_fout_Hz, temp_val;
917 unsigned long frf[2];
918 boolean valid_input=false;
919
920 // USER INPUT
921 temp_fout_MHz=get_LTC6948_global_frf_MHz();
922 temp_fout_Hz=get_LTC6948_global_frf_Hz();
923
924 while (valid_input==false)
925 {
926 Serial.print(F("\nThe Output Frequency (Frf) will be entered with 2 integers\n"));
927 Serial.print(F("1st number is the MHZ portion, the 2nd number is Hz portion\n"));
928 Serial.print(F("C. What is the MHz portion of the Output Frequency(MHZ)? ["));
929 Serial.print(temp_fout_MHz);
930 Serial.print(F("]: "));
931 temp_val = read_int(); //! Reads the user command
932 // if user selects enter, keep same Fout. Otherwise set Fout and verify
933 if (temp_val!=0) temp_fout_MHz = abs(temp_val);
934 Serial.println(temp_fout_MHz);
935
936 Serial.print(F("D. What is the Hz portion of the Output Frequency(HZ)? "));
937 temp_val = read_int(); //! Reads the user command
938 temp_fout_Hz = abs(temp_val);
939 Serial.println(temp_fout_Hz);
940
941 HZto64(frf,temp_fout_MHz,temp_fout_Hz); // convert to 64 bit integer
942
943 // verify desired frequency falls within a divider range (1-6)
944 odiv = LTC6948_calc_odiv(part_version, frf);
945 valid_input=false;
946 if ((odiv>=1) && (odiv<=6)) valid_input=true;
947
948 // if valid input print the following to the screen
949 if (valid_input==true)
950 {
951 set_LTC6948_global_frf(temp_fout_MHz,temp_fout_Hz);
952 if (temp_fout_MHz < 4294)
953 {
954 temp_val= temp_fout_MHz*OneMHz + temp_fout_Hz;
955 Serial.print(F("Desired Output Frequency is "));
956 Serial.print(temp_val);
957 Serial.println(F("Hz"));
958 }
959 else // over flow condition
960 {
961 Serial.print(F("Desired Output Frequency is "));
962 Serial.print(temp_fout_MHz);
963 Serial.print(F("MHz + "));
964 Serial.print(temp_fout_Hz);
965 Serial.println(F("Hz"));
966 }
967 }
968 // if invalid input print the following to the screen
969 else
970 {
971 Serial.println(F("Invalid Fout frequency chosen"));
972 } // end of if/else (valid_input==true)
973 } // end of while(valid_input=false)
974 } // end of Fout_Freq_Verification
975
976
977 /* ------------------------------------------------------------------------- */
978 //! Menu 4: Calculates and programs OD, ND, NUM based on desired Frf
979 //! This function calculates and programs OD, ND, NUM based on desired Frf,
980 //! the reference frequency, and current RD value.
981 //! Linduino One (Arduino Uno) are limited to 32 bit floats, int and doubles.
982 //! Significant rounding errors are created with this 32 bit limitation. Therefore,
983 //! This function uses 64bit math functions specifically created to overcome this limitation.
984 //! After OD, ND, and NUM are programmed, the program calibrates the LTC6948
985 //! If RD needs to change see menu 2 or menu 3
986 //! @return void
987 void menu_4_set_frf()
988 {
989 Serial.print(F("\nThis function calculates and programs OD, ND, NUM\n"));
990 Serial.print(F("based on the value input for Frf and Fref. It then calibrates the part.\n"));
991 Serial.print(F("It assumes all other register settings are correct\n"));
992 Serial.print(F("The FracNWizard tool can verify the correctness of the other register settings.\n"));
993
994 LTC6948_Ref_Freq_Verification();
995 LTC6948_Fout_Freq_Verification(demo_board.product_name);
996 LTC6948_set_frf(demo_board.product_name);
997 }
998
999 /* ------------------------------------------------------------------------- */
1000 //! Store PLL settings to nonvolatile EEPROM on demo board
1001 //! @return void
1002 void menu_5_store_settings()
1003 {
1004 // Store the PLL Settings to the EEPROM
1005 uint8_t regval;
1006
1007 uint8_t addr_offset;
1008 uint8_t num_reg;
1009
1010 addr_offset=2;
1011 num_reg = get_LTC6948_REGSIZE();
1012
1013 eeprom_write_int16(EEPROM_I2C_ADDRESS, EEPROM_CAL_KEY, EEPROM_CAL_STATUS_ADDRESS); // Cal key
1014
1015 for (uint8_t i = 0; i <= num_reg ; i++)
1016 {
1017 regval = LTC6948_read(LTC6948_CS,i);
1018 eeprom_write_byte(EEPROM_I2C_ADDRESS,(char) regval, EEPROM_CAL_STATUS_ADDRESS+ i+addr_offset);
1019 }
1020 Serial.println(F("PLL Settings Stored to EEPROM"));
1021
1022 }
1023
1024
1025 /* ------------------------------------------------------------------------- */
1026 //! Read stored PLL settings from nonvolatile EEPROM on demo board
1027 //! @return void
1028 void menu_6_restore_settings()
1029 {
1030 // Read the PLL settings from EEPROM
1031 int16_t cal_key;
1032 uint8_t regval;
1033 uint8_t user_address;
1034
1035 uint8_t addr_offset;
1036 uint8_t num_reg;
1037
1038 addr_offset=2;
1039 num_reg = get_LTC6948_REGSIZE();
1040
1041 // read the cal key from the EEPROM
1042 eeprom_read_int16(EEPROM_I2C_ADDRESS, &cal_key, EEPROM_CAL_STATUS_ADDRESS);
1043 if (cal_key == EEPROM_CAL_KEY)
1044 {
1045 // PLL Settings has been stored, read PLL Settings
1046 user_address=2;
1047 for (uint8_t i = 0; i <= num_reg ; i++)
1048 {
1049 eeprom_read_byte(EEPROM_I2C_ADDRESS,(char *) &regval, EEPROM_CAL_STATUS_ADDRESS + i+addr_offset);
1050 LTC6948_write(LTC6948_CS, (uint8_t)i, regval);
1051 user_address++;
1052 }
1053 Serial.println(F("PLL Settings Restored"));
1054 }
1055 else
1056 {
1057 Serial.println(F("PLL Settings not found"));
1058 }
1059
1060 }
1061
1062
1063 /* ------------------------------------------------------------------------- */
1064 //! Prints the title block when program first starts.
1065 void print_title()
1066 {
1067
1068 Serial.println(F("*****************************************************************"));
1069 Serial.println(F("* DC1959 Demonstration Program *"));
1070 Serial.println(F("* *"));
1071 Serial.println(F("* This program demonstrates how to send data to the LTC6948 *"));
1072 Serial.println(F("* Ultra Low Noise & Spurious FracN Synthesizer with *"));
1073 Serial.println(F("* Integrated VCO. *"));
1074 Serial.println(F("* Set the baud rate to 115200 and select the newline terminator.*"));
1075 Serial.println(F("* *"));
1076 Serial.println(F("* For loop filter design please use the FracN Wizard software. *"));
1077 Serial.println(F("* - It is recommended to use FracNWizard to determine the *"));
1078 Serial.println(F("* correct SPI register values for the initial setup. These *"));
1079 Serial.println(F("* values can be entered into this program via menu option 2 *"));
1080 Serial.println(F("* below. These values can then be stored and recalled from the *"));
1081 Serial.println(F("* DC1959 EEPROM using options 5 and 6 below. *"));
1082 Serial.println(F("*****************************************************************"));
1083 Serial.println();
1084 } // end of print_title
1085
1086
1087 /* ------------------------------------------------------------------------- */
1088 //! Prints main menu.
1089 void print_prompt()
1090 {
1091
1092 Serial.println(F("\nCommand Summary:"));
1093 Serial.println(F(" 1-Load Default Settings (same as the FracN Wizard's LTC6948-x_100MHz.fracnset settings)"));
1094 Serial.println(F(" 2-READ/WRITE to Registers Addresses"));
1095 Serial.println(F(" 3-READ/WRITE to Registers Fields"));
1096 Serial.println(F(" 4-Set Output Frequency (Frf)"));
1097 Serial.println(F(" 5-Store LTC6948 SPI settings to the DC1959's EEPROM"));
1098 Serial.println(F(" 6-Restore LTC6948 SPI settings from the DC1959's EEPROM"));
1099 Serial.println("");
1100 Serial.print(F("Enter a command: "));
1101 } // end of print_prompt
1102
1103
demo_board
struct demo_board_type demo_board
Instantiate demo board structure.
Definition: QuikEval_EEPROM.cpp:71
LTC6948_read
uint8_t LTC6948_read(uint8_t cs, int8_t address)
LTC6948 Read Single Address reads 8 bit Data field to LTC6948.
Definition: LTC6948.cpp:95
LTC6948_UNLOK
#define LTC6948_UNLOK
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:129
eeprom_read_int16
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.
Definition: QuikEval_EEPROM.cpp:395
LTC6948_PDOUT
#define LTC6948_PDOUT
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:118
user_command
unsigned char user_command
Definition: Serial_EEPROM_Test.ino:75
EEPROM_I2C_ADDRESS
#define EEPROM_I2C_ADDRESS
Definition: QuikEval_EEPROM.h:60
LTC6948_OMUTE
#define LTC6948_OMUTE
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:114
eeprom_write_byte
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.
Definition: QuikEval_EEPROM.cpp:214
LTC6948_ALCEN
#define LTC6948_ALCEN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:82
demo_board_type::name
char name[15]
Demo Circuit number (DC1678)
Definition: QuikEval_EEPROM.h:71
LTC6948_CPCLO
#define LTC6948_CPCLO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:94
LTC6948_PART
#define LTC6948_PART
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:115
LTC6948_SEED
#define LTC6948_SEED
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:126
LTC6948_CPRST
#define LTC6948_CPRST
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:99
LTC6948_LKWIN
#define LTC6948_LKWIN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:108
LTC6948_LKCT
#define LTC6948_LKCT
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:107
get_LTC6948_SPI_FIELD
long get_LTC6948_SPI_FIELD(uint8_t cs, uint8_t f)
Gets the LTC6948 SPI field value calls function LTC6948_read_field, which reads specific address loca...
Definition: LTC6948.cpp:151
LTC6948_ALCULOK
#define LTC6948_ALCULOK
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:86
Linduino.h
Header File for Linduino Libraries and Demo Code.
LTC6948_CPINV
#define LTC6948_CPINV
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:96
LTC6948_CPCHI
#define LTC6948_CPCHI
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:93
LTC6948_CPUP
#define LTC6948_CPUP
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:100
get_LTC6948_REGSIZE
uint8_t get_LTC6948_REGSIZE()
returns # of addresses in parts register map (array size)
Definition: LTC6948.cpp:229
LTC6948_RSTFN
#define LTC6948_RSTFN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:125
LTC6948_OD
#define LTC6948_OD
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:113
LTC6948_write
void LTC6948_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6948 Write Single Address writes 8 bit Data field to LTC6948.
Definition: LTC6948.cpp:162
LTC6948_NUM
#define LTC6948_NUM
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:112
LTC6948_FILT
#define LTC6948_FILT
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:103
LTC6948_ALCHI
#define LTC6948_ALCHI
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:83
LTC6948_MTCAL
#define LTC6948_MTCAL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:110
get_LTC6948_global_frf_Hz
unsigned long get_LTC6948_global_frf_Hz()
returns global LTC6948_Frf_Hz
Definition: LTC6948.cpp:534
LTC6948_AUTORST
#define LTC6948_AUTORST
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:88
OneMHz
#define OneMHz
1MHz in long format, used in 64 bit math
Definition: LTC6945.h:121
LTC6948_MIN_REF_FREQ
#define LTC6948_MIN_REF_FREQ
LTC6948 lower reference frequency limit.
Definition: LTC6948.h:153
setup
static void setup()
Initialize Linduino.
Definition: DC1959A.ino:128
menu_1_load_default_settings
static void menu_1_load_default_settings()
Menu 1: Load Default SPI Register Settings This function identifies which of the 4 LTC6948 frequency ...
Definition: DC1959A.ino:216
set_LTC6948_SPI_FIELD
void set_LTC6948_SPI_FIELD(uint8_t cs, uint8_t f, long field_data)
Sets the LTC6948 SPI field value calls function LTC6948_read_field, which reads specific address/fiel...
Definition: LTC6948.cpp:262
LTC6948_AUTOCAL
#define LTC6948_AUTOCAL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:87
get_LTC6948_global_fref_Hz
unsigned long get_LTC6948_global_fref_Hz()
returns global LTC6948_Fref_Hz
Definition: LTC6948.cpp:524
LTC6948_CPMID
#define LTC6948_CPMID
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:98
menu_4_set_frf
static void menu_4_set_frf()
Menu 4: Calculates and programs OD, ND, NUM based on desired Frf This function calculates and program...
Definition: DC1959A.ino:987
HZto64
void HZto64(unsigned long an[], unsigned long MHzPart, unsigned long HzPart)
create a 64 bit Hz number from 32 bit xxxx MHz number and 32 bit yyy yyy Hz number.
Definition: LTC6945.cpp:729
menu_2_RW_to_reg_addresss
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...
Definition: DC1959A.ino:252
LTC6948_LDOV
#define LTC6948_LDOV
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:106
LTC6948_ALCLO
#define LTC6948_ALCLO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:84
LTC6948_CS
#define LTC6948_CS
Define the SPI CS pin.
Definition: LTC6948.h:76
LTC6948_Fout_Freq_Verification
static void LTC6948_Fout_Freq_Verification(char part_version[])
verifies frf frequency is within datasheet specifications
Definition: DC1959A.ino:914
data
union LT_union_int32_4bytes data
Definition: DC2094A.ino:138
LTC6948_init
void LTC6948_init()
Initializes the SPI MAP arrays The values set in initialization are used all the LTC6948 SPI/WRITE an...
Definition: LTC6948.cpp:299
get_LTC6948_SPI_FIELD_RW
uint8_t get_LTC6948_SPI_FIELD_RW(uint8_t f)
returns if the given field name is (0)read/write or (1)read_only field
Definition: LTC6948.cpp:249
set_LTC6948_ALLREGS
void set_LTC6948_ALLREGS(uint8_t cs, uint8_t reg01, uint8_t reg02, uint8_t reg03, uint8_t reg04, uint8_t reg05, uint8_t reg06, uint8_t reg07, uint8_t reg08, uint8_t reg09, uint8_t reg0A, uint8_t reg0B, uint8_t reg0C, uint8_t reg0D)
Writes values to ALL LTC6948 RW address.
Definition: LTC6948.cpp:272
eeprom_write_int16
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.
Definition: QuikEval_EEPROM.cpp:377
LTC6948_PDFN
#define LTC6948_PDFN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:117
LTC6948_ND
#define LTC6948_ND
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:111
LTC6948_DITHEN
#define LTC6948_DITHEN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:102
eeprom_read_byte
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.
Definition: QuikEval_EEPROM.cpp:282
First_Run
static uint8_t First_Run
if first time through loop = 0, otherwise=1
Definition: DC1959A.ino:122
LTC6948_PDALL
#define LTC6948_PDALL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:116
QuikEval_EEPROM.h
QuikEval EEPROM Library.
LTC6948_CPWIDE
#define LTC6948_CPWIDE
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:101
LTC6948_INTN
#define LTC6948_INTN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:104
quikeval_SPI_init
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
Definition: LT_SPI.cpp:151
loop
static void loop()
Repeats Linduino loop.
Definition: DC1959A.ino:155
LTC6948_MAX_REF_FREQ
#define LTC6948_MAX_REF_FREQ
LTC6948 upper reference frequency limit.
Definition: LTC6948.h:154
EEPROM_CAL_STATUS_ADDRESS
#define EEPROM_CAL_STATUS_ADDRESS
Definition: QuikEval_EEPROM.h:58
discover_demo_board
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
Definition: QuikEval_EEPROM.cpp:141
menu_5_store_settings
static void menu_5_store_settings()
Store PLL settings to nonvolatile EEPROM on demo board.
Definition: DC1959A.ino:1002
menu_6_restore_settings
static void menu_6_restore_settings()
Read stored PLL settings from nonvolatile EEPROM on demo board.
Definition: DC1959A.ino:1028
set_LTC6948_global_fref
void set_LTC6948_global_fref(unsigned long fref_MHz, unsigned long fref_Hz)
sets globals LTC6948_Fref_MHz and LTC6948_Fref_Hz
Definition: LTC6948.cpp:507
ref_out
static uint8_t ref_out
Used to keep track of reference out status.
Definition: DC1959A.ino:120
field_menu_RW
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 ...
Definition: DC1959A.ino:307
LTC6948_set_frf
void LTC6948_set_frf(char part_version[])
FUNCTION: LTC6948_set_frf Calculates the integer (N), fractional (NUM) and output divider (OD) SPI va...
Definition: LTC6948.cpp:659
LTC6948_POR
#define LTC6948_POR
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:121
LT_SPI.h
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
LTC6948_x
#define LTC6948_x
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:130
set_LTC6948_global_frf
void set_LTC6948_global_frf(unsigned long frf_MHz, unsigned long frf_Hz)
sets globals LTC6948_Frf_MHz and LTC6948_Frf_Hz
Definition: LTC6948.cpp:513
print_title
static void print_title()
Prints the title block when program first starts.
Definition: DC1959A.ino:1065
LTC6948_CP
#define LTC6948_CP
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:92
LTC6948_THI
#define LTC6948_THI
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:127
LT_I2C.h
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
demo_name
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
quikeval_SPI_connect
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
Definition: LT_SPI.cpp:138
UserInterface.h
read_int
int32_t read_int()
Definition: UserInterface.cpp:93
print_prompt
static void print_prompt()
Prints main menu.
Definition: DC1959A.ino:1089
LTC6948_CAL
#define LTC6948_CAL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:91
LTC6948_ALCCAL
#define LTC6948_ALCCAL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:81
demo_board_connected
static int8_t demo_board_connected
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1959A.ino:121
read_float
float read_float()
Definition: UserInterface.cpp:78
LTC6948_LDOEN
#define LTC6948_LDOEN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:105
LTC6948_REV
#define LTC6948_REV
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:123
demo_board_type::product_name
char product_name[15]
LTC Product (LTC2654-L16)
Definition: QuikEval_EEPROM.h:70
LTC6948.h
LTC6948: Ultralow Noise and Spurious 0.37GHz to 6.39GHz FracN Synthesizer with Integrated VCO...
LTC6948_ALCMON
#define LTC6948_ALCMON
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:85
menu_3_RW_to_reg_field
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 ...
Definition: DC1959A.ino:367
LTC6948_BD
#define LTC6948_BD
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:89
get_LTC6948_global_fref_MHz
unsigned long get_LTC6948_global_fref_MHz()
returns global LTC6948_Fref_MHz
Definition: LTC6948.cpp:519
LTC6948_Ref_Freq_Verification
static void LTC6948_Ref_Freq_Verification()
verifies reference frequency is within datasheet specifications
Definition: DC1959A.ino:863
quikeval_I2C_init
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
Definition: LT_I2C.cpp:394
i
static int i
Definition: DC2430A.ino:184
LTC6948_RFO
#define LTC6948_RFO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:124
LTC6948_RD
#define LTC6948_RD
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:122
LTC6948_CPLE
#define LTC6948_CPLE
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:97
LTC6948_PDVCO
#define LTC6948_PDVCO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:120
get_LTC6948_SPI_FIELD_NUMBITS
uint8_t get_LTC6948_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
Definition: LTC6948.cpp:239
LTC6948_calc_odiv
unsigned long LTC6948_calc_odiv(char part_version[], unsigned long frf[2])
calculates the output divider setting based on the frf and version of LTC6948
Definition: LTC6948.cpp:545
EEPROM_CAL_KEY
#define EEPROM_CAL_KEY
Definition: QuikEval_EEPROM.h:59
LTC6948_CPDN
#define LTC6948_CPDN
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:95
LTC6948_PDPLL
#define LTC6948_PDPLL
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:119
LTC6948_LOCK
#define LTC6948_LOCK
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:109
LTC6948_BST
#define LTC6948_BST
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:90
get_LTC6948_global_frf_MHz
unsigned long get_LTC6948_global_frf_MHz()
returns global LTC6948_Frf_MHz
Definition: LTC6948.cpp:529
LTC6948_TLO
#define LTC6948_TLO
for spi_map array, defines location for field specific information used to create the spi map ...
Definition: LTC6948.h:128