This guide will walk you through connecting pair of programmable XBee Pro 900HPs. In addition to the XBees, you’ll need a pair of SparkFun’s USB XBee Explorers.

You’ll also need to install the FTDI drivers so that the connected XBee explorers appear as devices in /dev. A link to the current drivers can be found here:

http://www.digi.com/support/productdetail?pid=3430&type=utilities

It is definitely worth having a read through the user manual.

Picocom

Picocom is a dumb terminal emulator that can be installed using Homebrew. We’ll use it to get down to the wire, experiment, and better understand what’s going on inside the XBee.

The Bootloader

Plug in an XBee. You should see a new device appear in /dev. It will be named something like: /dev/tty.usbserial-DA00SPUQ. (The exact name is determined by the XBee explorer.) Use picocom to connect to it:

  picocom --baud 9600 --echo --imap crcrlf /dev/tty.usbserial-DA00SPUQ

Hit enter a twice and you should see the bootloader menu:

B-Bypass
F-Update App
T-Timeout
V-BL Ver.
A-App Ver.
R-Reset

A description of this menu is missing from Digi’s latest user manual (revision P) but can be found on page 19 of revision N.

Hit “B” to go into bypass mode and connect directly to the XBee microcontroller’s UART. You won’t see a response.

Command Mode

Once in bypass mode, type +++. (All three plus signs must be entered within one second.) You should see the XBee sent you an “OK” response back indicating that it is now in command mode.

If you do not see the OK response: This is likely due to a baud rate mismatch. The baud rate will always be 9600 while connected to the bootloader menu. If you’ve configured your XBee to use a different baud rate, e.g., 38400, that will take effect when entering bypass mode. Thus you may have to instruct picocom to change the baud rate: do so by Ctrl+a followed by either Ctrl+u or Ctrl+d to increase or decrease the baud rate, respectively.

Command mode allows you to issue AT commands to query information about the XBee and to configrue it. Let’s try a couple things:

In command mode, type AT and press enter. The XBee should respond again with a simple “OK” indicating that it’s still in command mode and listening. Not seeing that? By default the XBee automatically exits command mode after about 6 seconds having not received an AT command. Try typing +++ again to get back to command mode.

Let’s query some data. Type ATVR and press enter to get the current firmware version:

ATVR
1071

What about configuring the XBee? Let’s change the transmitter power level:

ATPL
4
ATPL1
OK
ATPL
1

Here we queried the powel level (“ATPL”) and got a response of 4 meaning full strength. Then we set it to 1 (“ATPL1”) and queried it again to confirm the change was recorded. Note that The change will not actually take effect until command mode exits, or we issue an ATAC (apply changes) command.

Persisting Changes

The change above to the power level will not persist after the XBee restarts. To verify this, exit picocom with Ctrl+a Ctrl+x, disconnect and reconnect the XBee, start picocom again, go into bypass mode, then command mode, and run ATPL; you’ll see that it’s reverted back to 4:

ATPL
4

This is because the change we made earlier had not been written into prersistent / non-volatile memory.

To make the change “stick”, execute at ATWR after changing the power level back to 1:

ATPL1
OK
ATWR

Again, disconnect and reconnect, get into bypass and then command mode, and you’ll see that the power level has persisted at 1.

USB Explorer Reset Button

Instead of disconnecting and reconnecting the XBee, you can press the reset button on the XBee explorer. This will reset any settings not written to persistent memory and put the XBee back in to the 9600 baud bootloader menu.

This can be a little hard to get to, especially if using the RPSMA Antenna, but it’s quite easy to push if you have something credit-card shaped handy:

{<1>}reset button

XCTU

XCTU is Digi’s GUI program that allows you to interract with the XBee. You can use it to change the firmware, configure the modules, test connectivity, etc.

A link to the latest version of XCTU can be found here:

http://www.digi.com/support/productdetail?pid=3430&type=utilities

Connecting the XBee

First, make sure any picocom sessions with your XBee are closed.

Start XCTU and click the plus sign on the upper-left to connect your XBee:

{<2>}XCTU connect

Generally, the most important settings here are the Baud Rate and the “The radio module is programmable” check box.

The XBee’s default baud rate is 9600, so unless you have changed it, leave it at-is.

The check box is very important to get right. Only the programmable modules have the bootloader menu. XCTU needs to be told about this, as it will then expect to see the bootloader menu when it connects to the XBee. To ensure this happens cleanly, check the box and hit the reset button on the USB Explorer before hitting the “Finish” button in XCTU.

If done correctly, you can ignore the “Action Required” / “Reset your radio module” prompt shown below. It should only stay up for a couple of seconds as XCTU is connecting directly into the bootloader menu that it’s expecting to see:

{<3>}XCTU connecting

Once connected, click on the radio module on the left, and XCTU will load it up on the right side:

{<4>}XCTU loaded

Configuring from Within XCTU

Notice how the PL setting is set to “Low [1]”. You can do the same change we did with the AT command in picocom from XCTU. Change it back to full power (4) and click the red pencil icon to its right. This will make the change (“ATPL4”), write it to persistent memory (“ATWR”), and finally exit command mode to make the change take effect.

Communicating with XCTU

Finally, let’s get these two XBees communicating.

Again, use the plus icon on the upper-left to add your second XBee. Make sure that both are configured at the same baud rate so they can talk. You can also use the “Load default firmware settings” icon to put both XBees into compatible configurations:

{<5>}load default firmware

Next, for each radio module on the left, select the “Console” tab on top, and then the “Connect” button, both shown below:

{<6>}start console

Once both devices are connected, you can type in the console log area. Anything you type will be transmitted and written in blue, and anything received will be written in red:

{<7>}hello, world

Communicating with Picocom

The XBees are now acting as a wireless serial line. Everything written to one is transmitted to the other.

To show this, reset each XBee, and start two instances of picocom, one connected to each XBee.

Hit enter and then B to get into bypass mode on each.

Now, anything typed in to one picocom session gets transmitted and subsequently echoed in the other:

{<8>}picocom connected