Jump to content
  • 0

USB-1608GX connection issues after using a_in_scan


Seweee

Question

Hey,

I have a rather interesting problem when trying to use a_in_scan with my USB-1608GX-2AO device. I am using the python uldaq library and have written a small script to test the a_in_scan function as I need it for a larger application:

import numpy as np
from icecream import ic

from uldaq import (get_daq_device_inventory, DaqDevice, InterfaceType,
                   AiInputMode, Range, AInFlag, AInScanFlag,
                   create_float_buffer,
                   ScanOption)

# Get a list of available DAQ devices
ic("Start")
devices = get_daq_device_inventory(InterfaceType.USB)
# Create a DaqDevice Object and connect to the device
daq_device = DaqDevice(devices[0])
daq_device.connect()
ic("Connected")

# Get AiDevice and AiInfo objects for the analog input subsystem
ai_device = daq_device.get_ai_device()

# Sample acquisition rate in Hz
rate = 200

# Number samples per channel.
samples_per_channel = 200

# Number of channels, must agree with specification of low_channel and
# high_channel below
num_channels = 1
low_channel = 0
high_channel = 0


buffer = create_float_buffer(num_channels, samples_per_channel)


actual_scan_rate = ai_device.a_in_scan(
    low_channel=low_channel,
    high_channel=high_channel,
    input_mode=AiInputMode.DIFFERENTIAL,
    analog_range=Range.BIP5VOLTS,
    samples_per_channel=samples_per_channel,
    rate=rate,
    options=ScanOption.DEFAULTIO,
    flags=AInScanFlag.DEFAULT,
    data=buffer)

data = np.array(buffer[:]).reshape(
    (samples_per_channel, num_channels)).transpose()


ic(data)

ai_device.scan_stop()
daq_device.disconnect()
daq_device.release()

The first time I run the script after physically connecting the device, it runs fine and returns the expected input value. However, when I try to run the script multiple times, it either immediately fails to connect to the device and returns the following error:
uldaq.ul_exception.ULException: 8: Device no longer responding
during the daq_device.connect() command in line 8. Or it returns an input value of 0 and the same error occurs in one of the following executions. After the error occurs, I have to physically reconnect the device. When trying other functions such as a_in() with this device, they work as intended, so I don't think my device itself is broken.

I have also tried running the AInScan.c example provided by libuldaq, where the device shows exactly the same behaviour. The first time I run the example script everything is fine until I terminate the process and try to run it again where it gives the same error code I get with my own script. 

I have another MCC device, USB-2408-2AO, and have tried both my script and the AInScan.c example on this device. Both worked fine, so I am not really sure how to solve this problem. Is this a specific problem with the USB-1608GX device or am I missing something really basic here?

Thanks in advance.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
Posted (edited)

Hey @Fausto,

I am using Ubuntu 22.04 LTS and libuldaq-1.2.1. However, my Ubuntu OS is running as a VirtualBox VM, which has not caused any problems with my other MCC devices..

Edited by Seweee
Link to comment
Share on other sites

  • 0

Hey @Fausto,

 

sorry to be opening this old post again, the issue somehow fixed itself shortly after the initial post. Unfortunately I have no idea what or why that was happening there. Even worse, for some reason now it does not work again. So I am still having the same issue as explained above. Did you recieve some information or maybe even a solution for my issue in the meantime? Some help would be gladly appreciated, as of right now the device I have is unusable for our operations. Thanks in advance!

Link to comment
Share on other sites

  • 0

Hello @Seweee.

You mentioned that your code was a small script in your large application.  Were there any changes to the large application that could affect the MCC device connection?

Are you unable to connect and use the USB-1608GX-2AO device (or your other MCC devices) with your Ubuntu OS running as a VirtualBox VM, even cycling the USB connection and the VirtualBox?

Were any Windows or Ubuntu OS updates installed?

Regards,

Fausto

Link to comment
Share on other sites

  • 0

Hey @Fausto,

 

as far as I know no changes regarding this part of the software have been made between back then and now. I incorporated the script I wrote into the software, tested it a couple of times and have not used it much, since our development focus laid elsewhere. We are now trying to create a test setup with all devices we are using and I rediscovered this error.

I don't think it is an error in our software, as even the AInScan example from libuldaq is not working on my USB-1608GX board anymore. There too, it shows exactly the same behaviour as described in my first post.

I am able to connect and use the USB-1608 device within my VM for basically any function but a_in_scan. Reconnecting the device also works fine, VirtualBox shows no sign that the connection may be faulty etc. All other MCC devices (2408, CTR08, Temp) work fine within the VM too, so I am a little lost here why the 1608 shows this behaviour.

Of course I got some Windows and Ubuntu updates in the meantime, but the versions I mentioned above still apply (Ubuntu LTS 22.04, Windows 10, VirtualBox 7.0.12, libuldaq 1.2.1)

Kind reagrds,

Seweee

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...