Jump to content
  • 0

a_in_scan() on multiple USB-2408 issue


MichaelF

Question

Hi,

I'm using 16 USB-2408 and 8 USB-3114 on one computer via 3 powered 10-port USB hubs (8 devices per hub). I have the problem that some of the boards (not always the same ones) do not return a valid measurement into the buffer given to a_in_scan(). I use 12 channels per AD board out of the 16 available. Here are the initialization code snippets relevant to the AD conversion.

ul.ignore_instacal()

self.model.HWData.allhwdevices = ul.get_daq_device_inventory(InterfaceType.USB)
nr_of_devices = len(self.model.HWData.allhwdevices)
# prepare analog I/O info data structure
self.model.HWData.aio_info = [None] * nr_of_devices

# Cycle through all found MC hardware and assign the board numbers
for device in self.model.HWData.allhwdevices:
	board_num = Serial2BoardNr[device.unique_id]	# My table to assign board numbers to board IDs
	ul.create_daq_device(board_num, device)
    daq_dev_info = DaqDeviceInfo(board_num)
    self.model.HWData.devinfo.append(daq_dev_info)
    if daq_dev_info.supports_analog_input:
    	self.model.HWData.aio_info[board_num] = daq_dev_info.get_ai_info()
        for channel in range(self.model.HWData.aio_info[board_num].num_chans):
        	self.model.HWData.adchannels.append([board_num, channel])
            ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADDATARATE, 1000)
            ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADCHANAIMODE, AnalogInputMode.SINGLE_ENDED)
             

Now I want to start the conversion when a GUI button is pressed which calls the following code:

rate = 0
points_per_channel = 1
ad_scan_options = ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS | ScanOptions.SCALEDATA

inputpowerchannels = [tuple[1] for tuple in self.model.HWData.devicechannelmapping]
outputpowerchannels = [tuple[2] for tuple in self.model.HWData.devicechannelmapping]
allpowerinchannels = inputpowerchannels + outputpowerchannels
unique_adboardnumbers = list(set([tuple[0] for tuple in allpowerinchannels]))

vcaoutputchannels = [tuple[0] for tuple in self.model.HWData.devicechannelmapping]
unique_daboardnumbers = list(set([tuple[0] for tuple in vcaoutputchannels]))

self.memhandle = [None] * (len(unique_adboardnumbers) + len(unique_daboardnumbers))
for cur_board_number in unique_adboardnumbers:
	ai_range = self.model.HWData.aio_info[cur_board_number].supported_ranges[2]
    channel_numbers = [tuple[1] for tuple in [item for item in allpowerinchannels if item[0] == cur_board_number]]

    low_chan = min(channel_numbers) # This is 1
    high_chan = max(channel_numbers) # This is 12
    num_chans = high_chan - low_chan + 1 # This is 12 for all AD boards

    total_count = points_per_channel * num_chans
    self.memhandle[cur_board_number] = ul.scaled_win_buf_alloc(total_count)

    # ul.a_load_queue(cur_board_number, list(range(num_chans)), [ai_range] * num_chans, num_chans) # This is not necessary, correct?
    actual_sample_rate = ul.a_in_scan(cur_board_number, low_chan, high_chan, total_count, rate, ai_range, self.memhandle[cur_board_number], ad_scan_options)

The actual_sample_rate in my case is give back as 51S/s for all boards.

Now some boards give back 0.0 on all 12 measured channels, no matter what the actual input voltage is. those boards are not always the same, especially if I unplug and re-plug the boards into the computer.

I also checked the status on the boards. both the working ones and the ones only giving 0.0 show the status as running. But the cur_count is only increasing on the working ones, whereas on the not working ones it stays zero. Also all the USB communication LED indicator lights are blinking no matter if it's a working board or a non-working one.

Any idea how I can fix this?

Thanks,

Michael

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @MichaelF.

I don't have a solution, just some troubleshooting steps.  Have you had success with 'all' these MCC devices and three 'externally' powered USB hubs connected to one Windows system already or did your issue appear after connectng 'x' MCC devices and 'x' USB hubs?  Try using half the number of USB-2408 devices and increment the devices until you reproduce the problem.

Does the issue appear shortly after starting the acquisition or is it random?

Does the issue appear to be dedicated to a particular USB hub?

Which version of Windows OS are you using?

What are the hardware specs of your system?

The USB-2408 device has a channel gain queue limit of 64 elements, so you are well within the limit per USB-2408 device; reference pages 11-12 in the USB-2408 User's Guide.  

UL Help:  https://www.mccdaq.com/pdfs/manuals/Mcculw_WebHelp/ULStart.htm

User's Guide:  https://www.mccdaq.com/pdfs/manuals/USB-2408.pdf

Your USB-2408 sampling rate appears to be correct based on your set A/D data rate and 12 channels.

image.png

 

Regards,

Fausto

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...