ZigBee Receive Data example for mbed XBeeLib By Digi
You are viewing an older revision! See the latest version
Homepage
Description¶
This example shows how to receive data. A remote XBee module has sent a packet to our local XBee module though the air. The local XBee module receives the packet and sends it to the mbed cpu through the serial port. This library decodes the packet and calls a user defined method to process the packet.
Setup¶
Local Setup¶
The local setup includes:
- The mbed module and its debug connection to the PC (normally an usb cable)
So you can see the sample application debug messages. For that you have to configure the DEBUG_TX and DEBUG_RX pins in config.h.
See Configuring the library and Debugging the library chapters for more info. - The connection between the mbed module and the local XBee module
That includes at least wiring and configuring RADIO_TX and RADIO_RX in config.h. Wiring RADIO_RESET is highly recommended as well.
See Configuring the library and Initializing modules chapters for more info. - The local XBee module persistent configuration
This library expects that the local XBee module has the default settings stored (but for the "AP" setting that must be set to 1 or 2). You can verify those settings previous to run the example using XCTU tool through following two options:
- Having the local radio wired to the mbed module, you can discover the local XBee module from a remote XBee module in the same network.
- You can temporarily unplug the local XBee module from the mbed module and plug it to the PC.
Special care must be taken with following settings:
- "ID" and rest of Networking settings: Leave them default or customize them as in your remote XBee module. The important thing is that both local and remote XBee modules create a network. This library has methods to change these settings but the sample applications are not calling them.
- Firmware: In S2B modules, end-device firmware will complicate evaluation of standard examples because the radio will sleep automatically. To avoid that it's recommended to flash 'router' firmware that make devices don't sleep.
- "SM" setting: Set it to 0=No Sleep.
- "BD" setting: The sample applications expect it set to 3=9600bps. If you change it, change it in the sample application accordingly (See Initializing modules chapters for more info).
- "AP" setting: It's compulsory to change this setting set to 1 or 2 !!!!.
Remote Setup¶
The more comfortable remote setup to evaluate these examples is having the remote XBee module mounted in baseboard (XBIB, TODO....) and connected to the PC through an usb cable to create a serial connection.
Open XCTU tool and connect to the remote XBee module through corresponding serial connection.
With XCTU tool its easy to configure the remote XBee module settings so it creates a network with the local XBee module (the one attached to the mbed module). Once the network is created, you can even discover the local XBee module through the air and check that the module settings match the requirements explained in the 'Local Setup' chapter.
The XCTU tool is later used to evaluate the examples by injecting or monitoring packets in the network.