Configure Two Devices
As with opening two separate devices, configuring two separate devices requires opening the two devices and configuring each of them with the appropriate bitfiles. To configure the separate devices, call ConfigureFPGA() on each instance and specify the corresponding bitfile that will be used to configure them. It is easy to mistakenly configure a bitfile to the wrong device when configuring multiple devices at once, so it is a good idea to incorporate a safeguard, such as opening the devices by specifying the serial number or verifying the board model after it is open. It is also a good idea to check for errors after configuration.
C/C++
OpalKelly::FrontPanelDevices devices;
auto dev1 = devices.Open("14230005XY");
auto dev2 = devices.Open("14230005XZ");
okErrorCode error;
error = dev1->ConfigureFPGA("video_capture_a.bit");
error = dev2->ConfigureFPGA("video_capture_b.bit");
// It's a good idea to check for errors here!!Code language: PHP (php)C#
okCFrontPanelDevices devices = new okCFrontPanelDevices();
okCFrontPanel dev1 = devices.Open("14230005XY");
okCFrontPanel dev2 = devices.Open("14230005XZ");
okCFrontPanel.ErrorCode error;
error = dev1.ConfigureFPGA("video_capture_a.bit");
error = dev2.ConfigureFPGA("video_capture_b.bit");
// It's a good idea to check for errors here!!
Python
devices = ok.FrontPanelDevices()
dev1 = devices.Open("14230005XY")
dev2 = devices.Open("14230005XZ")
error = dev1.ConfigureFPGA("video_capture_a.bit")
error = dev2.ConfigureFPGA("video_capture_b.bit")
# It's a good idea to check for errors here!!Code language: PHP (php)Python
devices = ok.FrontPanelDevices()
dev1 = devices.Open("14230005XY")
dev2 = devices.Open("14230005XZ")
error = dev1.ConfigureFPGA("video_capture_a.bit")
error = dev2.ConfigureFPGA("video_capture_b.bit")
# It's a good idea to check for errors here!!Code language: PHP (php)Java
public class example{
okCFrontPanel dev;
okCFrontPanel.ErrorCode error;
public void Configure(String bitfile, String serial){
dev = new okCFrontPanel();
dev.OpenBySerial(serial);
error = dev.ConfigureFPGA(bitfile);
// It’s a good idea to check for errors here!!
}
public static void main(String[] args){
ConfigFPGA config1 = new ConfigFPGA();
ConfigFPGA config2 = new ConfigFPGA();
config1.Configure("video_capture_a.bit", "14230005XY");
config2.Configure("video_capture_b.bit", "14230005XZ");
}
}Code language: JavaScript (javascript)JavaScript
const deviceManager = window.FrontPanelAPI.deviceManager;
const dev1 = await deviceManager.openDevice("14230005XY");
const dev2 = await deviceManager.openDevice("14230005XZ");
try {
const fpgaConfig1 = dev1.getFPGAConfiguration();
await fpgaConfig1.loadConfigurationFromFile("video_capture_a.bit");
const fpgaConfig2 = dev2.getFPGAConfiguration();
await fpgaConfig2.loadConfigurationFromFile("video_capture_b.bit");
}
catch(error) {
console.error(`FPGA Configuration Failed: $(error)`);
}Code language: JavaScript (javascript)