LiNuXT: Linux + NXT

Since transitioning to Ubuntu Linux, I’ve continued working on my Lego NXT projects. I spent several hours figuring out how to configure my machine to write, debug, and upload code to the NXT brick. I found several sites and message board posts, each detailing a specific step in the process. I thought it would be a good idea to bring all of this information together and hopefully make it easy for anyone else who wishes to follow in my footsteps.

The entire process consists of setting up a Windows emulator (WINE), installing an IDE (BricxCC), and installing and running a communications tool between linux and the brick (Talk2NXT).

Lego NXT Ubuntu Linux from Jason Atwood on Vimeo.

1.) install WINE

sudo apt-get install wine

2.) install bricxCC
a. download from sourceforge: http://sourceforge.net/projects/bricxcc/files/bricxcc/

[UPDATE]At some point, Ubuntu required that all software not coming from a trusted repository be blocked unless the permissions were changed to “executable”. Explanation here. The only change is that the bricxccinstall.exe file will need to be chmod777’ed.[/UPDATE]
b. right click and select “Open with ‘Wine Windows Loader Program’ ”
c. complete the Windows-like installer

At this point, in the BricxCC GUI, try to compile some code and save it as a .NXT. If this works then you’re ready talk to the Brick.

3.) get Talk2NXT
apt-get install g++ libusb-dev
wget http://www-verimag.imag.fr/~raymond/edu/lego/t2n/t2n-0.2.src.tgz
tar -xzvf t2n-0.2.src.tgz
cd t2n-0.2.src
make
mv obj/t2n /usr/local/bin/

4.) physically connect the NXT Brick via USB, and turn on the Brick

5.) test connection

t2n -i
NXT INFOS ###############
protocol version=1.124 firmware version=1.1
NXT Name: NXT
Blutooth address: 16:53:00:23:74:00
Blutooth signal: 0
Free user flash: 115536

6.) not necessary, but list the files on the NXT Brick

t2n -ls

7.) Generate .rxe files.
If you have any files uploaded from before (maybe under a Windows usage) you’ll see that the program files are .rxe even though BricxCC saves files as .nxc. We now need to generate .rxe files from the code, so that the Brick will know what to do. When you upload through BricxCC in Windows, it autmatically generates a .rxe file from the .nxc. We can do this easily during compiling. In BricxCC GUI

Edit->Preferences->General->Save compiler output

8.) Upload a .rxe file, in terminal

t2n -put do_something.rxe

9.) List files on the brick to confirm that the upload was completed

t2n -ls

I certainly can not claim any credit for this except for bringing it all together. Credit goes to:

8 thoughts on “LiNuXT: Linux + NXT

  1. Hi, I am having trouble accessing the page in france, the t2n file. Do you know if it is still accessible. If not, do you know of a mirror site.

    Thanks

    Corey

  2. t2n -put helloworld.rxe
    Error :
    usbnxt: upload: can’y initiate upload (reply=0x02,status=0xffffff92,error=0x0000)

  3. At step 5, I’m getting:

    Error :
    usbnxt: usbmisc: fails to set config, errno=-1 (cf=1 vendor=0x0694 product=0x0002)

    I’m running Ubuntu 9.04, nxt fw 1.29.

    BTW, everything upto step 4 was working beautifully…

  4. I was having exactly the same problem. usbnxt: usbmisc: fails to set config, errno=-1 (cf=1 vendor=0x0694 product=0x0002) I was curious, and tried putting sudo in front of the whole thing. It works!
    try:
    sudo t2n -ls

Leave a Reply

Your email address will not be published. Required fields are marked *