[QUOTE=evanichka]
So does okPLL22393_SetPLLParameters(pll, 0, 400, 48, TRUE); set the params of PLL0? Meaning if I put (pll,1,400,48,TRUE), it would set the p and q for pll1?
And for okPLL22393_SetOutputDivider(pll, 0, 4), okPLL22393_SetOutputSource(pll, 0, ClkSrc22393_PLL0_0), and okPLL22393_SetOutputEnable(pll, 0, TRUE), does the 0 mean CLKA? So 1 would refer to CLKB, 2 to CLKC and so on?[/QUOTE]
Yes to both. The Opal Kelly numbering is PLL0, PLL1, PLL2 whereas the 22393 datasheet refers to PLL1, PLL2, PLL3. And [CLKA-CLKE] => [0-4]. When setting PLL parameters you use 0, 1, 2 to refer to the three PLLs, but when referring to PLLs as sources for clock outputs you use [0, 2-7] which matches the datasheet. For example, PLL_0_0 is 2 and PLL_0_180 is 3. (It’s not clear to me whether the 22393 actually has 180 degree outputs, the datasheet only shows that for the 22394.)
To change the subject only slightly: there are some inconsistencies at
http://www.opalkelly.com/library/FrontPanelAPI/classokCPLL22393.html
. For example, SetPLLParameters has an “enable” argument in the list of functions, but not in the example code in the green box. SetReference also has different numbers of arguments between the two. In general the PLL functions and parameters are not well documented. Fortunately most of it is decipherable from the data sheet and example code.
But getting to the real point of my post: one thing that should be pointed out which drove me crazy is that the SetOutputEnable call apparently does its thing by setting the output divisor to zero, not by setting an enable bit in the PLL (from reading the datasheet I guess there are no such bits). Thus, the following sequence, which seems like the natural way to turn a clock on and off, definitely does not do the right thing:
// Turn off CLKD output
okUsbXEM3010_GetPLLConfiguration (dev, pll);
okPLL22393_SetOutputEnable (pll, 3, 0);
okUsbXEM3010_SetPLLConfiguration (dev, pll);
… go do some other stuff
// Turn CLKD back on – NOT!
okUsbXEM3010_GetPLLConfiguration (dev, pll);
okPLL22393_SetOutputEnable (pll, 3, 1);
okUsbXEM3010_SetPLLConfiguration (dev, pll);
The divisor remains set at zero even after the last enable call, and an oscilloscope verified that the clock output is still off even though this should have turned it on. My workaround is to memorize the divisor value prior to turning off a clock output, and then restoring it as part of the enable call. In other words a SetOutputDivider call must precede any output enable if it has been previously disabled.
O-K, please clarify if this is wrong.