Python Not Finding OK

I have created the .rbf for my ZEM5310 from the “First” source Code files provided by Opal Kelly.

Now I am trying to communicate via Python w/ my ZEM5310… but am having no luck. My terminal is working, but cannot get Serial Number, and it says “False” for dev.IsFrontPanelEnabled().

Is there something I am missing? I added the ok.py & ok.pyd to the site-packages directory for python.

Thanks,

Zack

(Sorry, I would have tried to upload a picture, but “New Users” cannot)

dev.GetDeviceCount()

returns “0”

But FrontPanel is working, and I can use the Provided FrontPanel profile to control the LED’s on the Opal Kelly…

Same thing here. Sometimes dev.GetDeviceCount() returns 1 though…

1 Like

Hmmm… I can’t get this work to for the life of me, you have any luck whatsoever?

So I am a newb.

I am using Python, and found out that you need to Close the Frontpanel GUI, and then Open the Device in a Python Console. Also, make sure your correct image is loaded onto the device, I am using the “First” provided, and had to compile it myself via Quartus. (Not Provided as a .bit or .sof/rbf by Opal Kelly)

Once I have the Sample “First” image loaded to the OK, I then make sure that no GUI of Frontpanel is running.

Open up a Python Terminal, and then do the following…


import ok //(Files provided need to be added to “site-packages”)
dev = ok.okCFrontPanel() //Creates a device handle
dev.GetDeviceCount(1) //Returns number of Opal Kellys connected to Host PC

serial = dev.GetDeviceListSerial(0) //saves device 0’s serial number into the ‘serial’ variable

dev.OpenBySerial(serial)

dev.IsOpen() //shows that device has successfully been opened
True


I am still having problems reading and writing to Pipes, Wires, Registers, etc… I will create a separate thread, but wanted to post what I have done thus far to see if it helps anyone else in the future who is new to this.

Thanks!

A few things to note here.

  1. The device cannot be open in two applications simultaneously. If you are using the API, make sure you close your FrontPanel application.
  2. There are two separate processes here – enumerating the available devices and opening one: Examples Archive - Opal Kelly
  3. We provide a number of samples that walk you through the API process. It is often best to refer to them to get started. Notably: PipeTest and DESTester both work with devices. DESTester is available in Python.