USB Connection: Can't load USB comm driver

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

Moderators: 99jonathan, roger, imaqine

USB Connection: Can't load USB comm driver

Postby icemadsen » Sat Mar 20, 2010 6:28 pm

Hi!

I am trying to develop a program on my computer, that communicates with the NXT over USB, but I can't get it to work.
I've tried to run the samples (USBSend and USBReceive), but it does not connect and gives the message: Cannot load USB comm driver.

I can download programs to the NXT by USB, both from Eclipse and command-line and can also use nxjbrowse with USB.

I am using Windows 7 32bit and LeJOS ver. 0.85.

Do you have any proposals on what to do?

//Kenneth Madsen
User avatar
icemadsen
Novice
 
Posts: 31
Joined: Tue Dec 08, 2009 11:41 am

Postby gloomyandy » Sat Mar 20, 2010 7:12 pm

look at the nxjpc.bat script. This sets the classpath and other vars to correctly run the PC side leJOS programs...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby icemadsen » Sat Mar 20, 2010 10:13 pm

Hi Andy

I already tried compiling the USBSend with nxjpcc and then run it with nxjpc - isn't that how I supposed to do?

I've have added an LogListener for the USBSend pcsample, and that caughts the "Failed to load USB comm driver" message and the program just returns "No NXT find using USB" even tough the NXT is attached and running the USBReceive program.

//Kenneth Madsen
User avatar
icemadsen
Novice
 
Posts: 31
Joined: Tue Dec 08, 2009 11:41 am

Postby gloomyandy » Sat Mar 20, 2010 10:34 pm

Very strange, does nxjbrowse work when run from the same command line session and as the same user? If so then take a look at that script and try and work out what is different. You could also try copying the nxjbrowse script and editing the copy to add in the USBSend smaple and see if that then works... Other things to check, look t your environment and make sure that NXJ_HOME points to the correct place and that the java command in your path is a 32 bit version not a 64 bit one...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby icemadsen » Sun Mar 21, 2010 10:58 am

It works!! :D

I copied the nxjbrowse.bat script into a nxjusb.bat script and modified it, as described below, the USBSend-sample worked flawlessly!

The line I edited in nxjusb.bat was:

java -Dnxj.home="%NXJ_HOME%" -DCOMMAND_NAME="nxjbrowse" -Djava.library.path="%NXJ_BIN%" -classpath "%NXJ_CP_TOOL%" lejos.pc.tools.NXJBrowser %*

And changed it to:

java -Dnxj.home="%NXJ_HOME%" -DCOMMAND_NAME="nxjbrowse" -Djava.library.path="%NXJ_BIN%" -classpath ".;%NXJ_CP_TOOL%" USBSend %*

I've highlighted the changes - also I had the USBSend.class located in the same directory as the nxjusb.bat.

Thank you very much, Andy!

Just to make sure - the %* in the previous command forwards every argument to the Java-file, right?
User avatar
icemadsen
Novice
 
Posts: 31
Joined: Tue Dec 08, 2009 11:41 am

Postby gloomyandy » Sun Mar 21, 2010 11:19 am

Hi,
Glad to hear you have it working! If you have time it would be great if you could work out why the nxjpc script is not working for you. In theory your new script and nxjpc should be doing the same sort of thing! If you can work out what is wrong we can fix it in the next release...

All the best

Andy

PS Yes the %* is to pass through the command line args...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby icemadsen » Sun Mar 21, 2010 12:57 pm

I've done a compare on the two files and the only line that differs is this:

java -Dnxj.home="%NXJ_HOME%" -Djava.library.path="%NXJ_BIN%" -Xbootclasspath/a:"%NXJ_CP_TOOL%" %*

If I remove the -Xbootclasspath/a:"%NXJ_CP_TOOL%" argument and add -classpath ".;%NXJ_CP_TOOL%", it works with nxjpc

I don't know what the -Xbootclasspath/a part is doing, but if it is passed along together with the -classpath part, then the program does not work either.

//Kenneth Madsen
User avatar
icemadsen
Novice
 
Posts: 31
Joined: Tue Dec 08, 2009 11:41 am

Postby gloomyandy » Sun Mar 21, 2010 1:50 pm

Hi,
Thanks for the info. We'll take a look and try and work out what is the best way to address this...

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


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

more stuff