XBee configuration
Paparazzi supports the following modem protocols:
- Standard transparent serial (pprz) - this is compatible with all modems and can be used to connect the autopilot directly to a PC for testing without a modem.
- Digi (formerly Maxstream) API protocol (xbee) - compatible with all Digi modems including the 9XTend and Zigbee. This protocol enables hardware addressing through API mode, allowing multiple aircraft to be managed from a single ground modem.
Installation
The simples way to configure the XBee modems is to use the X-CTU software from Digi. It runs under Windows or under Wine.
Under Wine make sure you have the USB serial link connecting to XBee mapped to a com port:
sudo ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com4
Configuring XBee AT mode (for pprz protocol)
This is the recommended way to start. With this firmware the modems basically act as a serial link replacement and don't do any mesh networking.
Basic approach:
- Connect your XBee, e.g. via a USB XBee Explorer.
- Start the X-CTU programm and go to the modem configuration.
- Click on READ
- Select the appropriate function set with AT command set.
- set PAN ID, etc... depending on which XBee you use
- Set the baudrate you want to use. 57600 is the maximum baudrate setting for bidirectional transfers to work correctly. At a higher baudrate setting, transmission can only be done in one direction.
- Then write the firmware to the module.
XBee Pro ZB (AT command set)
This 2.4GHz modem uses ZigBee PRO Feature Set and is compatible with devices from other vendors using the ZigBee PRO Feature Set.
Flashing the airborne module
- Connect your XBee, start X-CTU, click READ
- Select the function set ZIGBEE END DEVICE AT (or ZIGBEE ROUTER AT).
- Set the PAN ID to any number, must be the same as the pan id of the coordinator (Ground Station).
- Set the Node Identifier (NI) to your aircraft name or any other appropriate name.
- Set the baudrate you want to use. 57600 is the maximum baudrate setting for bidirectional transfers to work correctly.
- Then write the firmware to the module.
Flashing the ground station module
- Connect your XBee, start X-CTU, click READ
- Select the function set ZIGBEE COORDINATOR AT.
- Set the PAN ID to any number, must be the same as the pan id of the end device (aircraft).
- Set the Node Identifier (NI) to PPRZ_GROUND or any other appropriate name.
- Set the baudrate you want to use. 57600 is the maximum baudrate setting for bidirectional transfers to work correctly.
- Then write the firmware to the module.
XBee Pro ZNet 2.5 (AT command set)
These are legacy modems and not recommended/sold by Digi anymore.
It is recommended to upgrade these to XBee Pro ZB with the ZNet 2.5 to ZB Conversion Kit from Digi.
If you want to use ZNet 2.5 feature set nevertheless, here is how to configure it:
Flashing the airborne module
- Connect your XBee, start X-CTU, click READ
- Select the function set ZNET 2.5 ROUTER/END DEVICE AT.
- Set the PAN ID to any number, must be the same as the pan id of the coordinator (Ground Station).
- Set the Node Identifier (NI) to your aircraft name or any other appropriate name.
- Set the baudrate you want to use. 57600 is the maximum baudrate setting for bidirectional transfers to work correctly.
- Then write the firmware to the module.
Flashing the ground station module
- Connect your XBee, start X-CTU, click READ
- Select the function set ZNET 2.5 COORDINATOR DEVICE AT.
- Set the Destination Address Low (DL) to FFFF.
- Set the PAN ID to any number, must be the same as the pan id of the end device (aircraft).
- Set the Node Identifier (NI) to PPRZ_GROUND or any other appropriate name.
- Set the baudrate you want to use. 57600 is the maximum baudrate setting for bidirectional transfers to work correctly.
- Then write the firmware to the module.
Setup
For the ZigBee ZNet 2.5 and ZB modules to work one of the modules has to be flashed with the coordinator firmware. All the others in the same PAN can either run as routers or end-devices.
- Flash one module (ground station) with the coordinator AT firmware
- Flash aircraft module with router or end-device AT firmware
To allow modules to join any PAN set the PAN ID to zero (default setting). Then the coordinator will generate a random PAN ID and routers and end-devices will join the first PAN they find.
If you operate in an environment with multiple zigbee PANs it is recommended to set the PAN ID explicitly:
- Set PAN ID to some unique (but same) ID on both modules
- Set a Node Identifier for each module (e.g. ground, aircraft)
Reviving a non-responding Xbee Pro
To bring an apparently dead XBee Pro Series 2 back to life, do the following:
- Connect the USB device that holds the XBee to your laptop/desktop (without the XBee connected).
- Open X-CTU.
- In the tab used to program the device, select the proper modem (normally you would do a READ to get the values).
- Choose the option you want to program (i.e., "END DEVICE" or "COORDINATOR") as if you were programming it.
- With the XBee not in the device, click "WRITE". It will hang, timeout, and bring up a dialog box.
- Before you click OK to the dialog box, plug in the XBee module (carefully).
- Click OK to clear the message and it should start programming automatically.
Other tutorials
See: PixHawk HowTo configure XBee
XBee Pro 802.15.4 (AT command set)
XBee Pro 868 MHZ
Getting Them Working
Even with the xbee868.xml telemetry file, XBee868s will not last over 6 minutes. There is a special 868 build flag (in slayer1.xml), and matching option for the datalink but I could not get this to work. Eventually, I got them to work for about 20 minutes, which happily is the flight endurance of a heavily overloaded GWS Formosa.
I did this using a command window, but you could use X-CTU if you are a wuss or have Windows handy.
- Attach Xbee and start serial comm program (I use
screen /dev/ttyUSB0 <baud rate, just a number, no angled brackets>
, you can also use pico- or microcom) - Type AT and enter. You should get an OK back.
- ATMT and enter. You should get a number—this represents the number of extra times each packet will be broadcast. We now need to change this to zero.
- ATMT0 and enter => OK
- ATRR and enter. This number is the number of retries that will be sent if an ACK is not received. Disabling this will also have the side effect of disabling ACKs, giving us more packets to play with.
- ATRR0 and enter => OK
- Type ATWR to store the new stuff in the firmware. You should get an OK.
- Set the datalink to transparent mode both in your airframe file and on the datalink.
You may also want to drop the power level to 1mW for testing, or it won't actually work - they are just too damn powerful to talk to each other at a range of a couple of feet. I also used 1mW for flying - never lost the link, even after a mile. Didn't get round to range testing them though.
You probably want to do this to both XBees (at least I did). I personally had the baud rate at 57600 for legacy reasons, but it should work just as well at any other baud rate. Thanks to CheBuzz for this info, and for helping me work all this out at 11pm the night before EMAV09.