XBee Radio Modes
22 September 2014
In a previous post, I wrote about the different XBee radio device types and how they can be grouped together to form a personal area network (PAN). This time, I will be focusing on the different modes that you can put your device into and how those modes can fit into your PAN. Just as last time, these categorization are larger based on the firmware that you load on to the device using X-CTU.
When you purchase an XBee, the default firmware is the AT Router version. The AT firmware is fairly simple and straightforward to understand. But, there are two sub-modes that need to be discussed in this scenario.
This is the default mode for XBee radios that are running the AT firmware. Transparent mode is used to send data through the XBee radio directly to the serial port exactly as it was sent. This configuration is almost like having a direct/wired serial connection to the device. The only difference is that it is happening wirelessly and you need to be able to configure your local and remote devices to communicate with each other beforehand. In this mode, the destination address and other variables need to be known and configured in the XBee. Because of this, transparent mode is very specific to your project and is in a sense "hard coded." For prototyping a simple pair network, this might not be a bad thing. But, in actual applications or in larger personal area networks, this will quickly become a burden.
Command mode is used to read and update the configuration of the radio. For example, you can set the address for the remote radio that you will be communicating with. When in command mode, the radio stops listening to the other node(s) in the network. This mode can only be entered manually, and is generally entered by connecting to the device via a console. It is important to note that command mode will time out and revert to transparent mode after 10 seconds. This mode will be discussed further in a later article.
Put simply, API mode allows you to programmatically send commands wirelessly to be executed remotely on another radio. Additionally, the remote radio's address does not need to be known ahead of time (at least by the local radio that is). Anything you can do locally via AT commands can be done remotely via API mode. There are a huge number things that you can achieve through this mode. API commands are sent by messages called "Frames." Frames have a specific, well defined format that needs to be followed. This format is designed to be as compact as possible, and not human readable. If your software is communicating directly to your XBee without the help of a software library, you will need to carefully construct your frames via individual bytes.
Commands are divided into the following groups:
- Addressing Commands - Used to specify and retrieve destinations, endpoints, parent addresses, and more.
- Networking Commands - Used to work with PAN IDs, router configuration, and channel configuration.
- Security Commands - Used to configure encryption options.
- RF Interfacing Commands - Used to configure power settings. They can also be used to retrieve the received signal strength indicator (RSSI) for the last packet received by a given radio.
- Serial Interfacing Commands - Used to switch to API mode, change the serial data rate, and other serial related settings.
- I/O Commands - Used to work with digital and analog I/O pins provided on the XBee. Using these commands can reduce cost by not requiring a microcontroller on the remote radio.
- Diagnostic Commands - Allow you to check the network status and association. They also allow you to get hardware and firmware version information for a radio.
- AT Command Options - Used to configure how the radio responds to AT commands.
- Sleep Commands - Used to configure the module's sleep mode.
- Execution Commands - Used to reset defaults, write to non-volatile, and more.
The details of API frames are many, and therefore they are outside the scope of this article. Hopefully, however, the above gave you a high-level understanding of what each of these modes mean and what their general purpose is.
In addition to there being multiple device type configurations, there are also different modes that XBee radios can be in. In general for tinkering and small point-to-point prototypes, Transparent mode (AT) is the easiest to understand and implement. For larger projects that involve more than two radios, API mode will likely be required.