FrontPanel API 5.3.5
Loading...
Searching...
No Matches
okCPLL22393 Class Reference

Container class which holds the appropriate configuration parameters for a Cypress 22393 PLL. More...

Public Member Functions

 okCPLL22393 ()
 Default constructor.
 
double GetCrystalLoad () const
 Gets the crystal load capacitance.
 
int GetOutputDivider (int n) const
 Get the divider value for output number N.
 
double GetOutputFrequency (int n) const
 Gets the current output frequency for a particular output.
 
ClockSource GetOutputSource (int n) const
 Gets the current output clock source for a particular output.
 
double GetPLLFrequency (int n) const
 Get the PLL output frequency.
 
int GetPLLP (int n) const
 Get the PLL P(total) value.
 
int GetPLLQ (int n) const
 Get the PLL Q(total) value.
 
void GetProgrammingInfo (okTPLL22393ProgramInfo buf) const
 Loads 'buf' with alternating address/data for programming the PLL.
 
double GetReference () const
 Get the current reference crystal frequency.
 
void InitFromProgrammingInfo (const okTPLL22393ProgramInfo buf)
 Generates the PLL data from I2C programming data.
 
bool IsPLLEnabled (int n) const
 Returns true is the specified PLL is enabled.
 
bool IsOutputEnabled (int n) const
 Returns true is the specified output is enabled.
 
bool SetCrystalLoad (double capload)
 Set the crystal load capacitance.
 
void SetOutputEnable (int n, bool enable)
 Set the output enable for a particular output.
 
bool SetOutputDivider (int n, int div)
 Set the divider value for output number N.
 
bool SetOutputSource (int n, ClockSource clksrc)
 Set the source for a particular output.
 
bool SetPLLParameters (int n, int p, int q, bool enable=true)
 Set the PLL P(total) and Q(total) values for PLL number N.
 
bool SetPLLLF (int n, int lf)
 Manually set the PLL loop filter value for optimal performance.
 
void SetReference (double freq)
 Sets the reference crystal frequency for output frequency computations.
 

Detailed Description

This is a container class which holds the appropriate configuration parameters for a Cypress 22393 PLL. The PLL has a single VCO but mutliple outputs with frequencies derived from dividers and switching blocks.

Python Note: Under Python, this class is simply called PLL22393. Therefore, if you import the ok library, you would refer to this class as ok.PLL22393.

Note that this object does not communicate with the XEM. That is, it does not reflect the state of the actual PLL. It is simply a container class used to configure and query the on-board PLL.

Typically, PLL settings will be set with the FrontPanel application and stored in EEPROM. In some cases, however, you may want your code to configure the PLL. Refer to the Cypress documentation to see how the various settings affect the output. The following example configures PLL #0 to operate at 400 MHz and sets up two outputs at 100 MHz and 50 MHz. (PLL 0 throughout the API corresponds to Cypress PLL #1 and so on.)

pll->SetReference(48.0f);
pll->SetPLLParameters(0, 400, 48);
pll->SetOutputSource(0, okCPLL22393::ClkSrc_PLL0_0);
pll->SetOutputDivider(0, 4);
pll->SetOutputEnable(0, true);
pll->SetOutputSource(1, okCPLL22393::ClkSrc_PLL0_0);
pll->SetOutputDivider(1, 8);
pll->SetOutputEnable(1, true);
Container class which holds the appropriate configuration parameters for a Cypress 22393 PLL.
Definition okCPLL22393.h:59
bool SetPLLParameters(int n, int p, int q, bool enable=true)
Set the PLL P(total) and Q(total) values for PLL number N.
bool SetOutputSource(int n, ClockSource clksrc)
Set the source for a particular output.
void SetOutputEnable(int n, bool enable)
Set the output enable for a particular output.
bool SetOutputDivider(int n, int div)
Set the divider value for output number N.
void SetReference(double freq)
Sets the reference crystal frequency for output frequency computations.

At this point, the pll instance may be passed to SetPLLConfiguration to configure the on-board PLL. You can also use okCPLL22393::GetOutputFrequency to verify that the output frequency is set properly.

Member Function Documentation

◆ SetPLLLF()

bool okCPLL22393::SetPLLLF ( int n,
int lf )

Sets the loop filter bits for a particular PLL.

The loop filter bits can be tuned to maintain stability for a given value of Ptotal. These bits are automatically set according to the datasheet when SetPLLParameters() is called. However, a particular application may override this setting by calling this function after calling SetPLLParameters().


Copyright (c) 2005-2024 Opal Kelly Incorporated