Test the FrontPanel Interface

After configuring the FPGA with your desired bitfile, it’s a good idea to test that FrontPanel is enabled in your FPGA configuration using okCFrontPanel::IsFrontPanelEnabled(). Testing FrontPanel after configuration is a good way to check for a variety of issues. For example,

  • It assures that the bitfile was found and transferred to the device.
  • It assures that the bitfile has proper host interface pin mappings.

C/C++

okCFrontPanel dev;
okCFrontPanel::ErrorCode error;
dev.OpenBySerial();
error = dev.ConfigureFPGA("example.bit");
// It's a good idea to check for errors here!!
 
// IsFrontPanelEnabled returns true if FrontPanel is detected.
if (true == dev.IsFrontPanelEnabled()) {
     std::cout << "FrontPanel host interface enabled.\n";
} else{
     std::cerr << "FrontPanel host interface not detected.\n";
}Code language: PHP (php)

C#

okCFrontPanel dev = new okCFrontPanel();
okCFrontPanel::ErrorCode error = new okCFrontPanel::ErrorCode();
string bitfile = "example.bit";
dev.OpenBySerial("");
error = dev.ConfigureFPGA(bitfile);
// It's a good idea to check for errors here!!
 
// IsFrontPanelEnabled returns true if FrontPanel is detected.
if (true == dev.IsFrontPanelEnabled()){
     Console.Error.WriteLine("FrontPanel host interface enabled.");
} else{
     Console.WriteLine("FrontPanel host interface not detected.");
}Code language: PHP (php)

Python

dev = ok.okCFrontPanel()
dev.OpenBySerial("")
error = dev.ConfigureFPGA("example.bit")
# It's a good idea to check for errors here!!
 
# IsFrontPanelEnabled returns true if FrontPanel is detected.
if true == dev.IsFrontPanelEnabled():
     print "FrontPanel host interface enabled."
else:
     sys.stderr.write("FrontPanel host interface not detected.")Code language: PHP (php)

Java

public class example{
     okCFrontPanel dev;
     okCFrontPanel.ErrorCode error;
	
     public void CheckFP(){
          dev = new oKCFrontPanel();
          dev.OpenBySerial("");
          error = dev.ConfigureFPGA("example.bit");
          // It’s a good idea to check for errors here!
 
          // Is FrontPanelEnabled returns true if FrontPanel is detected.
          if(true == dev.IsFrontPanelEnabled()){
               System.out.println("FrontPanel interface is enabled.");
          }
               System.out.println("FrontPanel interface is not enabled!");
     }
}Code language: PHP (php)

JavaScript

const deviceManager = window.FrontPanelAPI.deviceManager;
const dev = await deviceManager.openDevice("");

try {
        const fpgaConfig = dev.getFPGAConfiguration();
	await fpgaConfig.loadConfigurationFromFile("example.bit");
}
catch(error) {
	console.error(`FPGA Configuration Failed: ${error}`);
}

try {
        const fpgaDataPort = await dev.getFPGADataPort();

        // IsFrontPanelEnabled returns true if FrontPanel is detected.
        const isFrontPanelEnabled = await fpgaDataPort.IsFrontPanelEnabled();

        if(true === isFrontPanelEnabled) {
	        console.log("FrontPanel interface is enabled.");
        }
        else {
	        console.error("FrontPanel interface is not enabled!");
        }
}
catch(error) {
	console.error(`Failed to determine if FrontPanel is enabled: ${error}`);
}Code language: JavaScript (javascript)