Failed to load USB comms driver: Cannot load USB driver

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

Failed to load USB comms driver: Cannot load USB driver

Postby ChrisB01 » Sun Feb 07, 2010 10:11 am

I recently installed the updated lejos 8.5 on my windows xp machine using the installer, I was using it successfully but recently I just haven't been able to upload anything to the nxt, all i get is the error shown below from both the command line and the eclipse plugin. The only thing that might have caused this problem is I deleted the nxj.cache file in my home directory accidentally while doing some cleaning up recently, I realised I had at the time, but thought nothing of it as its just a cache file. Could this be causing my problems,

I have also tried removing the spaces in my environmental variables, to check if this is causing the problem.

Chris

Error from command line:
Code: Select all
C:\Documents and Settings\Christopher\My Documents\Computing\Robotics\Lejos NXJ
Workspace\Robocup Rescue\bin>nxj -r UploadTest
leJOS NXJ> Linking...
leJOS NXJ> Uploading...
leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
leJOS NXJ> Searching for any NXT using Bluetooth inquiry
leJOS NXJ> Search Failed: BluetoothStack not detected
leJOS NXJ> Failed to find any NXTs
leJOS NXJ> Failed to connect to any NXT
an error occurred: No NXT found - is it switched on and plugged in (for USB)?


Error from eclipse:
Code: Select all
Failed to load USB comms driver: Cannot load USB driver
Failed to find any NXTs
Failed to connect to any NXT
Something went wrong when trying to upload the program to the brick


Output form the set command:
Code: Select all
C:\Documents and Settings\Christopher\My Documents\Computing\Robotics\Lejos NXJ
Workspace\Robocup Rescue\bin>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Christopher\Application Data
CLASSPATH=C:\Program Files\Java\jdk1.6.0_04\lib;C:\Program Files\Java\jdk1.6.0_0
4\jre\lib\rt.jar;C:\Program Files\Java\freetts-1.2.1-bin\freetts-1.2.1\lib\freet
ts.jar;C:\Program Files\Java\jre1.6.0_05\lib\ext\QTJava.zip;C:\Program Files\Jav
a\watij\lib;C:\Program Files\Java\watij;C:\PROGRA~1\LEJOSN~1\3rdparty\lib\;C:\PR
OGRA~1\LEJOSN~1\lib;
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=BAINES_FAMILY_2
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
GTK_BASEPATH=C:\PROGRA~1\GTK
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Christopher
INCLUDE=C:\Program Files\GTK\INCLUDE;C:\Program Files\GTK\INCLUDE\GTK-2.0;C:\Pro
gram Files\GTK\INCLUDE\GLIB-2.0;C:\Program Files\GTK\INCLUDE\PANGO-1.0;C:\Progra
m Files\GTK\INCLUDE\CAIRO;C:\Program Files\GTK\INCLUDE\ATK-1.0;C:\Program Files\
GTK\INCLUDE\GTKGLEXT-1.0;C:\Program Files\GTK\LIB\GTK-2.0\INCLUDE;C:\Program Fil
es\GTK\LIB\GLIB-2.0\INCLUDE;C:\Program Files\GTK\LIB\GTKGLEXT-1.0\INCLUDE;C:\Pro
gram Files\GTK\INCLUDE\LIBGLADE-2.0;C:\Program Files\GTK\INCLUDE\LIBXML2;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_04
LIB=C:\Program Files\GTK\LIB;
LOGONSERVER=\\BAINES_FAMILY_2
NUMBER_OF_PROCESSORS=2
NXJ_HOME=C:\PROGRA~1\LEJOSN~1
OS=Windows_NT
Path=C:\PROGRA~1\LEJOSN~1\bin;C:\PROGRA~1\GTK\bin;C:\Program Files\Windows Resou
rce Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Progr
am Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_04\
bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\MinGW;C:\Program Files
\Graphv;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0409
ProgramFiles=C:\Program Files
PROMPT=$P$G
QTJAVA=C:\Program Files\Java\jre1.6.0_05\lib\ext\QTJava.zip
SESSIONNAME=Console
SonicCentral=C:\Program Files\Common Files\Sonic Shared\Sonic Central\
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\CHRIST~1\LOCALS~1\Temp
TMP=C:\DOCUME~1\CHRIST~1\LOCALS~1\Temp
USERDOMAIN=BAINES_FAMILY_2
USERNAME=Christopher
USERPROFILE=C:\Documents and Settings\Christopher
windir=C:\WINDOWS
ChrisB01
Advanced Member
 
