XBee®/XBee‐PRO® ZB SMT RF Modules
Enabling GPIO 1 and 2
Most of the remaining sections in this chapter describe how to configure GPIOs to function correctly in custom
applications that run on the XBee modules. In order for GPIO pins to be configurable, the application must set
the GPIO_PxCFG registers to enable the appropriate GPIO. The following table lists values for configuring the
GPIO pins. Other functionality is affected by these settings. See the EM357 datasheet from Ember for a
complete listing of functionality.
GPIO Mode
GPIO_PxCFGH/L Description
Analog input or output. When in analog mode, the digital input
Analog
0x0
0x4
(GPIO_PxIN) always reads 1.
Input (floating)
Digital input without an internal pull-up or pull-down. Output is disabled.
Digital input with an internal pull-up or pull-down. A set bit in
GPIO_PxOUT selects pull-up and a cleared bit selects pull-down.
Output is disabled
Input (pull-up or
pull-down)
0x8
Output (push-
pull)
0x1
0x5
0x9
0xD
Push-pull output. GPIO_PxOUT controls the output.
Output (open-
drain)
Open-drain output. GPIO_PxOUT controls the output. If a pull-up is
required, it must be external.
Alternate Output
(push-pull)
Push-pull output. An on-board peripheral controls the output.
Alternate Output
(open-drain)
Open-drain output. An on-board peripheral controls the output. If a pull-
up is required, it must be external.
For more information on configuring and setting GPIOs, consult the EM357 specification.
Detecting XBee vs. XBee-PRO
For some applications, it may be necessary to determine if the code is running on an XBee or an XBee-PRO
device. The PC7 pin on the EM357 is used to identify the module type (see Chapter 1). PC7 is connected to
ground on the XBee module. The following code could be used to determine if a module is an XBee or XBee-
PRO:
GPIO_PCSET = 0x80; // Enable pullup resistor
GPIO_PCCFGH &= 0x0fff; // Clear PC7 config
GPIO_PCCFGH |= 0x8000;// Set PC7 as input with pullup/pulldown
if (GPIO_PCIN & 0x80) {
ModuleIsXBeePro = true;
} else {
ModuleIsXBeePro = false;
}
Special Instructions For Using the JTAG Interface
There are four JTAG programming pins on the XBee through which firmware can be loaded onto the EM357
processor. Three of these pins are also connected to a second pin on the XBee and are used for separate
functions. The following table indicates the JTAG signal name, the primary connection pin on the XBee, the
secondary connection pin, and the secondary signal name.
It is important that the secondary pins specifically are not loaded with circuitry that might interfere with JTAG
programming (for example, an LED tied directly to the ASSOCIATE / DIO5 line). Any loading circuitry should be
buffered to avoid conflicts (for example, connecting ASSOCIATE / DIO5 to the gate of a MOSFET which drives
the LED).
© 2010 Digi International, Inc.
139