Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC6951.h
Go to the documentation of this file.
1 /*!
2  LTC6951: Ultra-Low Jitter 2MHz to 2.7GHz Multi-Output Clock Synthesizer with Integrated VCO
3 
4 @verbatim
5  SPI DATA FORMAT (MSB First):
6 
7  Write Sequence:
8  Byte #1 Byte #2
9  MOSI: A6 A5 A4 A3 A2 A1 A0 W D7 D6 D5 D4 D3 D2 D1 D0
10  MISO: X X X X X X X X X X X X X X X X
11 
12  Read Sequence:
13  Byte #1 Byte #2
14  MOSI: A6 A5 A4 A3 A2 A1 A0 R X X X X X X X X
15  MISO: X X X X X X X X D7 D6 D5 D4 D3 D2 D1 D0
16 
17  W : SPI Write (0)
18  R : SPI Read (1)
19  Ax : Address
20  Dx : Data Bits
21  X : Don't care
22 
23 @endverbatim
24 
25 http://www.linear.com/product/LTC6951
26 
27 http://www.linear.com/product/LTC6951#demoboards
28 
29 
30 Copyright 2018(c) Analog Devices, Inc.
31 
32 All rights reserved.
33 
34 Redistribution and use in source and binary forms, with or without
35 modification, are permitted provided that the following conditions are met:
36  - Redistributions of source code must retain the above copyright
37  notice, this list of conditions and the following disclaimer.
38  - Redistributions in binary form must reproduce the above copyright
39  notice, this list of conditions and the following disclaimer in
40  the documentation and/or other materials provided with the
41  distribution.
42  - Neither the name of Analog Devices, Inc. nor the names of its
43  contributors may be used to endorse or promote products derived
44  from this software without specific prior written permission.
45  - The use of this software may or may not infringe the patent rights
46  of one or more patent holders. This license does not release you
47  from the requirement that you obtain separate licenses from these
48  patent holders to use this software.
49  - Use of the software either in source or binary form, must be run
50  on or directly connected to an Analog Devices Inc. component.
51 
52 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
53 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
54 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
56 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
58 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63 
64 /*! @file
65  @ingroup LTC6951
66  Header for LTC6951: Ultra-Low Jitter 2MHz to 2.5GHz Multi-Output Clock Synthesizer with Integrated VCO
67 */
68 
69 #ifndef LTC6951_H
70 
71 #define LTC6951_H
72 
73 
74 //! Define the SPI CS pin
75 #ifndef LTC6951_CS
76 #define LTC6951_CS QUIKEVAL_CS //! SPI Chip Select Pin
77 #endif
78 
79 
80 /*! @name LTC6951 Registers Fields in Alphabetical Order */
81 #define LTC6951_ALCCAL 1 //!< for spi_map array, defines location for field specific information used to create the spi map
82 #define LTC6951_ALCEN 2 //!< for spi_map array, defines location for field specific information used to create the spi map
83 #define LTC6951_ALCHI 3 //!< for spi_map array, defines location for field specific information used to create the spi map
84 #define LTC6951_ALCLO 4 //!< for spi_map array, defines location for field specific information used to create the spi map
85 #define LTC6951_ALCMON 5 //!< for spi_map array, defines location for field specific information used to create the spi map
86 #define LTC6951_ALCULOK 6 //!< for spi_map array, defines location for field specific information used to create the spi map
87 #define LTC6951_AUTOCAL 7 //!< for spi_map array, defines location for field specific information used to create the spi map
88 #define LTC6951_BD 8 //!< for spi_map array, defines location for field specific information used to create the spi map
89 #define LTC6951_BST 9 //!< for spi_map array, defines location for field specific information used to create the spi map
90 #define LTC6951_CAL 10 //!< for spi_map array, defines location for field specific information used to create the spi map
91 #define LTC6951_CP 11 //!< for spi_map array, defines location for field specific information used to create the spi map
92 #define LTC6951_CPDN 12 //!< for spi_map array, defines location for field specific information used to create the spi map
93 #define LTC6951_CPMID 13 //!< for spi_map array, defines location for field specific information used to create the spi map
94 #define LTC6951_CPRST 14 //!< for spi_map array, defines location for field specific information used to create the spi map
95 #define LTC6951_CPUP 15 //!< for spi_map array, defines location for field specific information used to create the spi map
96 #define LTC6951_CPWIDE 16 //!< for spi_map array, defines location for field specific information used to create the spi map
97 #define LTC6951_DLY0 17 //!< for spi_map array, defines location for field specific information used to create the spi map
98 #define LTC6951_DLY1 18 //!< for spi_map array, defines location for field specific information used to create the spi map
99 #define LTC6951_DLY2 19 //!< for spi_map array, defines location for field specific information used to create the spi map
100 #define LTC6951_DLY3 20 //!< for spi_map array, defines location for field specific information used to create the spi map
101 #define LTC6951_DLY4 21 //!< for spi_map array, defines location for field specific information used to create the spi map
102 #define LTC6951_FILT 22 //!< for spi_map array, defines location for field specific information used to create the spi map
103 #define LTC6951_INVSTAT 23 //!< for spi_map array, defines location for field specific information used to create the spi map
104 #define LTC6951_LKCT 24 //!< for spi_map array, defines location for field specific information used to create the spi map
105 #define LTC6951_LKWIN 25 //!< for spi_map array, defines location for field specific information used to create the spi map
106 #define LTC6951_LOCK 26 //!< for spi_map array, defines location for field specific information used to create the spi map
107 #define LTC6951_NLOCK 27 //!< for spi_map array, defines location for field specific information used to create the spi map
108 #define LTC6951_MCO 28 //!< for spi_map array, defines location for field specific information used to create the spi map
109 #define LTC6951_MC1 29 //!< for spi_map array, defines location for field specific information used to create the spi map
110 #define LTC6951_MC2 30 //!< for spi_map array, defines location for field specific information used to create the spi map
111 #define LTC6951_MC3 31 //!< for spi_map array, defines location for field specific information used to create the spi map
112 #define LTC6951_MC4 32 //!< for spi_map array, defines location for field specific information used to create the spi map
113 #define LTC6951_MD0 33 //!< for spi_map array, defines location for field specific information used to create the spi map
114 #define LTC6951_MD1 34 //!< for spi_map array, defines location for field specific information used to create the spi map
115 #define LTC6951_MD2 35 //!< for spi_map array, defines location for field specific information used to create the spi map
116 #define LTC6951_MD3 36 //!< for spi_map array, defines location for field specific information used to create the spi map
117 #define LTC6951_MD4 37 //!< for spi_map array, defines location for field specific information used to create the spi map
118 #define LTC6951_MUTE0 38 //!< for spi_map array, defines location for field specific information used to create the spi map
119 #define LTC6951_MUTE1 39 //!< for spi_map array, defines location for field specific information used to create the spi map
120 #define LTC6951_MUTE2 40 //!< for spi_map array, defines location for field specific information used to create the spi map
121 #define LTC6951_MUTE3 41 //!< for spi_map array, defines location for field specific information used to create the spi map
122 #define LTC6951_MUTE4 42 //!< for spi_map array, defines location for field specific information used to create the spi map
123 #define LTC6951_ND 43 //!< for spi_map array, defines location for field specific information used to create the spi map
124 #define LTC6951_OINV0 44 //!< for spi_map array, defines location for field specific information used to create the spi map
125 #define LTC6951_OINV1 45 //!< for spi_map array, defines location for field specific information used to create the spi map
126 #define LTC6951_OINV2 46 //!< for spi_map array, defines location for field specific information used to create the spi map
127 #define LTC6951_OINV3 47 //!< for spi_map array, defines location for field specific information used to create the spi map
128 #define LTC6951_OINV4 48 //!< for spi_map array, defines location for field specific information used to create the spi map
129 #define LTC6951_PART 49 //!< for spi_map array, defines location for field specific information used to create the spi map
130 #define LTC6951_PD 50 //!< for spi_map array, defines location for field specific information used to create the spi map
131 #define LTC6951_PDALL 51 //!< for spi_map array, defines location for field specific information used to create the spi map
132 #define LTC6951_PDOUT 52 //!< for spi_map array, defines location for field specific information used to create the spi map
133 #define LTC6951_PDPLL 53 //!< for spi_map array, defines location for field specific information used to create the spi map
134 #define LTC6951_PDREFPK 54 //!< for spi_map array, defines location for field specific information used to create the spi map
135 #define LTC6951_PDVCO 55 //!< for spi_map array, defines location for field specific information used to create the spi map
136 #define LTC6951_POR 56 //!< for spi_map array, defines location for field specific information used to create the spi map
137 #define LTC6951_RAO 57 //!< for spi_map array, defines location for field specific information used to create the spi map
138 #define LTC6951_RD 58 //!< for spi_map array, defines location for field specific information used to create the spi map
139 #define LTC6951_REFOK 59 //!< for spi_map array, defines location for field specific information used to create the spi map
140 #define LTC6951_NREFOK 60 //!< for spi_map array, defines location for field specific information used to create the spi map
141 #define LTC6951_REV 61 //!< for spi_map array, defines location for field specific information used to create the spi map
142 #define LTC6951_SN 62 //!< for spi_map array, defines location for field specific information used to create the spi map
143 #define LTC6951_SR 63 //!< for spi_map array, defines location for field specific information used to create the spi map
144 #define LTC6951_SSYNC 64 //!< for spi_map array, defines location for field specific information used to create the spi map
145 #define LTC6951_SYNCEN0 65 //!< for spi_map array, defines location for field specific information used to create the spi map
146 #define LTC6951_SYNCEN1 66 //!< for spi_map array, defines location for field specific information used to create the spi map
147 #define LTC6951_SYNCEN2 67 //!< for spi_map array, defines location for field specific information used to create the spi map
148 #define LTC6951_SYNCEN3 68 //!< for spi_map array, defines location for field specific information used to create the spi map
149 #define LTC6951_SYNCEN4 69 //!< for spi_map array, defines location for field specific information used to create the spi map
150 #define LTC6951_UNLOCK 70 //!< for spi_map array, defines location for field specific information used to create the spi map
151 #define LTC6951_x 71 //!< for spi_map array, defines location for field specific information used to create the spi map
152 
153 
154 
155 #define LTC6951_NUM_REGADDR 20 //!< Defines number of LTC6951 SPI registers, used in spi_map array
156 #define LTC6951_NUM_REGFIELD 71 //!< Defines number of LTC6951 SPI fields, used in spi_map array
157 
158 #define ADDRx 0 //!< used for 2nd dim of 2d spi_map array
159 #define DxMSB 1 //!< used for 2nd dim of 2d spi_map array
160 #define NUMBITS 2 //!< used for 2nd dim of 2d spi_map array
161 #define R_ONLY 3 //!< used for 2nd dim of 2d spi_map array
162 
163 //! @} */
164 
165 /* ------------------------------------------------------------------------- */
166 //! LTC6951 Read Single Address
167 //! reads 8 bit Data field to LTC6951.
168 //! has to shift data by one bit to account for RW bit
169 //! @return data that was read from address
170 uint8_t LTC6951_read(uint8_t cs, //!< Chip Select Pin
171  int8_t address //!< Register address for the LTC6951.
172  );
173 
174 
175 /* ------------------------------------------------------------------------- */
176 //! LTC6951 Read Single Field
177 //! For SPI FIELDS located in 1 or multiple address location
178 //! reads specific address locations
179 //! identifies and returns specific field in question
180 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
181 //! @return data that was read from field
182 long LTC6951_read_field(uint8_t cs, //!< Chip Select Pin
183  uint8_t address, //!< Register address for the LTC6951.
184  uint8_t MSB_loc, //!< MSB bit location of field
185  uint8_t numbits //!< length of field (i.e. number of bits in field)
186  );
187 
188 
189 /* ------------------------------------------------------------------------- */
190 //! Gets the LTC6951 SPI field value
191 //! calls function LTC6951_read_field, which
192 //! reads specific address locations
193 //! identifies and returns specific field in question
194 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
195 //! @return data that was read from field
196 long get_LTC6951_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
197  uint8_t f //!< SPI field number
198  );
199 
200 
201 /* ------------------------------------------------------------------------- */
202 //! LTC6951 Write Single Address
203 //! writes 8 bit Data field to LTC6951.
204 //! has to shift data by one bit to account for RW bit
205 //! @return void
206 void LTC6951_write(uint8_t cs, //!< Chip Select Pin
207  uint8_t address, //!< Register address for the LTC6951.
208  uint8_t Data //!< 8-bit data to be written to register
209  );
210 /* ------------------------------------------------------------------------- */
211 //! LTC6951 Write Single Field
212 //! For SPI FIELDS in 1 or multiple address locations
213 //! reads specific address/field location then writes to specific field
214 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
215 //! @return void
216 uint8_t LTC6951_write_field(uint8_t cs, //!< Chip Select Pin
217  long field_data, //!< Value field value to be set to
218  uint8_t address, //!< Register address for the LTC6951.
219  uint8_t MSB_loc, //!< MSB bit location of field
220  uint8_t numbits //!< length of field (i.e. number of bits in field)
221  );
222 
223 
224 /* ------------------------------------------------------------------------- */
225 //! Sets the LTC6951 SPI field value
226 //! calls function LTC6951_read_field, which
227 //! reads specific address/field location then writes to specific field
228 //! can handle SPI fields in multiple addresses, if MSB bit is in the lower number address
229 //! @return void
230 void set_LTC6951_SPI_FIELD(uint8_t cs, //!< Chip Select Pin
231  uint8_t f, //!< SPI field number
232  long field_data //!< Value field value to be set to
233  );
234 
235 
236 /* ------------------------------------------------------------------------- */
237 //! Writes values to ALL LTC6951 RW addresses
238 //! @return void
239 void set_LTC6951_ALLREGS(uint8_t cs, //!< Chip Select Pin
240  uint8_t reg01, //!< LTC6951 register 1
241  uint8_t reg02, //!< LTC6951 register 2
242  uint8_t reg03, //!< LTC6951 register 3
243  uint8_t reg04, //!< LTC6951 register 4
244  uint8_t reg05, //!< LTC6951 register 5
245  uint8_t reg06, //!< LTC6951 register 6
246  uint8_t reg07, //!< LTC6951 register 7
247  uint8_t reg08, //!< LTC6951 register 8
248  uint8_t reg09, //!< LTC6951 register 9
249  uint8_t reg0A, //!< LTC6951 register 10
250  uint8_t reg0B, //!< LTC6951 register 11
251  uint8_t reg0C, //!< LTC6951 register 12
252  uint8_t reg0D, //!< LTC6951 register 13
253  uint8_t reg0E, //!< LTC6951 register 14
254  uint8_t reg0F, //!< LTC6951 register 15
255  uint8_t reg10, //!< LTC6951 register 16
256  uint8_t reg11, //!< LTC6951 register 17
257  uint8_t reg12 //!< LTC6951 register 18
258  );
259 
260 /* ------------------------------------------------------------------------- */
261 //! Writes values to ALL LTC6951 RW addresses from a look-up table
262 //! - uses the Multi-byte write option for more efficient data transfer
263 //! - Calibrates VCO based on RAO and Autocal bit vales
264 //! - Either SPI Syncs or recommends the use to SYNC pin based on RAO, SN and SR values
265 //! @return void
266 void set_LTC6951_REGS_lkup_tbl(uint8_t lkup_tbl_row //!< Any number 0-9, lookup table has 10 options
267  );
268 
269 /* ------------------------------------------------------------------------- */
270 //! This function toggles between two frequencies
271 //! - if measuring calibration or settling times set SPI clock to max SPI rate (8MHz)
272 //! - writes LTC6951 registers from a local look up table
273 //! - uses the Multi-byte write option for more efficient data transfer
274 //! - Calibrates VCO based on RAO and Autocal bit vales
275 //! - DOES NOT SYNC OUTPUTS
276 //! - RECOMMENDATION: If measuring settling times with E5052, NOT MUTING OUTPUT DURING CAL can provide more meaningful results
277 //! @return void
278 void set_LTC6951_REGS_freq_jump(uint8_t lkup_tbl_row, //!< Can be 0 or 1
279  uint8_t init_setup //!< 0 = not first setup, 1= first setup
280  );
281 
282 
283 /* ------------------------------------------------------------------------- */
284 //! Initializes the SPI MAP arrays
285 //! The values set in initialization are used for all the LTC6951 SPI/WRITE and
286 //! read functions (set_LTC6951_SPI_FIELD, get_LTC6951_SPI_FIELD,
287 //! LTC6951_read, LTC6951_write, etc, etc)
288 //! @return void
289 void LTC6951_init();
290 
291 /* ------------------------------------------------------------------------- */
292 //! returns # of addresses in parts register map (array size)
293 
294 //! @return # of addresses in parts register map
295 
296 
297 uint8_t get_LTC6951_REGSIZE();
298 
299 
300 
301 
302 
303 
304 
305 
306 /* ------------------------------------------------------------------------- */
307 
308 
309 //! returns the number of bits for a given field name in the SPI map
310 
311 
312 //! @return the number of bits for a given field name in the SPI map
313 
314 
315 uint8_t get_LTC6951_SPI_FIELD_NUMBITS(uint8_t f //!< SPI field number
316 
317 
318  );
319 
320 
321 
322 
323 
324 
325 
326 
327 /* ------------------------------------------------------------------------- */
328 
329 
330 //! returns if the given field name is (0)read/write or (1)read_only field
331 
332 
333 //! @return if the given field is a (0)read/write or (1)read_only field
334 
335 
336 uint8_t get_LTC6951_SPI_FIELD_RW(uint8_t f //!< SPI field number
337 
338 
339  ) ;
340 
341 
342 
343 
344 
345 /* ------------------------------------------------------------------------- */
346 
347 
348 //! Read the ID string from the EEPROM and determine if any demo board is connected.
349 
350 
351 //! Returns 1 if successful, 0 if not successful
352 
353 
355 
356 
357  );
358 
359 
360 
361 
362 
363 #endif // LTC6951_H
364 
365 
366 
void set_LTC6951_REGS_lkup_tbl(uint8_t lkup_tbl_row)
Writes values to ALL LTC6951 RW addresses from a look-up table.
Definition: LTC6951.cpp:322
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...
Definition: LTC6951.cpp:164
static uint8_t address
Definition: DC2091A.ino:83
int8_t discover_demo_board_local(char *demo_name)
Read the ID string from the EEPROM and determine if any demo board is connected.
Definition: LTC6951.cpp:831
void LTC6951_write(uint8_t cs, uint8_t address, uint8_t Data)
LTC6951 Write Single Address writes 8 bit Data field to LTC6951.
Definition: LTC6951.cpp:175
uint8_t LTC6951_write_field(uint8_t cs, long field_data, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6951 Write Single Field For SPI FIELDS in 1 or multiple address locations reads specific address/f...
Definition: LTC6951.cpp:191
void set_LTC6951_REGS_freq_jump(uint8_t lkup_tbl_row, uint8_t init_setup)
This function toggles between two frequencies.
Definition: LTC6951.cpp:430
void LTC6951_init()
Initializes the SPI MAP arrays The values set in initialization are used for all the LTC6951 SPI/WRIT...
Definition: LTC6951.cpp:535
uint8_t get_LTC6951_REGSIZE()
returns # of addresses in parts register map (array size)
Definition: LTC6951.cpp:242
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
long LTC6951_read_field(uint8_t cs, uint8_t address, uint8_t MSB_loc, uint8_t numbits)
LTC6951 Read Single Field For SPI FIELDS located in 1 or multiple address location reads specific add...
Definition: LTC6951.cpp:128
uint8_t LTC6951_read(uint8_t cs, int8_t address)
LTC6951 Read Single Address reads 8 bit Data field to LTC6951.
Definition: LTC6951.cpp:108
void set_LTC6951_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, uint8_t reg0E, uint8_t reg0F, uint8_t reg10, uint8_t reg11, uint8_t reg12)
Writes values to ALL LTC6951 RW addresses.
Definition: LTC6951.cpp:285
uint8_t get_LTC6951_SPI_FIELD_NUMBITS(uint8_t f)
returns the number of bits for a given field name in the SPI map
Definition: LTC6951.cpp:252
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
Definition: LTC6951.cpp:262
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...
Definition: LTC6951.cpp:275