Posts: 189
Joined: Sat Mar 15, 2008 12:19 pm
Location: UK

Re: Failed to load USB comms driver: Cannot load USB driver

Postby Shawn » Sun Feb 07, 2010 10:39 am

ChrisB01 wrote: 
Code: Select all
C:\Documents and Settings\Christopher\My Documents\Computing\Robotics\Lejos NXJ
Workspace\Robocup Rescue\bin 

 
Code: Select all
Failed to load USB comms driver: Cannot load USB driver

 


I don't think it's the deleted cache file.

Um, I'm not sure where the driver would be in windows. Do you have a jfantom.dll in your lejos_nxj/bin?

:arrow: [edit] :idea: What do you get if you add echo %NXJ_HOME% to your nxj.bat script. What dir does is show and is jfantom.dll there?

Also if the file seems there, can you try putting this in a sample java class (just put it in main) and run it -- it should tell us why the driver isn't loading.

Code: Select all
System.loadLibrary("jfantom");


To run it actually, I'd copy the nxj.bat script, rename it to nxj_test, and change the last line to be the following (note: I am assuming here that test is the class you want to run -- i.e. you compiled test.java and have a test.class)

Code: Select all
java -Dnxj.home="%NXJ_HOME%" -DCOMMAND_NAME="nxj" -Djava.library.path="%NXJ_BIN%" -classpath "%NXJ_CP_TOOL%" test


then just run nxj_test.bat however you do that under windows.

I haven't tested this but think it should tell us why the driver isn't loading within your environment, so please try to keep it the same -- i.e. nxj_test in the same dir where nxj is, and your class in ...Workspace\Robocup Rescue\bin 
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby ChrisB01 » Sun Feb 07, 2010 6:30 pm

Thanks Shawn, first off I do have jfantom.dll in C:\Program Files\LeJOS NXJ\bin. I tried following your instructions but I think the error I get back is unconnected with the problem I am having. I did however in a fresh eclipse project try running the code you suggested and it produced the second error (included below).

Chris

1st Error:
Code: Select all
C:\Documents and Settings\Christopher\My Documents\Computing\Robotics\Lejos NXJ
Workspace\Robocup Rescue\bin>dir
 Volume in drive C has no label.
 Volume Serial Number is 08F8-CBAB

 Directory of C:\Documents and Settings\Christopher\My Documents\Computing\Robot
ics\Lejos NXJ Workspace\Robocup Rescue\bin

07/02/2010  18:19    <DIR>          .
07/02/2010  18:19    <DIR>          ..
06/02/2010  17:49             1,643 AddressChange.class
02/02/2010  17:46             5,840 AddressChange.nxj
06/02/2010  17:49             1,014 LCDUI$1.class
06/02/2010  17:49               924 LCDUI$2.class
06/02/2010  17:49             8,168 LCDUI.class
06/02/2010  17:49             3,811 LineLeader.class
06/02/2010  17:49               725 LineLeaderTest.class
06/02/2010  17:49               683 PIDCTest.class
06/02/2010  17:50             8,941 Rescue.class
07/02/2010  09:59            19,612 Rescue.nxj
06/02/2010  17:49             2,607 RescueV1.class
06/02/2010  17:49             1,671 RescueV2.class
06/02/2010  17:49             2,616 RescueV3.class
06/02/2010  17:49             2,493 RescueV4.class
29/01/2010  16:23            15,916 RescueV4.nxj
06/02/2010  17:48            19,612 RescueV5.nxj
07/02/2010  09:14                 0 resuce.nxj
02/02/2010  17:38             5,676 SensorAddressChange.nxj
06/02/2010  17:49             1,391 SensorMuxTest.class
07/02/2010  09:22             5,892 SensorMuxTest.nxj
06/02/2010  17:49             2,365 Splasher.class
30/01/2010  15:26             8,176 TachoPilotCalibration.nxj
07/02/2010  18:16               447 test.class
06/02/2010  17:49               936 TPCalibration.class
30/01/2010  15:52             8,264 TPCalibration.nxj
06/02/2010  17:58               460 UploadTest.class
07/02/2010  10:00             3,924 UploadTest.nxj
              27 File(s)        133,807 bytes
               2 Dir(s)  11,092,815,872 bytes free

