Are there any good guides, tutorial, or samples for programming the on-board PLL? I’m trying to modify it using the Java API, but anytime I try to set the PLL configuration, I get the error code “UnsupportedFeature”. I haven’t found any samples where the PLL is configured (DES does but it just calls LoadDefaultPLLConfiguration, which works). I’m using a XEM6010.
Here is the code I’ve written so far. The setPLL method emulates the Python example given in the FrontPanel API. The VHDL downloads to and runs on the board fine, but I can’t change the PLL.
[I]import com.opalkelly.frontpanel.*;
public class OpalAPITest {
okCFrontPanel dev;
okTDeviceInfo devInfo;
static
{
try {
System.loadLibrary(“okjFrontPanel”);
} catch(Exception ex) {
log("Couldn’t load okjFrontPanel dll: " + ex);
System.exit(0);
}
}
public static void main(String] args) {
String path = "counters.bit";
OpalAPITest device = new OpalAPITest();
if (true == device.configureDevice(path)) {
// device.checkPLL();
device.setPLL();
device.checkPLL();
while(true) {
device.dev.UpdateWireOuts();
log(String.valueOf(device.dev.GetWireOutValue(0x20)));
sleep(1000);
}
}
}
public static void sleep(int time) {
try {
Thread.sleep(time);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
public static void log(String str) {
System.out.println(str);
}
public boolean configureDevice(String bitFilePath) {
dev = new okCFrontPanel();
if (okCFrontPanel.ErrorCode.NoError != dev.OpenBySerial("")) {
log("Couldn't connect to device. Please verify connection");
return(false);
}
dev.ResetFPGA();
devInfo= new okTDeviceInfo();
if (okCFrontPanel.ErrorCode.NoError != dev.GetDeviceInfo(devInfo)) {
log("Unable to retrieve device info");
return(false);
}
log("Product:" + devInfo.getProductName());
log("Device firmware version: " + devInfo.getDeviceMajorVersion() + "." +
devInfo.getDeviceMinorVersion());
log("Device serial number: " + devInfo.getSerialNumber());
log("Device ID: " + devInfo.getDeviceID());
okCFrontPanel.ErrorCode error = dev.LoadDefaultPLLConfiguration();
log("Loading default PLL configuration..." + error.toString());
if (okCFrontPanel.ErrorCode.NoError != dev.ConfigureFPGA(bitFilePath)) {
log("FPGA confguration for file " + bitFilePath + " failed");
return(false);
}
if (false == dev.IsFrontPanelEnabled()) {
log("FrontPanel support is unavailable.");
return(false);
}
log("Device initialized successfully");
return(true);
}
public void checkPLL() {
okCPLL22150 pll = new okCPLL22150();
log(“Details for pll:”);
log("Reference: " + pll.GetReference() + "\tVCO Freq: " + pll.GetVCOFrequency());
log("Div1: " + pll.GetDiv1Divider() + "\tSource: " + pll.GetDiv1Source());
log("Div2: " + pll.GetDiv2Divider() + "\tSource: " + pll.GetDiv2Source());
log("Output Freq: " + pll.GetOutputFrequency(0) + "\tOutput Source: " + pll.GetOutputSource(0));
log("VCO P: " + pll.GetVCOP() + "\tVCO Q: "+ pll.GetVCOQ());
}
public void setPLL() {
okCPLL22150 pll = new okCPLL22150();
dev.GetPLL22150Configuration(pll);
pll.SetReference(48.0f, false);
pll.SetVCOParameters(400, 48);
pll.SetDiv1(okCPLL22150.DividerSource.DivSrc_VCO, 4);
pll.SetOutputSource(0, okCPLL22150.ClockSource.ClkSrc_Div1ByN);
pll.SetOutputEnable(0, true);
pll.SetDiv2(okCPLL22150.DividerSource.DivSrc_VCO, 8);
pll.SetOutputSource(1, okCPLL22150.ClockSource.ClkSrc_Div2ByN);
pll.SetOutputEnable(1, true);
okCFrontPanel.ErrorCode error = dev.SetPLL22150Configuration(pll);
log("Loading new PLL configuration: " + error.toString());
}
}[/I]
And when it runs I get:
Product:XEM6010-LX45
Device firmware version: 3.1
Device serial number: 12020002KG
Device ID: Opal Kelly XEM6010
Loading default PLL configuration…NoError
Device initialized successfully
Loading new PLL configuration: UnsupportedFeature
Details for pll:
Reference: 10.0 VCO Freq: 40.0
Div1: 4 Source: DivSrc_VCO
Div2: 4 Source: DivSrc_VCO
Output Freq: 10.0 Output Source: ClkSrc_Ref
VCO P: 8 VCO Q: 2
1
2
… etc.
Any help would be greatly appreciated. Thanks