Xbee Programming on Linux

Stacey Sheldon edited this page Jan 28, 2013 · 1 revision

Configure Xbee via Linux

Installing the X-CTU utility in Wine

See also these related blog posts

Install and Configure Wine

Install Wine

sudo apt-get install wine

Run the Wine config tool to initialize your ~/.wine directory


When the GUI pops up, just hit "Ok" to close it again. It has already done what we wanted.

Configure a serial port mapping for Wine (These must be in lower case despite what the above links say)

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com5
ln -s /dev/ttyUSB1 ~/.wine/dosdevices/com6
ln -s /dev/ttyUSB2 ~/.wine/dosdevices/com7
ln -s /dev/ttyUSB3 ~/.wine/dosdevices/com8
ln -s /dev/ttyACM0 ~/.wine/dosdevices/com9

Note: com9 points at a ttyACM device. That should allow you to connect via the VCP/ComUsbBridge functionality available on some flight controllers.

Download X-CTU

Install X-CTU

Open a Wine file browser (not your usual Linux file browser)


Navigate to the folder containing the X-CTU exe file you downloaded (see above). Double click the exe file to start the install.

Note: You can also do the same thing through your normal linux file browser but you'll have to modify the file permissions to enable the "execute" bit before being able to run the installer.

Once the install is complete, you should be able to run X-CTU from "Applications/Wine/Programs/Digi/X-CTU". Make sure this works before proceeding.

If the application doesn't show up in your application menu, you can also run it directly from a shell like this:

wine 'C:/Program Files/Digi/XCTU/X-CTU.exe'

Updating the X-CTU firmware files

The X-CTU software doesn't seem to be able to update its firmware files from the web. I'm not sure why but here's how to update the files manually.

If you skip this step, your modem probably won't be properly detected by X-CTU.

Download the latest firmware files from the Digi Support site

Save the new firmware .zip file (called something like 82002356_C.zip) to your PC.

Note: You can also find old versions of the firmware on the Digi FTP server

Note: It is often helpful to download the older versions of the firmware for your modem so that X-CTU can read your previous settings.

Import the new firmware into X-CTU


  • Select the "Modem Configuration" tab
  • Click the "Download new versions..." button
  • Click the "File..." button
  • Browse to the firmware .zip file you downloaded in the previous section and click the "Open" button.

You should now see a dialog box telling you "Added configuration and firmware..." and you should see a list of new firmware images that are available.

Deprecated: Manual Update Mechanism

If importing the zip file doesn't work in the GUI, you can unzip the file and manually populate the new firmware files.

Note: You do not need to do this if the import worked in the GUI

cd /tmp
wget http://ftp1.digi.com/support/firmware/82002356_C.zip
unzip -d xbfw 82002356_C.zip
cp -nr xbfw/* ~/.wine/drive_c/Program\ Files/Digi/XCTU/update/

Restart X-CTU to let it notice all of the new firmware images

Using the Sparkfun XBee Explorer USB on Linux

Fixing a device ID conflict between XBee Explorer and Watts Up? Pro

See also this related bug report.

The sparkfun xbee to usb carrier board uses USB VID/PID = 0403:6001 which is the generic VID/PID for "Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC". This particular ID is auto-matched by upowerd (previously devkit-power) as a "Watts Up? Pro" via a specific udev rule:

  • /lib/udev/rules.d/95-devkit-power-wup.rules (old)
  • /lib/udev/rules/d/95-upower-wup.rules (new)

Because of this, upowerd takes over /dev/ttyUSB0 as soon as it is detected resulting in "Cannot open /dev/ttyUSB0: Device or resource busy" errors when trying to open the device in other applications.

You can see this happening in a couple places:

  • upower --monitor-detail (or devkit-power --monitor-detail)
    • This will show a "Watts Up?" device appearing when you plug in the xbee modem
  • udevadm monitor --property
    • This will show the extra UP_* (or DKP_*) attributes added by the upower udev rules

To fix this:

cat <<- \EOF | sudo tee '/etc/udev/rules.d/95-upower-wup.rules' > /dev/null
    # This rule is here to deliberately overlap (and thus nullify) the matching file under /lib/udev so that
    # VID:PID 0403:6001 is no longer treated as a "Watts Up? Pro". This should prevent it from being taken
    # over by devkit-power (aka upower).

sudo cp /etc/udev/rules.d/95-{upower,devkit-power}-wup.rules
sudo udevadm control --reload-rules

Add yourself to the "dialout" group

In order to access serial ports directly in Linux, you'll need to be a member of the dialout group.

Note: Do NOT run this as root. Use sudo as shown below so that ${USER} expands to your userid rather than root.

sudo adduser ${USER} dialout

You will need to log out and log back in again before your group membership is completed.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.