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 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++

  OpalKelly::FrontPanelDevices devices;
  auto dev = devices.Open();

  okErrorCode error = dev->ConfigureFPGA("example.bit");
  // It's a good idea to check for errors here!!

  // IsFrontPanelEnabled returns true if FrontPanel is detected.
  if (dev->IsFrontPanelEnabled()) {
      std::cout << "FrontPanel host interface enabled.\n";
  } else {
      std::cerr << "FrontPanel host interface not detected.\n";
  }Code language: PHP (php)

C#

  okCFrontPanelDevices devices = new okCFrontPanelDevices();
  okCFrontPanel dev = devices.Open("");

  string bitfile = "example.bit";
  okCFrontPanel.ErrorCode error = dev.ConfigureFPGA(bitfile);
  // It's a good idea to check for errors here!!

  // IsFrontPanelEnabled returns true if FrontPanel is detected.
  if (dev.IsFrontPanelEnabled()) {
      Console.WriteLine("FrontPanel host interface enabled.");
  } else {
      Console.Error.WriteLine("FrontPanel host interface not detected.");
  }Code language: JavaScript (javascript)

Python

  devices = ok.FrontPanelDevices()
  dev = devices.Open()

  error = dev.ConfigureFPGA("example.bit")
  # It's a good idea to check for errors here!!

  # IsFrontPanelEnabled returns true if FrontPanel is detected.
  if dev.IsFrontPanelEnabled():
      print("FrontPanel host interface enabled.")
  else:
      print("FrontPanel host interface not detected.", file=sys.stderr)Code language: PHP (php)

Java

  public class Example {
      okCFrontPanelDevices devices;
      okCFrontPanel dev;
      okCFrontPanel.ErrorCode error;

      public void CheckFP() {
          devices = new okCFrontPanelDevices();
          dev = devices.Open("");
          error = dev.ConfigureFPGA("example.bit");
          // It's a good idea to check for errors here!!

          // IsFrontPanelEnabled returns true if FrontPanel is detected.
          if (dev.IsFrontPanelEnabled()) {
              System.out.println("FrontPanel interface is enabled.");
          } else {
              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.getFPGADataPortClassic();

        // IsFrontPanelEnabled returns true if FrontPanel is detected.
        const isFrontPanelEnabled = await dev.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)