Installation
Quick Start
Install with pip (see pip section)
To use an FPGA and peripherals:
Download FrontPanel from OpalKelly (see FPGA section)
Download Registers.xlsx and add unsupported peripherals (see Peripherals section)
Create config.yaml with
pyripherals.utils.create_yaml()and edit (see YAML Configuration section)
pip
pyripherals can be installed using pip.
pip install pyripherals
To install the latest development version of pyripherals from the
GitHub repository, use the following pip command.
pip install git+https://github.com/Ajstros/pyripherals
FPGA
To use the FPGA class with an Opal Kelly FrontPanel-supported device, you will also need to download the FrontPanel SDK from Opal Kelly. If you are using a MAC see the Opal Kelly Setup on MAC section. You will also need to update the config.yaml file. See the YAML Configuration section and example.
Peripherals
To use peripherals, you will need FrontPanel (see FPGA section) as well as the Registers.xlsx spreadsheet with register information for all supported peripherals, available on the GitHub.
Update the config.yaml file with the path to Registers.xlsx (see YAML Configuration section).
If you are using a peripheral not currently supported by pyripherals, see the New Peripheral Guide.
YAML Configuration
pyripherals uses a config.yaml file to customize paths to needed files and other user-configurable options.
To start, install the package (see pip section), and open a Python shell. You can then
import pyripherals.utils.create_yaml() and run it like below.
>>> from pyripherals.utils import create_yaml
>>> create_yaml()
YAML created at C:/Users/username/.pyripherals
From there, you can configure the options available by editing the config.yaml file created at the path given
after running pyripherals.utils.create_yaml(). An example YAML is shown below. Note that the paths to
ep_defines.v, the FPGA bitfile, and the Registers.xlsx spreadsheet go directly to files, but the FrontPanel path
goes to the FrontPanelUSB folder of your installation.
endpoint_max_width: 32
ep_defines_path: C:/Users/username/my_project/ep_defines.v
fpga_bitfile_path: C:/Users/username/my_project/top_level_module.bit
frontpanel_path: C:/Program Files/Opal Kelly/FrontPanelUSB
registers_path: C:/Users/username/my_project/Registers.xlsx
Opal Kelly Setup on MAC
The _ok.so shared library needs to be able to “find” the libokFrontPanel.dylib. Navigate to the FrontPanel API directory: e.g. frontpanel/API/Python3/ and check where _ok.so is searching for libokFrontPanel.dylib using otool.
$ otool -L _ok.so
This output indicates that the Python import of ok will fail since libok is one directory up. Change this using install_name_tool.
$ install_name_tool -change libokFrontPanel.dylib /fullpath/to/libokFrontPanel/libokFrontPanel.dylib _ok.so