### Clone the example repository Source: https://docs.opalkelly.com/fphdl/axi/simulation/cocotb Clones the cocotbext-frontpanel repository and changes into the example directory. All subsequent commands in the guide are run from this directory. ```bash git clone https://github.com/opalkelly-opensource/cocotbext-frontpanel.git cd cocotbext-frontpanel/example ``` -------------------------------- ### Set XEM8310 package pins for sys_rst_n, sys_clk_p, sys_clk_n Source: https://docs.opalkelly.com/xem8310/brk8310-breakout-board/pci-express-reference-design Replace the default LOC constraints for sys_rst_n, sys_clk_p, and sys_clk_n in the example design's xilinx_xdma_pcie_x0y0.xdc file with these package pin assignments. Pin information is available on the XEM8310's Pins page. ```css set_property PACKAGE_PIN E22 [get_ports sys_rst_n] set_property PACKAGE_PIN T7 [get_ports sys_clk_p] set_property PACKAGE_PIN T6 [get_ports sys_clk_n] ``` -------------------------------- ### Set package pins for sys_rst_n, sys_clk_p, sys_clk_n in XDC Source: https://docs.opalkelly.com/xem8305/brk8305-breakout-board/pci-express-reference-design Replace the LOC constraints in the example design's xilinx_xdma_pcie_x0y0.xdc file with these set_property commands to assign the correct package pins for the BRK8305 board. Pin locations are from the XEM8305's Pins page. ```css set_property PACKAGE_PIN J11 [get_ports sys_rst_n] set_property PACKAGE_PIN V7 [get_ports sys_clk_p] set_property PACKAGE_PIN V6 [get_ports sys_clk_n] ``` -------------------------------- ### XDC constraints for XEM8305 pins and SPIx4 configuration Source: https://docs.opalkelly.com/xem8305/brk8305-breakout-board/pci-express-reference-design Replace the default LOC constraints for sys_rst_n, sys_clk_p, and sys_clk_n with these package pin assignments for the XEM8305. Add the SPI configuration constraints to allow x4 SPI configuration. These are applied to the example design's xilinx_xdma_pcie_x0y0.xdc constraint file. ```css set_property PACKAGE_PIN J11 [get_ports sys_rst_n] set_property PACKAGE_PIN V7 [get_ports sys_clk_p] set_property PACKAGE_PIN V6 [get_ports sys_clk_n] ``` ```css set_property BITSTREAM.CONFIG.EXTMASTERCCLK_EN disable [current_design] set_property CONFIG_MODE SPIx4 [current_design] set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design] set_property BITSTREAM.CONFIG.SPI_FALL_EDGE YES [current_design] set_property BITSTREAM.CONFIG.CONFIGRATE 80 [current_design] set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design] set_property BITSTREAM.CONFIG.UNUSEDPIN Pulldown [current_design] ``` -------------------------------- ### fmcconfig -setup examples for startup parameters Source: https://docs.opalkelly.com/fpsdk/samples-and-tools/tool-fmcconfig Three example commands for setting startup parameters with fmcconfig -setup. The first is the factory default: geographical address 0, fallback Vadj mode, 8192-byte EEPROM, 3.3V, Vadj enabled. The second sets address 2, manual mode, 8192-byte EEPROM, 2.5V, enabled. The third sets address 0, auto mode, 256-byte EEPROM, 3.3V, disabled. Each command is followed by its expected output describing the pin settings and Vadj behavior. ```bash fmcconfig -setup 0 fallback 8192 3.3 1 ### [Factory Default] GA1:GA0 = 0:0 Vadj set according to IPMI, if available, otherwise 3.3v. EEPROM size is 8192 (24LC64, e.g.) ``` ```bash fmcconfig -setup 2 manual 8192 2.5 1 GA1:GA0 = 1:0 Vadj will be set to 2.5. Any present IPMI EEPROM is ignored. EEPROM size is 8192 (24LC64, e.g.) ``` ```bash fmcconfig -setup 0 auto 256 3.3 0 GA1:GA0 = 0:0 Vadj set according to IPMI, if available, otherwise disabled. EEPROM size is 256 (24LC02, e.g.) ``` -------------------------------- ### Start the FPoIP server with sample certificate Source: https://docs.opalkelly.com/camera Run this command on the host (the computer the board is plugged into) from the root of the extracted FrontPanel SDK folder. It uses the sample snakeoil certificate, key, and password file. On Windows, use FPoIP\fpoip-server.exe instead. The server listens on port 9999 and credentials are username User, password Test. ```shell FPoIP/fpoip-server --tlscert=FPoIP/certs/snakeoil.crt --tlskey=FPoIP/certs/snakeoil.key --password=FPoIP/example.passwd ``` -------------------------------- ### Install dependencies with pip Source: https://docs.opalkelly.com/fphdl/axi/simulation/cocotb Install the pinned dependencies from the requirements.txt file that ships with the example. This includes cocotbext-frontpanel from the custom package index and cocotb and pytest from PyPI. The environment must be active before running this command. ```css pip install -r requirements.txt ``` -------------------------------- ### Start AMD XSCT Command-Line Tool Source: https://docs.opalkelly.com/fpsdk/samples-and-tools/displayport-example-design Command to launch AMD's XSCT tool from the Vitis installation directory. ```batch C:\\Vitis\2023.1\bin\xsct.bat ``` -------------------------------- ### Run app on Linux with --app-package Source: https://docs.opalkelly.com/fpplatform/dev/debug-with-chrome-devtools Starts the application on Linux. Assumes the FrontPanel Platform executable is at $HOME/Desktop/FrontPanel-Linux/FrontPanel-Platform/frontpanel-platform and the package is at $HOME/Desktop/my-frontpanel-app/output/app-dev.fpp. ```php $HOME/Desktop/FrontPanel-Linux/FrontPanel-Platform/frontpanel-platform --app-package=$HOME/Desktop/my-frontpanel-app/output/app-dev.fpp ``` -------------------------------- ### Check OpalKelly gem installation Source: https://docs.opalkelly.com/fpsdk/frontpanel-api/programming-languages Trivial example to verify the OpalKelly gem is installed correctly. It requires the gem and prints the API version string. The Ruby program must be able to load the FrontPanel SDK shared library at run-time. ```ruby require 'OpalKelly' puts "Using OpalKelly SDK #{OpalKelly::GetAPIVersionString()}" ``` -------------------------------- ### Configure PLL22150 in Python Source: https://docs.opalkelly.com/fpsdk/how-to/pll-configuration Shows how to configure a PLL22150 in Python. The first example uses the ok module: open a device, create a PLL22150 object, get the existing configuration, modify it with SetReference and SetVCOParameters, then save with SetPLL22150Configuration. The second example uses the Pythonic API with DeviceManager and PLL22150, checking the PLL type and using set_reference and set_vco_parameters before applying with set_configuration. ```Python devices = ok.FrontPanelDevices() dev = devices.Open() pll22150 = ok.PLL22150() # Get the existing settings to modify them dev.GetPLL22150Configuration(pll22150) # Modify the PLL settings pll22150.SetReference(48.0, False) pll22150.SetVCOParameters(400, 48) # ...And so forth # Save new settings to the device dev.SetPLL22150Configuration(pll22150) ``` ```Python from frontpanel import DeviceManager, PLL22150 manager = DeviceManager() with manager.open_device() as device: pll = device.get_pll() if not isinstance(pll, PLL22150): print("This device has no PLL22150.") else: config = pll.get_configuration() # Reference clock 48 MHz (crystal, not an external oscillator). config.set_reference(48.0, False) # VCO parameters: P = 400, Q = 48. config.set_vco_parameters(400, 48) # Apply the configuration to the device. pll.set_configuration(config) ``` -------------------------------- ### Java: Open first device with Open("") Source: https://docs.opalkelly.com/fpsdk/how-to/open-the-first-device-available Defines an Example class with an OpenDevice() method that uses okCFrontPanelDevices and calls Open("") with an empty string. ```java public class Example { okCFrontPanelDevices devices; okCFrontPanel dev; public void OpenDevice() { devices = new okCFrontPanelDevices(); dev = devices.Open(""); } } ``` -------------------------------- ### Read EEPROM image with fmcconfig -read-eeprom Source: https://docs.opalkelly.com/fpsdk/samples-and-tools/tool-fmcconfig Reads the EEPROM image of the specified size and stores it to a file. The example reads an 8192-byte EEPROM image and saves it to 'image.bin'. Requires the same setup as writing: fmcconfig, fmcconfig.bit, and the XEM6006 attached and not in use. ```bash # Read the 8192-byte EEPROM image and store it to the file image.bin. fmcconfig -read-eeprom image.bin 8192 ``` -------------------------------- ### Build and package the app Source: https://docs.opalkelly.com/fpplatform/dev/building-with-npm-create Build and package the app, producing an output file named app.fpp in the output directory (output/app.fpp). ```bash npm run pack ``` -------------------------------- ### smartvio command-line usage and examples Source: https://docs.opalkelly.com/syzygy-brain-1/linux-image Shows the smartvio utility's usage, options, and examples. Use -r to run the solver, -s to set voltages, -w/-d for DNA operations, and -1/-2 to specify voltages in tens of millivolts. The i2c device path is required. ```text Usage: smartvio [option [argument]] is required for all commands. It must contain the path to the Linux i2c device Exactly one of the following options must be specified: -r - run smartVIO, queries attached pods and sets voltages accordingly -s - set VIO voltages to the values provided by -1 and -2 options -h - print this text -w - write a binary DNA to a pod, takes the DNA filename as an argument -d - dump the DNA from a pod to a binary file, takes the DNA filename as an argument The following options may be used in conjunction with the above options: -1 - Sets the voltage for VIO1 -2 - Sets the voltage for VIO2 and must be specified as numbers in 10's of mV's -p - Specifies the pod number for the -w or -d options Examples: Run SmartVIO solver: smartvio -r /dev/i2c-1 Dump DNA from the pod on Port 1: smartvio -d dna_file.bin -p 1 /dev/i2c-1 Set VIO1 to 3.3V: smartvio -s -1 330 /dev/i2c-1 ``` -------------------------------- ### JavaScript: write to PipeIn 0x80 and read from PipeOut 0xA0 with reset Source: https://docs.opalkelly.com/fpsdk/how-to/transferring-data JavaScript example using the FrontPanel API: opens a device, loads a bitstream, gets the classic data port, sends a reset via WireIn 0x10, writes an ArrayBuffer to PipeIn 0x80, and reads into another buffer from PipeOut 0xA0. Uses async/await. ```javascript const deviceManager = window.FrontPanelAPI.deviceManager; const dev = await deviceManager.openDevice(""); const fpgaConfig = dev.getFPGAConfiguration(); await fpgaConfig.loadConfigurationFromFile("example.bit"); const fpgaDataPort = await dev.getFPGADataPortClassic(); // Send brief reset signal to initialize the FIFO. fpgaDataPort.setWireInValue(0x10, 0xff, 0x01); await fpgaDataPort.updateWireIns(); fpgaDataPort.setWireInValue(0x10, 0x00, 0x01); await fpgaDataPort.updateWireIns(); const dataout = new ArrayBuffer(128); const datain = new ArrayBuffer(128); for (let i = 0; i < dataout.byteLength; i++) { // Load outgoing data buffer. } // Send buffer to PipeIn endpoint with address 0x80 const bytesWritten = await fpgaDataPort.writeToPipeIn(0x80, dataout.byteLength, dataout); // Read to buffer from PipeOut endpoint with address 0xA0 const bytesRead = await fpgaDataPort.readFromPipeOut(0xA0, datain.byteLength, datain); ```