Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

A USB transfer failed due to a transaction error reported by the USB host controller.

Hi,

 

we are using Measurement Studio 2019 and C# language in a Winforms application. This application reads the voltages and display the output values.

 

We are consistently getting hit by the below exception 

 

A USB transfer failed due to a transaction error reported by the USB host controller. This may be due to a fault in the system's USB host controller, a USB cable, or a USB device.

Task Name: _unnamedTask<9>

Status Code: -50808

 

 

The call stack is below

 

at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.CheckWithName(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* , tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* pName)
at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.Check(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* , tTask* t)
at nNINETAI2005100.Read1DHelper<class nNIMSSAIL100::ApiTraits<class nNIMSSAIL100::DotNetApi>,class nNIMSSAIL100::AnalogRead,double>(Task task, tNumChannels channels, Int32 samplesPerChannel, tNumLines lines, Double timeout, Double[]& buffer, ReallocationPolicy policy, Int32& actualNumberOfSamplesRead, Boolean interleaved)
at NationalInstruments.DAQmx.Internal.AnalogMultiChannelReaderImpl.ReadSingleSample()

 

We have been using the NI's DAQmx DLL version 20.0.45.49152 and our .Net C# code is a below. on the click of the button the below code is executed. The error is raised at the line double[] data = reader.ReadSingleSample(); where we try to read the single sample of the voltages we sent through the channels as mentioned below.

 

using (DAQmxTask = new NationalInstruments.DAQmx.Task())
{
DAQmxTask.Stream.Timeout = -1;
Dictionary<string, string> channels = new Dictionary<string, string>();

channels.Add("MinusP1Delta", "Dev1/ai45");
channels.Add("PlusP1Delta", "Dev1/ai43");
channels.Add("PlusP2Delta", "Dev1/ai44");
channels.Add("VdataLo", "Dev1/ai55");
channels.Add("HdataLo", "Dev1/ai56");
channels.Add("InjectLo", "Dev1/ai49");
channels.Add("RefreshLo", "Dev1/ai54");
channels.Add("SelectLo", "Dev1/ai50");
channels.Add("ResetGLo", "Dev1/ai53");
channels.Add("Minus12V", "Dev1/ai60");
channels.Add("VSS", "Dev1/ai36");
channels.Add("EPI", "Dev1/ai38");
channels.Add("VclkLo", "Dev1/ai51");
channels.Add("HclkLo", "Dev1/ai52");
channels.Add("MinusEPI", "Dev1/ai57");
channels.Add("Minus10Vref", "Dev1/ai59");
channels.Add("Plus10Vref", "Dev1/ai34");
channels.Add("ResetDHi", "Dev1/ai42");
channels.Add("Minus5VPa", "Dev1/ai58");
channels.Add("Plus15VPa", "Dev1/ai33");
channels.Add("Plus16V", "Dev1/ai32");
channels.Add("Minus16V", "Dev1/ai62");
channels.Add("Plus10V", "Dev1/ai35");

foreach (KeyValuePair<string, string> channel in channels)
{
      
         DAQmxTask.AIChannels.CreateVoltageChannel(channel.Value, "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts);
         DAQmxTask.Timing.ConfigureSampleClock("", Convert.ToDouble(100000), SampleClockActiveEdge.Rising,                                       SampleQuantityMode.ContinuousSamples, 100000);
}
AnalogMultiChannelReader reader = new AnalogMultiChannelReader(DAQmxTask.Stream);
DAQmxTask.Control(TaskAction.Verify);
double[] data = reader.ReadSingleSample();

}

 

Please let us know if there is anything wrong with the code?  Basically the error is happening when we have the combination of channels as mentioned above. If we remove some of the channels for example Dev1/ai59 or Dev1/ai35 there is no error.

0 Kudos
Message 1 of 1
(1,348 Views)