From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

usbser.sys BSOD When Arduino sending data over USB

Thank you for viewing this thread. 

I am new to programming (in both C and LabVIEW) so I am certain that I have not written my coding in the most efficient way however it appears to be doing what I want. I am using and Arduino Uno along with a DAC (MCP4921) and a ADC (MCP3304). The ADC is taking readings of the voltage output from the DAC and temperature readings. These are just to simulate readings I will be taking at a later date and check that the project is working. 

I have written and deployed some code in the Arduino IDE 

#include <SPI.h> // necessary library
#include <MCP3304.h>
int del=15; // used for various delays                                                    //Changed del=1 to del=0
MCP3304 adc1(9);  //create an instance with pin 9 as CS
float tempreading;
float vtemp;
int temperatureC;
int reading;
float voltage;

word outputValue = 0; // a word is a 16-bit number
byte data = 0; // and a byte is an 8-bit number
void setup()
{
  //set pin(s) to input and output
  pinMode(10, OUTPUT);
  SPI.begin(); // wake up the SPI bus.
  SPI.setBitOrder(MSBFIRST);
  Serial.begin(115200);
}

void loop()
{
  for (int a=0; a<=1023; a++) //loops through increasing voltage from -2.5v to +2.5v
  {
    outputValue = a*4; //reduce number of readings needed
    digitalWrite(10, LOW);
    data = highByte(outputValue);
    data = 0b00001111 & data; //0b signifies that value to follow is binary then 00001111 gets upper nibble
    data = 0b00110000 | data; //0b signifies that value to follow is binary then 00110000 function set cmd
    SPI.transfer(data);
    data = lowByte(outputValue);
    byte x = SPI.transfer(data);
    digitalWrite(10, HIGH);

    reading = adc1.readSgl(0);    //read data from CH0 in SGL mode
    voltage = reading / 4095.0 * 5.06;    //convert reading into a voltage from 0 to 5V
    voltage=voltage-2.5; //offset for output serial printed voltage
    Serial.print(voltage, 3);
    Serial.print(",");   


    tempreading = adc1.readAdc(1,1);    //read data from CH0 in SGL mode
    vtemp = tempreading / 4096.0 * 5.06;    //convert reading into a voltage from 0 to 5V
    temperatureC = (vtemp - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset to degrees ((voltage - 500mV) times 100)
    //Serial.print("Temperature ");
    Serial.print(temperatureC); 
    Serial.print(",");       
    Serial.println(); 

    delay(del);
  }
}

 This prints to serial the readings I obtain from the ADC.

I then built a VI that reads the data through USB via a COM channel.

The data is put into a buffer and extracted using Extract Numbers.vi. I was initially having problems with the buffer as my VI was not syncing at the same speed as the Arduino causing the same errors as seen in this thread (http://forums.ni.com/t5/LabVIEW/out-of-sync/td-p/1870983).

I added some code to the VI and Arduino code looking for the termination character performed by the code Serial.println(); to the VISA Configure Port. I also added the byte count for VISA to set how many bytes are read for each loop. 

Having done this, whilst the VI runs, I get a Blue screen of death after a minute or two with the driver info 'usbser.sys'. I am unsure what to do from here and any advice would be greatly appreciated. I am sorry if I have not mentioned all the necessary info, please do not hesitate to request it. I have attached my VI and Arduino code. 

Download All
0 Kudos
Message 1 of 12
(9,468 Views)

Hi ryanseg,

I think this may indicate a problem with the USB-Serial driver you are using. 

I can't see a reason why your LabVIEW code would cause this, and unfortunately I have no experience in C so I can't check over your Arduino code (although I have just bought one so hopefully I will learn soon!) 

...It could be possible that you are trying to send/receive more bytes than your USB-Serial driver can handle. 

I do believe - however - that you need to be using a specific script whilst communicating through LabVIEW. I don't think you can communicate to the arduino through LabVIEW whilst it is running a custom script. 

This is outlined in the following link:
https://www.labviewhacker.com/doku.php?id=learn:libraries:lifa:getting_started

 

I hope this helps,


Tim, CLD, CTD
National Instruments (UK & Ireland)
________________________________________________
"No problem is insoluble in all conceivable circumstances"
0 Kudos
Message 2 of 12
(9,421 Views)

Thank you for your reply Tim.h and sorry for it taking so long for me to get back to you!

The problem seems to have been resolved following my changing of the VISA read from Asyncronous to synchronous. 

Thank you for taking your time to aid in resolving the issue.

Kind Regards

Message 3 of 12
(9,376 Views)

Hello, I had the same problem, after some minutes running the application, Blue Screen appears. Your have helped me. I've solved de problem changing from Asynchronous to Synchronous all read and writes VISA blocks. I did this doing right click on the VISA block --> Synchronous I/O Model and choosing Synchronous.
Thank for your help!

Message 4 of 12
(9,091 Views)

I too was having crashes in usbser.sys.  Changing from Asyncronous to Syncronous in my VISA write/read nodes seems to have solved the problem.  Thank you for posting this.

Message 5 of 12
(8,521 Views)

Thanks a lot !!! My same problem is solved!! 

0 Kudos
Message 6 of 12
(8,107 Views)

Thank you so much.  

 

I spent a few weeks working through this problem with NI.  

 

This solved a "Driver_IQRL_Not_less_or_equal" problem that was caused when I read from three Arduino UNO's.

 

Thanks again,

A

0 Kudos
Message 7 of 12
(7,558 Views)

Thank You Robert.   You are Excellent. Our clients one month struggle becomes to end form your help

Spoiler
Heart
0 Kudos
Message 8 of 12
(7,537 Views)

I used both async or sync mode on VISA ,all have blue creen crash of usbser.sys

basicly I could not use arduino and VISA .

I used window 7 64 bits.

 

thanks

roseanne

0 Kudos
Message 9 of 12
(7,189 Views)

@Austin-Downey wrote:

Thank you so much.  

 

I spent a few weeks working through this problem with NI.  

 

This solved a "Driver_IQRL_Not_less_or_equal" problem that was caused when I read from three Arduino UNO's.

 

Thanks again,

A



I am also facing the same error.

Did you mean changing the  VISA Read to 'Synchronous' solved your problem?

Arun
0 Kudos
Message 10 of 12
(6,989 Views)