C:\Documents and Settings\Christopher\My Documents\Computing\Robotics\Lejos NXJ
Workspace\Robocup Rescue\bin>nxj_test
Exception in thread "main" java.lang.NoClassDefFoundError: test
Caused by: java.lang.ClassNotFoundException: test
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: test.  Program will exit.


2nd Error:
Code: Select all
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\leJOS NXJ\bin\jfantom.dll: Can't find dependent libraries
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at java.lang.ClassLoader.loadLibrary0(Unknown Source)
   at java.lang.ClassLoader.loadLibrary(Unknown Source)
   at java.lang.Runtime.loadLibrary0(Unknown Source)
   at java.lang.System.loadLibrary(Unknown Source)
   at test.main(test.java:7)
ChrisB01
Advanced Member
 
Posts: 189
Joined: Sat Mar 15, 2008 12:19 pm
Location: UK

Postby Shawn » Sun Feb 07, 2010 9:43 pm

ChrisB01 wrote:
C:\Documents and Settings\Christopher\My Documents\Computing\Robotics\Lejos NXJ
Workspace\Robocup Rescue\bin>nxj_test
Exception in thread "main" java.lang.NoClassDefFoundError: test
Caused by: java.lang.ClassNotFoundException: test
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: test. Program will exit.[/code]



Yeah, we'll need to set the classpath.

Can you try
Code: Select all
java -Dnxj.home="%NXJ_HOME%" -DCOMMAND_NAME="nxj" -Djava.library.path="%NXJ_BIN%" -classpath "." test


and if that doesn't work, just hard code the path in our test script.


ChrisB01 wrote:
2nd Error:
Code: Select all
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\leJOS NXJ\bin\jfantom.dll: Can't find dependent libraries
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at java.lang.ClassLoader.loadLibrary0(Unknown Source)
   at java.lang.ClassLoader.loadLibrary(Unknown Source)
   at java.lang.Runtime.loadLibrary0(Unknown Source)
   at java.lang.System.loadLibrary(Unknown Source)
   at test.main(test.java:7)


I suspect this is as eclipse was not told where to find jfantom.dll

The lejos scripts do tell java where to find the .dll though so we may be looking at a different problem.

You do have the lego firmware installed right and haven't touched that?
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Re: Failed to load USB comms driver: Cannot load USB driver

Postby skoehler » Mon Feb 08, 2010 5:47 pm

Are the driver installed, or does the NXT appear as an unknown device in the device manager?

You have to install this driver in order for recent leJOS version to work:
http://www.robotc.net/download/nxt/
skoehler
leJOS Team Member
 
Posts: 1115
Joined: Thu Oct 30, 2008 4:54 pm

Postby ChrisB01 » Tue Feb 09, 2010 4:53 pm

