jetperch / pyjoulescope

Joulescope driver and utilities
https://www.joulescope.com
Apache License 2.0
38 stars 11 forks source link

RuntimeError when parameter_set #44

Closed byteptr closed 1 day ago

byteptr commented 1 month ago

I have a RuntimeError when trying to ser parameter sampling_frequency to 1Khz, If I comment the line of the parameter change the error dissapears.

"device_open(u/js110/001306) could not open device path \?\usb#vid_16d0&pid_0e88#001306#{576d606f-f3de-4e4e-8a87-065b9fd21eb0} open_ll failed"

Steps to reproduce:

import joulescope  
import numpy as np  
js = joulescope.scan_require_one(config='auto')  
js.parameter_set('sampling_frequency',1000)  # If I add this line, js cannot read data
with js:  
    data = js.read(contiguous_duration=0.2)  

joulescope version 1.1.13 Python 3.9.13 OS WIndows 10 Note, I'm running under Jupyter Notebook Can anyone guide me on this, please ? Many Thanks In advance.

mliberty1 commented 1 month ago

I tried to duplicate this. Here is my setup on Windows 11 with a JS110:

PS C:\> c:\bin\Python3_9_13\python.exe -m pip show joulescope pyjoulescope_driver
Name: joulescope
Version: 1.1.15
Summary: Joulescope™ host driver and utilities
Home-page: https://joulescope.readthedocs.io
Author: Jetperch LLC
Author-email: joulescope-dev@jetperch.com
License: Apache 2.0
Location: c:\bin\python3_9_13\lib\site-packages
Requires: numpy, psutil, pyjls, pyjoulescope-driver, pymonocypher, python-dateutil, pywin32
Required-by: joulescope-ui
---
Name: pyjoulescope_driver
Version: 1.5.5
Summary: Joulescope™ driver
Home-page: https://joulescope.readthedocs.io
Author: Jetperch LLC
Author-email: joulescope-dev@jetperch.com
License: Apache 2.0
Location: c:\bin\python3_9_13\lib\site-packages
Requires: numpy, psutil, pywin32, requests
Required-by: joulescope, joulescope-ui
PS C:\> c:\bin\Python3_9_13\python.exe -VV
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
PS C:\>

And here is what I see when I run this script:

PS C:\> c:\bin\Python3_9_13\python.exe C:\project\Joulescope\support\2024\09\18\fs_read.py
PS C:\>

If I modify it to add print(len(data)) at the end, it shows 200 as expected. This script appears to work.

Are you sure that nothing else has the Joulescope still open? The UI, another script, or any program using the Joulescope that crashed could be keeping the device open. You can manually close them using Device Manager. Alternatively, if you reboot the computer, does this script then work?

mliberty1 commented 1 day ago

Could not duplicate and no response.

@byteptr - Please reopen if this is still an issue!

byteptr commented 16 hours ago

Hi, sorry for the delays. I came back into the script the last week, since we re-opened the project. The I spent some time debugging, and I found a bug from our side. It seems the joulescope instance was already running on a "spurious thread", I removed It, then all works fine. Thank you very much for your attention and quick response.