phlux.us

Blog about hardware and software projects by phluxus

Archive for the ‘hardware’ Category

Notes on XBee Series 2

leave a comment »

Notes on XBee Series 2 using ZNET 2.5

As most XBee websites talk about the Series 1 XBees, here’s a recollection of thoughts and curses when I started with XBee Series 2.

There’s a huge difference between Series 1 and Series 2, and you cannot assume that ‘Series 2’ is the newer version of Series 1. They are completely different beasts, although Series 2 does have a compatibility mode.

First try to get a serial connection to your XBee from your Mac or PC. There are several ways. It seems modern (Series 2) XBees are protected against over-voltage, so I have succesfully hooked them up directly to +5V. However I could not find any mention of this in the user manual, so I don’t take any responsibility if your XBee gets damaged! I used one of the devices below.

Here are some links for other information regarding the wiring of the XBee

http://www.ladyada.net/make/xbee/wiring.html
http://www.ladyada.net/make/xbee/point2point.html
http://blog.didierstevens.com/2009/06/15/quickpost-arduino-xbee-shield-series-2-configuration/

Hopefully your XBee is set for Transparent (AT) mode. In this case you can assign and test a lot of things using the serial connection.
If you do not get any response, your XBee might be flashed with ‘API’ firmware. In this case it is best to use the Windows X-CTU program to reflash the XBee in AT mode.

Only after you have a succesful connection between to Desktop computers would I advice to send serial data directly from your Arduino or other embedded device. It makes debugging so much easier!

There are multiple families of XBee firmware

All incompatible with each other in some way.

XB24 : XBee 802.15.4, this is the old Series 1 compatible point-to-point or point-to-multipoint protocol
XB24-B : ZNET 2.5, Series 2 point-to-point or point-to-multipoint protocol
XB24-DM : DigiMesh, not discussed here
XB24-ZB : ZigBee network. This will be discussed in a later article.

So, if you have to connect to an existing network, ask the owner of the coordinator what kind of XBee network it is. The rest of this article describes the ZNET 2.5 interface.

Do’s and Don’ts

Don’t forget to

  1. Set one of the XBees to be a ZNET 2.5 Coordinator, else you do not have a PAN. Whatever the other instructions on the www say, I could not get point-to-point working using only end nodes. Maybe with 802.15.4 XBees, although Edwin claims he got it to work with ZNET 2.5 modules.
  2. Make it easy on yourself, name your XBee devices using ATNI<name> especially the coordinator. I named mine ‘COORD’. You can check if you succeeded in naming by typing ATNI<return>.
  3. Sometimes devices do not find the coordinator or other devices automatically. You can set the destination node in three ways:
    1. broadcast    Destination High, Destination Low
      ATDH0
      ATDL0
      This means all your messages go to EVERY node on the network (not tested yet).
      This does NOT work on the Coordinator.
    2. directly
      ATDH<high address> , e.g. ATDH13A200
      ATDL<low address> , e.g. ATDH4030ABCD
    3. by looking up a name (recommended) Destination Node
      ATDN<Node Identifier>, e.g. ATDNCOORD
      Directly afterward the XBee exits command mode and returns to online mode.
  4. BEFORE reflashing with different firmware, it is sometimes necessary to disable cyclic sleep mode. Some XBees have a sleep cycle of 8 seconds, making it impossible to flash over 9600 baud. So, set the sleep to either:
    ATSM0 : no
    or
    ATSM1 : PIN-Hibernate
  5. Don’t forget to WRite your settings to flash, else names and destinations are forgotten:
    ATWR

How can you test if you are connected to a network?

Use ATAI
most common responses:
0: everything OK, you are on a PAN
21: you are not connected to a PAN
FF : currently scanning for a Zigbee network

What is my PAN ID?

ATID

What is my assigned dynamic id on the PAN?

ATMY

How can you test which firmware the XBee is running?

ATVR : this returns the following code
[ABCD] which we can split up as follows:
    A  : 1=ZNET 2.5
2=Zigbee
B  : 0=AT Coordinator
1= API Coordinator
2=AT Router/End device
3= API Router/End device

CD : Currently the following AT/API firmware versions are set
ZNET Router/End device: 41…247
ZNET Coordinator: 41…047

A  : 1=ZNET 2.5
           2=Zigbee

B  : 0=AT Coordinator
1= API Coordinator
2=AT Router/End device
3= API Router/End device

CD : Currently the following AT firmware versions are set
ZNET Router/End device: 20
ZNET Coordinator AT: 20

 

More ATAI result codes

0x00 – Successfully formed or joined a network.
(Coordinators form a network, routers and end devices join a network.)

0x21 – Scan found no PANs
0x22 – Scan found no valid PANs based on current SC and ID settings
0x23 – Valid Coordinator or Routers found, but they are not allowing joining (NJ expired)
0x27 – Node Joining attempt failed (typically due to incompatible security settings)
0x2A – Coordinator Start attempt failed‘
0x2B – Checking for an existing coordinator
0xAB – Attempted to join a device that did not respond.
0xAC – Secure join error – network security key received unsecured
0xAD – Secure join error – network security key not received
0xAF – Secure join error – joining device does not have the right preconfigured link key
0xFF – Scanning for a ZigBee network (routers and end devices)

Broadcasts

You can broadcast packets by setting DH and DL to 0 (zero). Packets will then arrive at all connected Xbees.

X-CTU Settings

From the plethora of options in X-CTU, this is what I’m using. It’s not mesh networking, but it’s easy for testing.

Modem: XB24-B
Function Set: ZNet 2.5 Coordinator AT (1047)

Router Sensor

If you –accidentally– installed the router sensor or router digital firmware on it, the UART of the xbee is disabled. The pins are used for the 1wire interface. To reset the firmware you have to do the reset dance as described in
Digi International Support Forum – View Thread – Can’t communicate

Digi International Support Forum – View Thread – How to configure XBee module to use with a watchpor…

The trick is: ground-reset , ground-DIN, release-DIN, release-Reset,
then the X-CTU continues with installing the firmware!
Now that I finally have the proper Win7/64 driver for the MaxStream board: just pressing the reset button will do this for you!

That’s all for now, I might add more information later, but these notes document my biggest hurdles in XBee development land.

Next time: support for UDP and Serial OSC in XIG, the XBee internet gateway.

Advertisements

Written by axello

2011-06-03 at 15:30

Posted in hardware, xbee

Tagged with ,