Problem solved, I had the driver installed through nxt-g however this had broken (still don't know why) and taken the drivers with it. My computer still recognised the nxt as a lego nxt (hence I thought the drivers were ok) but trying to start nxt-g gave a file missing error. Problem no fixed with a fresh install of nxt-g.

Thanks again for all your time and effort,

Chris
ChrisB01
Advanced Member
 
Posts: 189
Joined: Sat Mar 15, 2008 12:19 pm
Location: UK

Postby Jonathan » Fri Feb 12, 2010 2:04 pm

Hi,

So I'm getting the same error message. I first today started trying set things up for the first time. At first I forgot to install the USB-drivers at all and got the "Failed to load USB comms driver: Cannot load USB driver"-message when trying to flash the firmware. So I installed the drivers and successfully installed Lejos on the nxt-brick. It looks like it is working fine. So obviously some commands work at least.

The problem is that can't upload any programs to the nxt. I've tried to reinstall but it didn't help. I am running windows 7 64bit. Java SE 6 update 18 64-bit. Figured it could be something with the 32-64bit compatibility so I tried to put the "-d32" option in the .bat-files, didn't help.

The nxt is properly identified in the device-manager.

echo %NXJ_HOME% gives the C:\Program Files (x86)\leJOS NXJ and the jfantom.dll is in C:\Program Files (x86)\leJOS NXJ\bin
shouldn't be the problem right?

So I wrote a little program to try and load the jfantom.dll and this is what I got. (I ran it simply by using javac and java in the cmd)

Code:
Code: Select all
public class test {
        public static void main (String[] args) {
      System.loadLibrary("jfantom");
        }
}


Result
Code: Select all
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files (x86
)\leJOS NXJ\bin\jfantom.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at test.main(test.java:3)


So it appears that it's something about the 32-bit, 64-bit compatibility? Where do I go from here? An older computer? :wink:
Jonathan
New User
 
Posts: 6
Joined: Fri Feb 12, 2010 1:48 pm

Postby gloomyandy » Fri Feb 12, 2010 2:27 pm

Hi,
You need the 32bit version of the Java JRE which you can get here:
http://java.sun.com/javase/downloads/index.jsp

Make sure you choose the Windows version not the Windows X64...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby Jonathan » Fri Feb 12, 2010 2:34 pm

Hi, I already have 32bit JRE. So that's not it.
Jonathan
New User
 
Posts: 6
Joined: Fri Feb 12, 2010 1:48 pm

Postby Jonathan » Fri Feb 12, 2010 2:43 pm

Actually, it kinda looks like I have both. Though I only installed the 32-bit version. I remember because I did it all today.

These are my three entries in "programs and features"

Java(TM)6 Update 18 (Size 94,4, Version 6.0.180)
Java(TM)6 Update 18 (64-bit) (Size 90,4, Version 6.0.180)
Java(TM)6 SE Development Kit 6 Update 18 (64-bit) (Size 145, Version 1.6.0.180)

Oh, and these are the LEGO entries:

LEGO MINDSTORMS NXT Driver for x64 Version :1.16.769
leJOS NXJ Version : 0.8.5
Jonathan
New User
 
Posts: 6
Joined: Fri Feb 12, 2010 1:48 pm

Postby gloomyandy » Fri Feb 12, 2010 2:50 pm

If you have it then you are not using it. The error you posted is the result of using a 32bit dll with a 64bit JRE. Are you sure that your path points to the 32bit version? I don't think the -d32 works on windows. Try uninstalling your JRE (s) and then only install the 32bit version. I run this configuration all of the time on Windows 7 64bit...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby Jonathan » Fri Feb 12, 2010 3:05 pm

Hi, my paths point to the JDK not the JRE. I only have 64-bit JDK, should I change that?

these are my paths:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_18

Path=C:\Program Files (x86)\leJOS NXJ\bin;C:\Windows\system32;C:\Windows;C:\Wind
ows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\M
ATLAB\R2010a\bin;C:\Program Files\LEGOUSBDRIVER\WinNT\Bin;C:\Program Files\Java\
jdk1.6.0_18\bin

My guess is that the 64-bit JRE followed in some way with the 64-bit JDK. What exactly do you have installed when looking in the control panel?
Jonathan
New User
 
Posts: 6
Joined: Fri Feb 12, 2010 1:48 pm

Postby gloomyandy » Fri Feb 12, 2010 4:31 pm

Hi,
Yes you need the 32bit SDK not the 64bit one...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby Jonathan » Fri Feb 12, 2010 6:17 pm

Ok sweet. Finally it works. Here's what I had to do.

Installed the 32-bit JDK and pointed the paths there.
Still didn't work.

Uninstalled the 64-bit JRE and JDK entirely.
Still didn't work.

Reinstalled the USB-drivers again.
It works.


I did try reinstalling the USB-drivers several times before, so im guessing they're installing some 64bit version when they see that I have 64-bit Java? or something like that?

TY Andy!
Jonathan
New User
 
Posts: 6
Joined: Fri Feb 12, 2010 1:48 pm

Re: Failed to load USB comms driver: Cannot load USB driver

Postby pcProfie » Thu Aug 02, 2012 4:30 pm

can i use a 64bit of eclipse?
pcProfie
New User
 
Posts: 12
Joined: Thu Aug 02, 2012 4:18 pm

Next

Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff