Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Unknown Error received from Labjack

U12 unknown error

  • Please log in to reply
3 replies to this topic

#1 timroberts

timroberts
  • Members
  • 2 posts

Posted 27 January 2014 - 12:05 PM

Hello,

 

I'm using a Labjack U12 and VB 2010 express. I'm occaisonally getting an "Unknown error" from my labjack during a stream read. There doesn't seem to be much documentation on the error code "unknown error" so I was hoping for a bit more information.

 

What is this error? What are possible causes of this error? I'm probably doing something that the Labjack does not expect, but I'm not sure even to begin where to look.

 

Any help with this is appreciated.



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 January 2014 - 02:19 PM

Errorcode 1 generally means some error condition we did not think was possible, and thus it is unknown.
 
Call GetDriverVersion at the beginning of your program to make sure it is using version 1.21.
 
Are you actually getting errorcode 1 returned by AIStreamRead, or some other errorcode that is interpreted as unknown by GetErrorString?
 
Do you get the error on your first call to AIStreamRead, or just somewhere in the middle of streaming?
 
Do you get the error from LJstream.exe?
 
What OS?  Is the OS 32-bit or 64-bit?  Is your application 32-bit or 64-bit?
 
Are you using direct DLL calls or the OCX?
 
Are you doing any threading?  Does the problem go away if you have a simple linear program?
 
Does it make a difference whether you pass -1 to the stream calls or the specific Local ID?
 
Do you have only 1 U12 connected?
 
 
 
Here is the chunk of code from the U12 driver that can throw that error:
	//Claim the streamInfo structure and make sure it belongs to this localID
	result = WaitForSingleObject(hMutex,1000L);
	if(result == WAIT_OBJECT_0)
	{
		if(streamInfo.localID == localID)
		{
			//we claimed the mutex and it is available
			errorcode = NO_ERROR_LJ;
		}
		else  //wrong localID
		{
			errorcode = UNKNOWN_ERROR_LJ;
			if(streamInfo.localID == -1)
			{
				if(streamInfo.errorcode)
				{
					errorcode = streamInfo.errorcode;
				}
			}
			ReleaseMutex(hMutex);
			CloseHandle(hMutex);
			for(m = 0; m < 4096; m++)
				free(tempBuff[m]);
			free(tempBuff);
			return errorcode;
		}	//end else wrong localID
	}


#3 timroberts

timroberts
  • Members
  • 2 posts

Posted 27 January 2014 - 03:06 PM

I'll try and respond to these one at a time
 
"Call GetDriverVersion at the beginning of your program to make sure it is using version 1.21."
This will be difficult, since the system this is part of is at our customer's now. I'm able to code the software, but for now, I'm without access to the unit itself.
 
"Are you actually getting errorcode 1 returned by AIStreamRead, or some other errorcode that is interpreted as unknown by GetErrorString?"

My code performs a stream read and preserves the error code. The code then looks up the error string. Again since the unit itself is at the customer's that's all I've got to go on for now.

 

"Do you get the error on your first call to AIStreamRead, or just somewhere in the middle of streaming?"

I perform many calls to streamread over the course of the program. Almost all of them perform correctly.

 

"Do you get the error from LJstream.exe?"

The unit is at the customer's, but when I had the Labjack here and tried LJstream.exe it performed flawlessly.

 

"What OS?  Is the OS 32-bit or 64-bit?  Is your application 32-bit or 64-bit?

I'm running it on Windows 7 64 bit. It is written in VB 2010 express and is written for an x86 architecture.

 

"Are you using direct DLL calls or the OCX?"

I'm using ljackuw.dll, not the OCX.

 

"Are you doing any threading?  Does the problem go away if you have a simple linear program?"
The program is single threaded.
 
"Does it make a difference whether you pass -1 to the stream calls or the specific Local ID?"
This one intrigues me. I've only ever been passing it the local ID, but since there is only 1 labjack on the whole system, maybe it makes sense to try -1.
 
"Do you have only 1 U12 connected?"
Yes, only 1 U12 is connected.
 
I've gone over my code again, and noticed that in rare cases, it is possible to try a streamread and a streamclear without performing a streamstart first. Could this be one possible cause?
 
Thanks again for the assistance.


#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 January 2014 - 04:26 PM

I just ran AIStreamRead by itself and did indeed get errorcode=1, so that would seem to be your likely issue.





Also tagged with one or more of these keywords: U12, unknown error

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users