• 0

Lost connection in USB switching


Question

We are using AD2 on custom design imx6 based microcontroller. 

The controller has only 2 USB ports & we are using a USB switching IC to switch between multiple devices. 

The device performs well as long as we are not switching the USB port, but when switching is performed the device stops collecting data. 

The USB switching action  is equivalent of disconnecting & reconnecting USB cable. We are using Python for our application. 

Here's the code. 

 

Quote

dwf.FDwfDeviceOpen(c_int(-1), byref(self.h))

.

.

# Switch USB port to AD2 interface.

dwf.FDwfAnalogInConfigure(self.h, c_bool(False), c_bool(True))  # activate oscilloscope

  for iTrigger in range(nAverage):
        # new acquisition is started automatically after done state 
            while True:
                dwf.FDwfAnalogInStatus(self.h, c_bool(True), byref(self.sts))
                # print(self.sts.value)
                # print(DwfStateDone.value)
                if self.sts.value == DwfStateDone.value:
                    break
                time.sleep(0.001)
            # define channel to receive data
            channel = c_int(self.nCH - 1)
            # pass data to vector
            dwf.FDwfAnalogInStatusData(self.h, channel, rxData, self.nRecLength)  # get channel 1 data

dwf.FDwfAnalogInConfigure(self.h, c_bool(False), c_bool(True))  # deactivate oscilloscope before USB switching.

# Switch USB port to different interface.

What can be the possible error. 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

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