Configure the FPGA

To configure the FPGA, use a bitfile generated by the Xilinx or Altera tools. Xilinx tools output a bitfile with the extension “.bit” that may be used directly. Altera tools must be setup to output a raw bitfile with the extension “.rbf”. Checking for errors with the ConfigureFPGA() method can help flag important errors that may be difficult to identify later in the application.
Note that ConfigureFPGA() requires a bitfile to be specified, as it will not automatically detect an available bitfile.

When configuring using  a specific bitfile, make sure that the bitfile is in the working directory of the application, which may or may not be the same directory as the source file or executable.

C/C++

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

  okErrorCode error = dev->ConfigureFPGA("video_capture.bit");
  // It's a good idea to check for errors here!!Code language: PHP (php)

C#

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

  string bitfile = "video_capture.bit";
  okCFrontPanel.ErrorCode error = dev.ConfigureFPGA(bitfile);
  // It's a good idea to check for errors here!!Code language: JavaScript (javascript)

Python

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

  error = dev.ConfigureFPGA("video_capture.bit")
  # It's a good idea to check for errors here!!Code language: PHP (php)

Java

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

      public void Configure() {
          devices = new okCFrontPanelDevices();
          dev = devices.Open("");
          error = dev.ConfigureFPGA("video_capture.bit");
          // It's a good idea to check for errors here!!
      }
  }Code language: PHP (php)

JavaScript

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

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