Problem when printing out Python Code example in Programming Language Documentation

Hello, I am currently working with the Python example code shown on the following page:

The example showed that it prints out the following values:

import ok
dev = ok.okCFrontPanel()
pll = ok.okCPLL22150()
dev.GetEepromPLL22150Configuration(pll)
1
dev.SetPLL22150Configuration(pll)
1
pll.GetOutputFrequency(0)
100.0
dev.ConfigureFPGA(‘c:\counters.bit’)
1
dev.ActivateTriggerIn(0x40,0)
1

But when I tried running the same code on my computer (connected to a XEM7310A75), the following values are printed out instead:

import ok
dev = ok.okCFrontPanel()
pll = ok.okCPLL22150()
dev.GetEepromPLL22150Configuration(pll)
-8
dev.SetPLL22150Configuration(pll)
-8
pll.GetOutputFrequency(0)
10
dev.ConfigureFPGA(‘c:\counters.bit’)
-8
dev.ActivateTriggerIn(0x40,0)
-8

I’ve checked to make sure the Python code is connected to the device using GetDeviceCount and FrontPanel SDK was also not running. What is causing the different results, and should I be concerned about it?

Hello and welcome!

This example is missing the all important OpenBySerial call:
dev.OpenBySerial("")
after dev = ok.okCFrontPanel()
This is why the -8 error code was returned: DeviceNotOpen
Ref: Error Codes - Opal Kelly Documentation Portal

This has been fixed in the documentation you linked. Thank you for bringing this to our attention!
I also suggest checking out the DES sample in the Samples folder, DESTester.py is a good resource.

Hello I just tried this however I now get:

import ok
dev = ok.okCFrontPanel()
pll = ok.okCPLL22150()
dev.GetEepromPLL22150Configuration(pll)
-15
dev.SetPLL22150Configuration(pll)
-15
pll.GetOutputFrequency(0)
10.0
dev.ConfigureFPGA(‘c:\counters.bit’)
-7
dev.ActivateTriggerIn(0x40,0)
0

is there anything else I am missing?

This is likely expected. Let’s check out the error codes: Error Codes - Opal Kelly Documentation Portal

-15 UnsupportedFeature: The requested action is not supported. Often this means that an improper parameter was offered to the API. Check the API documentation and make sure you’re following all parameter requirements for lengths, etc.
Basically, since the XEM7310 doesn’t have PLL22150, this call isn’t supported here.

-7 FileError: File could not be opened. Check paths and assumptions.
There is not a bitfile named “counters.bit” located on the root of your C drive.

I would instead run the DES sample located in the samples folder, as it is more device agnostic (and interesting). Prebuilt bitfiles are available at Opal Kelly Pins

Additionally, I will forward this to the documentation team so they can draft up a different example for the Python API in the documentation as it is currently targeted for older devices.

Thanks,

I am just trying to find an example that can send numbers from PC in python to the FPGA XEM7310-75A, since the one online is outdated, is there any example you would recemend?

since XEM7310 doesnt have PLL22150, what should I do instead?