Monitoring data while running downsample_logging.py

Been working with Joulescope for a couple weeks now, and my I am needing to monitor and record data from a unit simultaneously over time. But, when I run downsample_logging.py while I have a Joulescope active I get multiple errors and nothing is written to the CSV file. When I disable the active Joulescope then run downsample_logging.py, it works just fine.

Starting logging - press CTRL-C to stop
Found 2 Joulescopes
2020-07-01T08:53:41 ERROR While running command
Traceback (most recent call last):
File “device_thread.py”, line 64, in _cmd_process
rv = self._device.open(event_callback_fn)
File “device.py”, line 680, in open
raise IOError(’%s : open failed %s’ % (self, kernel32.get_last_error()))
OSError: Joulescope:001138 : open failed [6] The handle is invalid.

2020-07-01T08:53:41 ERROR While running command
Traceback (most recent call last):
File “device_thread.py”, line 74, in _cmd_process
self._device.control_transfer_in(cbk, *args, **kwargs)
File “device.py”, line 772, in control_transfer_in
return self._control_transfer.pend(cbk_fn, pkt)
AttributeError: ‘NoneType’ object has no attribute ‘pend’
2020-07-01T08:53:44 ERROR device thread hung: control_transfer_in - FORCE CLOSE
2020-07-01T08:53:44 WARNING could not fetch info record
2020-07-01T08:53:44 WARNING could not fetch active calibration
2020-07-01T08:53:44 ERROR while capturing data
Traceback (most recent call last):
File “downsample_logging.py”, line 351, in run
self._open_devices(do_notify=False)
File “downsample_logging.py”, line 341, in _open_devices
closed_device.open(all_device)
File “downsample_logging.py”, line 429, in open
info = device.info()
File “C:\Python38\lib\site-packages\joulescope\driver.py”, line 442, in info
rv = self._usb.control_transfer_in(
File “device_thread.py”, line 218, in control_transfer_in
return self._post_block(‘control_transfer_in’, (args, kwargs))
File “device_thread.py”, line 165, in _post_block
raise IOError(‘DeviceThread not running’)
OSError: DeviceThread not running

Any help would be greatly appreciated.
Thank you.

1 Like

Hi @RyanM and welcome to the Joulescope forum!

Let me first make sure that I understand what you are trying to do. I think that you have two Joulescopes connected to your host PC. You want to use one Joulescope with the downsample_logging.py script. You want to simultaneously use the other Joulescope with the Joulescope UI (or another different script).

Is this right?

I tried to duplicate what you see. Here is what I did:

  1. I connected two Joulescopes to my computer.
  2. I started the Joulescope UI, which opens the “first” Joulescope by default.
  3. I then tried running the downsample_logging.py script
  4. I saw the same error message you reported.

Currently, the downsample_logging.py script will attempt to open all connected Joulescopes. This case is not something that the script currently handles.

Just out of curiosity, I tried opening a second Joulescope UI with debugging available, and I initially get this same error. Manually selecting the other Joulescope works, though.

Please confirm that I understand what you are trying to do. In the meantime, I’ll take a quick look at the downsample_logging code.

Ideally I would like to be able to do this with just one Joulescope, I just happen to have two connected at the moment. The idea is to be able to have either the multimeter or o-scope view up and running while running the downsample_logging.py script.

Ok, I have one possible immediate workaround. First, I need to define some names. I will use js_log for the Joulescope you want to use with downsample_logging, and js_ui for the Joulescope you want to use with the Joulescope User Interface.

Here’s what you can do:

  • Disconnect the host USB connection from js_ui
  • Connect the host USB connection for js_log
  • Start downsample_logging.py. It should find one Joulescope and run normally.
  • Connect the host USB connection for js_ui
  • Start the Joulescope UI. If it comes up disabled, manually select the “second” DevicesJoulescope device.

Not ideal, but does this solve the immediate need?

You will never be able to run the downsample_logging script (at least in anything close to its existing form) with the Joulescope UI also receiving data. Application access to a Joulescope is exclusive, so only one application can connect to a Joulescope at a time. We could add the ability for the Joulescope UI to record the statistics data (the same data used by downsample_logging.py and the multimeter) to a CSV file, just like downsample_logging does.

Does this match what you want?

The downside is that you lose the automatic recovery mechanism on computer reboots and all other strange, unexpected errors that is part of downsample_logging.

1 Like

Yes, it does indeed match what I want. It is unfortunate that it isn’t possible to do both application from the same Joulescope currently. Thank you for the work around, I am sure I can figure out were to go from here. And thank you for the speedy response.

1 Like

I just created issue #85 over on GitHub. I don’t think that adding this feature is too much work, and it may even make it into the upcoming release.

2 Likes

Software 0.9.2+ have a new record statistics button in the UI.
image

Upgrade now!