We are trying to set up the LMK04821 with fixed digital delay. We have programmed the registers as described on p. 42 of the data sheet, toggled the sync polarity, but this doesn't seem to affect the output phase. We toggle the sync polarity programmatically (i.e., by setting, and unsetting 0x143:5). Does the length of the sync pulse matter?
It is also a bit unclear to us, what the meaning of registers 0x101, 0x109 etc. are. On p. 42, the data sheet claims that
"In both delay modes, the regular clock divider is substituted with an alternative divide value. The substitute divide
value consists of two values, DCLKoutX_DDLY_CNTH and DCLKoutX_DDLY_CNTL. The minimum
_CNTH/_CNTL value is 2 and the maximum _CNTH/_CNTL value is 16. This results in a minimum alternative
divide value of 4 and a maximum of 32."
but it is not explained, what the substitute divide value actually does. In the example given below
"These steps should be followed:
1. Set DCLKout0_DDLY_CNTH = 4 and DCLKout2_DDLY_CNTH = 4. First part of delay for each clock.
2. Set DCLKout0_DDLY_CNTL = 4 and DCLKout2_DDLY_CNTL = 5. Second part of delay for each clock...."
the sum of the two sub-registers is 8, and 9, respectively, and not 8.
Here are our register settings: 50 MHz input clock, 100 MHz outputs on channels 0, and 2, and 12.5 MHz system reference clock on channels 1, 3.
var registers = {
2 : 0x00, /* 0x0002 POWER_DOWN */
256 : 0x0f, /* 0x0100 CLK0 settings */
257 : 0x00,
259 : 0x00,
260 : 0x30,
261 : 0x00,
262 : 0x00,
263 : 0x11,
264 : 0x0F, /* 0x0108 */
265 : 0x00,
267 : 0x00,
268 : 0x30,
269 : 0x00,
270 : 0x00,
271 : 0x11,
272 : 0x0f,
273 : 0x00,
275 : 0x00,
276 : 0x00,
277 : 0x00,
278 : 0xFF,
279 : 0x00,
280 : 0x00,
281 : 0x55,
283 : 0x00,
284 : 0x00,
285 : 0x00,
286 : 0xFF,
287 : 0x00,
288 : 0x00,
289 : 0x55,
291 : 0x00,
292 : 0x00,
293 : 0x00,
294 : 0xFF,
295 : 0x00,
296 : 0x00,
297 : 0x55,
299 : 0x00,
300 : 0x00,
301 : 0x00,
302 : 0xFF,
303 : 0x00,
304 : 0x00,
305 : 0x55,
307 : 0x00,
308 : 0x00,
309 : 0x00,
310 : 0xFF,
311 : 0x00,
312 : 0x20,
313 : 0x03,
314 : 0x00,
315 : 0x78,
316 : 0x00,
317 : 0x00,
318 : 0x03,
319 : 0x0D,
320 : 0x00,
321 : 0x00,
322 : 0x00,
323 : 0x0b,
324 : 0x83,
325 : 0x7f,
326 : 0x10,
327 : 0x98,
328 : 0x0a,
329 : 0x02,
330 : 0x0a, /* 0x014a, reset_type/reset_mux */
331 : 0x16,
332 : 0x00,
333 : 0x00,
334 : 0x00,
335 : 0x7f,
336 : 0x03,
337 : 0x02,
338 : 0x00,
339 : 0x00,
340 : 0x00, /* 0x0154, CLKin0_R[7:0], 5*/
341 : 0x00,
342 : 0x04,
343 : 0x00,
344 : 0x00,
345 : 0x00,
346 : 0x01, /* 0x015A, PLL1_N[7:4], 4 */
347 : 0x98,
348 : 0x20,
349 : 0x00,
350 : 0x00,
351 : 0x0b, /* 0x015f PLL1_LD_TYPE, PLL1_LD_MUX; with 0x04 or 0x03, one can toggle the LED */
352 : 0x00,
353 : 0x01, /* 0x02 */
354 : 0xa4, /* 0xa5 */
355 : 0x00,
356 : 0x00,
357 : 0x02, /* from here, the order of registers is no longer monotonic */
369 : 0xaa,
370 : 0x02,
372 : 0x00,
380 : 0x15,
381 : 0x33,
358 : 0x00,
359 : 0x00,
360 : 0x03,
361 : 0x41,
362 : 0x00,
363 : 0x40,
364 : 0x00,
365 : 0x00,
366 : 0x13, /* 0x016e PLL2_LD_TYPE, PLL2_LD_MUX; 0x06 is open-drain output, 0x04/0x03 toggles the LED */
371 : 0x00,
8189 : 0x00,
8190 : 0x00,
8191 : 0x53,
}
and here is the function that should set the delays on channels 0, and 2. We are certain that the communication between the host and the clock generator is error free, and that the register settings reach the LMK04821.
async function write_phase() {
// write phase of channel 0, 0x101
write_phase_register(257)
await sleep(300)
// write phase of channel 2, 0x109
write_phase_register(265)
await sleep(300)
// clear 0x106
registers['262'] = 0
write_phase_register(262)
await sleep(300)
// clear 0x10e
registers['270'] = 0
write_phase_register(270)
await sleep(300)
// clear 0x144:0, 0x144:1
registers['324'] = 128
write_phase_register(324)
await sleep(300)
// toggle 0x143:5
registers['323'] = 27
write_phase_register(323)
await sleep(2000)
registers['323'] = 11
write_phase_register(323)
await sleep(3000)
// set 0x106:7
registers['262'] = 128
write_phase_register(262)
await sleep(300)
// set 0x10e:7
registers['270'] = 128
write_phase_register(270)
await sleep(300)
// set 0x144:0, 0x144:1
registers['324'] = 131
write_phase_register(324)
await sleep(300)
console.log('wrote phase sequence')
}