@timreyes thanks a bunch my friend and appreciate that you had Labor Day etc to deal with and a backlog. Thank you much for the code snippet and its perfect.
Hope all is well
@timreyes thanks a bunch my friend and appreciate that you had Labor Day etc to deal with and a backlog. Thank you much for the code snippet and its perfect.
Hope all is well
Hi everyone, I have a short question
I’m using Logic16 as device and I create a driver for saleae where I have a error for it:
If I try to put 1.8 or any other voltage on digital_threshold_volts:
invalid voltage setting. selected 1.8 Volts. options: 1.8V to 3.6V, 3.6V to 5.0V
If I try to send it as string “1.8V to 3.6V” is saying only accept “real value”
Logic 16 is compatible with python API?
@viespe.georgesorin When looking at the documentation for digital_threshold_volts, it looks like we may not have added support for our Gen1 Logic devices.
https://saleae.github.io/logic2-automation/automation.html#saleae.automation.LogicDeviceConfiguration
Let me double check this with the software team here and we’ll get back to you on that.
@viespe.georgesorin I checked in with the software team here, and this unfortunately looks like a bug. We’ve got this logged internally on our backlog now.
Thank you for your reply, any idea when will be the next update/fix?
@viespe.georgesorin This particular bug is on our backlog now, but we haven’t assigned a release date for it yet.
Does the API support a method for checking the supported samples rates of the current device?
See the automation API for manager get_devices()
function, which returns DeviceDesc
that includes the device_type
enumeration. From that list, you can infer the sample rates as they are documented in the Saleae logic datasheets.
@lucasrangit We haven’t published an official list of available sample rate options for every distinct channel configuration. Having said that, an alternative way to check the available sampling rates is, in case an unsupported sampling rate is configured via our Automation API, the resulting error message printed to the console will show the available and valid sampling rate values you can use (example below).
saleae.automation.errors.InvalidRequestError: Invalid supplied sample rate. Allowed sample rates with channel configuration: {"digital":500000000}, {"digital":250000000}, {"digital":125000000}, {"digital":100000000}, {"digital":50000000}, {"digital":25000000}, {"digital":20000000}, {"digital":12500000}, {"digital":10000000}, {"digital":6250000}, {"digital":5000000}, {"digital":4000000}, {"digital":2500000}, {"digital":2000000}, {"digital":1000000}
Please also keep in mind that our Automation API is not able to configure sampling rates below 625 kS/s (you will notice those lower sampling rates missing from the list in the image above).
We’re tracking the request to get those added in the feature request post below.
I hope that helps!
Thanks @BitBob and @timreyes , the InvalidRequestError
message is an easier way to see the list of supported sample rates for the given channel configuration and device.
I’m not sure where else to post this to get help. I’m using the new API and trying to use the basic example provided at https://saleae.github.io/logic2-automation/getting_started.html.
I had to modify it a bit to get it to run as certain things like:
with automation.Manager.connect(port=10430) as manager
changed to:
with automation.Manager(port=10430) as manager
I think the example is outdated? I’m currently getting stuck at manager.start_capture().
I’m getting the following error: saleae.automation.InvalidRequestError: At least 1 digital or analog channel must be enabled.
But as far as I can see I’ve configured everything right.?
Can someone advise what I’m configuring incorrectly? I’m using a Logic Pro 16.
Below is the code I’m using.
from saleae import automation
import os
from datetime import datetime
with automation.Manager(port=10430) as manager:
# List connected devices
devices = manager.get_devices()
if not devices:
raise Exception("No devices connected.")
for device in devices:
print(f"Device ID: {device.serial_number}, Type: {device.device_type}")
# Use the first connected device
device_id = devices[0].serial_number
# Configure the capturing device
device_configuration = automation.LogicDeviceConfiguration(
enabled_digital_channels=[0, 1],
digital_sample_rate=500000000,
#digital_threshold_volts=3.3,
)
# Set capture configuration for a 5-second duration
capture_configuration = automation.CaptureConfiguration(
capture_mode=automation.DigitalTriggerCaptureMode(trigger_channel_index=0,trigger_type=automation.DigitalTriggerType.RISING),
)
# Start the capture
with manager.start_capture(
device_serial_number=device_id,
device_configuration=device_configuration,
capture_configuration=capture_configuration) as capture:
# Wait for the capture to complete
capture.wait()
# Create a directory to store the output
output_dir = os.path.join(os.getcwd(), f'output-{datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}')
os.makedirs(output_dir, exist_ok=True)
# Export raw digital data to a CSV file
capture.export_raw_data_csv(directory=output_dir, digital_channels=[0, 1])
# Save the capture to a file
capture_filepath = os.path.join(output_dir, 'example_capture.sal')
capture.save_capture(filepath=capture_filepath)
@andrew Sorry for the trouble with that! The example script we provide should work as-is and without any modifications required.
As a baseline, I’d like to see if we can get that running. Can you share the following information?
Hi @timreyes,
Thank you for getting back to this message.
If I follow the example directly I get the below error:
Traceback (most recent call last):
File “c:\Users**\saleae_example.py”, line 11, in
with automation.Manager.connect(port=10430) as manager:
AttributeError: type object ‘Manager’ has no attribute ‘connect’
My OS details are:
Edition Windows 10 Pro
Version 22H2
OS build 19045.5131
The details for Saleae software is below:
logic2-automation 1.0.7
Python 3.12.0
Logic 2 2.4.20
{“Environment”:“production”,“Branch”:“master”,“Commit”:“f29b6bfcc48b5b069cdf3c74ca962ed4dcd6fa3f”,“Version”:“2.4.20”,“AutomationVersion”:“1.0.0”,“MachineID”:“23701772-732d-4409-975f-dbfdfec53165”,“PID”:46524,“LaunchId”:“f9d598ef-7b09-4fb0-905b-a73d6de2bb05”,“Architecture”:“x64”}
@andrew Hmm… strange. The error seems to imply that something might be shadowing automation
.
from saleae import automation
print(automation)
print(automation.Manager)
print(automation.Manager.connect)
Hi @timreyes I’ve tried both 2.4.21 & 2.4.14, the problem doesn’t appeared to be the Logic 2 software.
I can confirm that I did not modify the script at all and still got the above error.
I tried the script you provided but its producing the same error.
<module ‘saleae.automation’ from ‘C:\Python310\lib\site-packages\saleae\automation.py’>
<class ‘saleae.automation.Manager’>
Traceback (most recent call last):
File “c:\Users******\TestAuto.py”, line 4, in
print(automation.Manager.connect)
AttributeError: type object ‘Manager’ has no attribute ‘connect’
I managed to install logic2-automation on my mac and copied the saleae_example.py script, and it ran fine on the mac. So there’s something funny with the windows implementation…
On windows, if you change the line in the script to
with automation.Manager(port=10430) as manager:
then the script runs a bit further failing at a different point.
Hi @andrew,
This is Mark, I run software development here at Saleae. Sorry for the trouble with this!
This is a very odd issue, one that we’ve never seen before.
The problem must be specific to your python environment, although I don’t know what it might be.
The first thing I recommend doing is seeing if you can reproduce it from a virtual environment. That way we can ensure that you have a clean install of the library and that no other python packages you have installed could be interfering with it.
Please run the following, 1 line at a time:
mkdir temp
cd temp
# copy the sample script from the saleae website unmodified into this directory, named saleae_example.py
python -m venv env
env\Scripts\activate.bat
# you should be on the virtual environment prompt now
python -m pip install logic2-automation
# open the Logic 2 software, and make sure the automation server is ON.
python saleae_example.py
That should use a simulation Logic Pro 16 device to take a short recording.
Next, comment out this line from the start_capture
call:
# device_id='F4241',
Make sure your Logic Pro 16 is connected, then run the script again. It should now capture using your device.
Hopefully that works. Using a virtual environment is a good way to prevent other packages or environmental factors from affecting your project.
If you see the same problem, or a new issue, please let me know. As for fixing this in your default environment, I would start by uninstalling the logic2-automation package, making sure the script fails the moment it tries to import the package, then install it again.
Hi @markgarrison,
Figured out its been a PEBCAC error or lack of experience in python…
I followed your instructions and it worked fine! So I went and uninstalled any instance I had of python and reinstalled Python 3.13.0 and then reinstalled logic2-automation.
Everything seems to be working fine now. So not sure what went wrong with the install I had or what conflicted with what, but things are now sorted. Thank you so much!
P.S. Any chance there’s any documentation to get gRPC or the API working with C# and .NET…?
Would love any references to work on that.
Thanks again.
Hi Andrew,
Glad to hear it’s working now, sorry for the trouble!
Yes, and I managed to get this working last year. I didn’t write up documentation, but I did push the example to github here:
The process is fairly simple. You can follow the Microsoft instructions for creating a gRPC client here:
Although when I did this, I used a different tutorial: Getting started with grpc-dotnet in VS Code – Swaminathan Vetri
You will also need our *.proto file, which you can get here:
We did have some trouble with .NET Framework last year. (thread here) I would recommend using .NET Core over .NET Framework, although it sounds like it should work, it just requires using deprecated packages.
Hello, I am using the Python automation API with the latest Logic 2.4.22.
I get a warning with the sample script, that I don’t quite understand:
C:\Users\xxx\AppData\Roaming\Python\Python313\site-packages\google\protobuf\runtime_version.py:98: UserWarning: Protobuf gencode version 5.29.0 is exactly one major version older than the runtime version 6.30.2 at saleae/grpc/saleae.proto. Please update the gencode to avoid compatibility violations in the next runtime release.
warnings.warn(
I tried on a different machine and with Python 3.10 and 3.13, no difference; anyway the script runs and does what it is expected to do.
Any suggestion?
Thanks
@marco.degano Thanks for the heads up! I’m glad your automation script works regardless. I noticed another user posted about this as well here.
I doubt it’s anything critical, but we’ll double check.