12 October 2008

X-CTU with Linux

Update: There's been a few reports that digi's X-CTU has been targeted for a malware exploit.  I personally have had zero problems but wanted to share the warning.  Practice safe coding!

There is a Python X-CTU replacement that works well.  Read about it at the RoboSci Blog:

http://www.dudek.org/blog/180 

Gregory Dudek's download link for his xbee-gdxctu.py tool is midway down the article.  Also read the article comments for a list of required python libraries.

-----------------------------------------------------------------

X-CTU is the utility to use for setting up an Xbee. What the acronym stands for is a mystery. What isn't a mystery is that it's a Windows app.  

This quick post will explain how to run X-CTU with linux.  If you find this post useful, please consider leaving a comment.

From Digi's Knowledge Base:
X-CTU is a Windows-based application provided by Digi. This program was designed to interact with the firmware files found on Digi’s RF products and to provide a simple-to-use graphical user interface to them.

X-CTU operates strictly for Windows Platforms. The versions of Windows which are compatible with X-CTU are as follows:
Windows 98, 2K, ME, XP

X-CTU is NOT compatible with the following versions and Operating Systems:
Window 95, NT; Unix; Linux
Bummer. I ran the installer with Wine and the app seems to run but X-CTU can't find my USB COM port. I spent a few minutes on it and gave up.

For the past week, I've been booting into Windows XP to use X-CTU. That got old really quick so I went back to see if I could get X-CTU to work in Linux.

After running the X-CTU with Wine, the program is installed in

~/.wine/drive_c/Program Files/Digi-MaxStream/XCTU


Save up to 70% on Inkjet and Toner Supplies!
Just go there and run the X-CTU.exe program and it'll start right up. Except it won't recognize your USB serial port.
When I plug in the Xbee Explorer USB to my PC, it shows up as

/dev/ttyUSB0

A quick way to see your port name is to run this command:

ls -lt /dev/tty*

This will list all serial devices sorted by date with the newest at top.
I just needed a way for Wine to see that port.

While poking around in the .wine folder (see the above image), I noticed a folder called dosdevices. According to the Wine wiki, this folder holds device info.

For Wine to see a COM port, you simply have to create a soft link in the Wine dosdevices folder which is:

~/.wine/dosdevices

I created the soft link like this and randomly chose a high port (com10):
ln -s /dev/ttyUSB0 ~/.wine/dosdevice/com10

Then run X-CTU, go to the PC Settings Tab, User Com Ports Tab, type your new com soft link (in my example above, I used com10) in the Com Port Number box, and click Add.


Works great. Or at least it acts the same way as it does under Windows.
In the Select Com Port list, select your port, setup the correct serial params and click Test.

You should see a dialog that says "Communications with Modem .. OK". If not, make sure that your soft link points to the correct com device. Another occasional problem is the firmware version that is loaded on the Xbee.

If the API firmware is installed, you need to go to the PC Settings tab and click the Enable API checkbox.

My only problem now is that X-CTU doesn't remember the User Com Ports between runs so I have to re-enter it each time. Minor annoyance since it's easier the booting into Windows each time.

BTW - The X-CTU User Manual can be found here.

What do you think? Leave a comment.

22 comments:

david said...

Thank you! I really really really hate having to reboot into windows each time I need to test my xbee. This is great!

steve said...

hey do you have any thots on making this work on OSX.

after finding your site, I downloaded wine and x-ctu. i can get them to start, soft linked the ports.

i can talk to a radio in terminal mode inside X-CTU but I can't get the feature in modem configuration to work.

any ideas most appreciated.

lizard43 said...

hey steve -
what's not working in modem config? read/write/restore/save/load/download?
do you get an error msg?

read/write/save/load works fine for me, restore doesn't.

download won't work either but haven't spent anytime investigating.

since terminal mode works, then you must not have the API firmware loaded, so make sure you do not have "enable api" checked on pc settings.

ggarza said...

Excellent! works great! thank you!

dharmen said...

how to develop an graphical user inerface which direct gives input to xctu so that we can easily operate it????

Anonymous said...

thanks is really clear and succesfull this tutorial, one more time tanks so much.

Anonymous said...

Thanks. This posting really helped me out. Thanks again.

Using Ubuntu 8.04.

jamie said...

Hi, I was having a problem with the modem configuration abilities. I cannot get x-ctu to read my xbee correctly. I have an already programmed xbee that I am trying to read on Linux. I can plug it into windows and read the xbee perfectly. I have installed wine and the xtcu without problems on linux. I have added the soft line and been able to test the connection and have that work fine too. I then try to read the xbee in modem configurations and it does not read the xbee. I have installed all of the firmware that i can manually because the update from the web does not work. The xbee is running xbp24 10e6. Any suggestions?

lizard43 said...

Hi Jamie -
It's been quite awhile since I've used X-CTU so I'm going from memory. It sounds like you're doing the right thing.

I recall a similar problem that only resolved itself when I re-loaded the xbee firmware from X-CTU on Linux.

Have you dbl-checked that you have the API checkbox set correctly?

good luck

Mitchel Humpherys said...

This is awesome! Thank you!

Anonymous said...

Works fine, thanks a lot!

Surface Tension said...

I followed your instructions, but get an "Unable to open com port error" when I try to connect. Any suggestions?

lizard43 said...

Have you tested your xbee on a diff OS like Windows? Have you verified that it works?

On linux, without having your xbee plugged in, for command line do a: ls -lt /dev/tty*

This will list all serial devices sorted by date with the newest at top.

Then plug in your xbee and again do a: ls -lt /dev/tty*

Do you see a new device?

When you create your softlink, have you tried other com numbers?

Kat said...

@Surface Tension I was having the same trouble but found a solution in this article:

http://www.noodlefactory.co.uk/~nick/wu-lee/XbeeConfig

@lizard43 Thank you so much for these great instructions.

Alfredo said...

X-CTU
Stands for "XBee Configuration & Test Utility"

Thanks.

Anonymous said...

Thank you very much. It works. Two remarks:

i) ln -s /dev/ttyUSB0 ~/.wine/dosdevice/com10 must be replaced by
ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com10

ii) after typing COM10 into the field "COM port number" you have to select (check) this port under "select com port" before using "test/query".

Anonymous said...

Great work, thanks!

Winter said...

Under OSX you will need to add the symlink in ~/Library/Application Support/Wine/prefixes/X-CTU/dosdevices/COM4 etc

I can not get the firmware updates to work though.

Anonymous said...

Works fine under Ubuntu 11.10. Thank you!

Jay Chakra said...

When I plug in my Xbee it doesn't even show up. I have done all the steps earlier told :( please help Thanks in advance

Anonymous said...

hi..
i have problem with the code to send data from pc to xbee using serial port i have written using matlab its nt working plz someone post the code in c or matlab..
thankyou

Anonymous said...

Although I don't have the same issues, I just set up a little laptop running XP for the configuration, but your pointers about failed module communication and making sure the API box is checked, helped me alot, as I am a novice. Just wanted to thank you for taking the time to write this. Helped me alot! THANKS!