Part Number Hot Search : 
UC2843AN GBP208G CQP462 AO4703 ANTX2N6 BAV20 MI945F SFBUX15
Product Description
Full Text Search
 

To Download XB24CZ7RIS-004 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  digi international inc. 11001 bren road east minnetonka, mn 55343 877 912-3444 or 952 912-3444 http://www.digi.com xbee?/xbee-pro? zb smt rf modules zigbee rf modules by digi international models: xbee s2c, pro s2c hardware: s2c firmware: 401x 90002002_a 8/19/2010
xbee?/xbee \ pro? ? smt ? zb ? rf ? modules ? ? 2010 ? digi ? international, ? inc. ????? 2 ? 2010 digi international, inc. all rights reserved no ? part ? of ? the ? contents ? of ? this ? manual ? may ? be ? transmitted ? or ? reproduced ? in ? any ? form ? or ? by ? any ? means ? without ? the ? written ? permission ? of ? digi ? international, ? inc. zigbee ? ? is ? a ? registered ? trademark ? of ? the ? zigbee ? alliance. xbee? ? and ? xbee \ pro? ? are ? registered ? trademarks ? of ? digi ? international, ? inc. technical support: phone: (866) 765-9885 toll-free u.s.a. & canada ? (801) 765-9885 worldwide 8:00 am - 5:00 pm [u.s. mountain time] live chat: www.digi.com online support: http://www.digi. com/support/eserv ice/login.jsp email: rf-experts@digi.com
contents xbee?/xbee \ pro? ? smt ? zb ? rf ? modules ??? ? ? ? 2010 ? digi ? internaitonal, ? inc. ????? 3 overview 6 worldwide acceptance 6 what?s new in 401x firmware 6 specifications 7 serial communications specifications 8 uart 8 spi 8 gpio specifications 8 hardware specs for programmable variant 9 mechanical drawings 10 pin signals 11 em357 pin mappings 12 design notes 12 power supply design 12 recommended pin connections 12 board layout 13 module operation for programmable variant 16 xbee programmable bootloader 18 overview 18 bootloader software specifics 18 bootloader menu commands 22 firmware updates 23 output file configuration 23 rf module operation 25 serial communications 25 uart data flow 25 spi communications 25 serial buffers 26 uart flow control 27 serial interface protocols 28 modes of operation 30 idle mode 30 transmit mode 30 receive mode 31 command mode 31 sleep mode 32 xbee zigbee networks 33 introduction to zigbee 33 zigbee stack layers 33 networking concepts 33 device types 33 pan id 35 operating channel 35 zigbee application layers: in depth 35 application support sublayer (aps) 35 application profiles 35 coordinator operation 37 forming a network 37 channel selection 37 pan id selection 37 security policy 37 persistent data 37 xbee zb coordinator startup 37 permit joining 38 resetting the coordinator 38 leaving a network 39 replacing a coordinator (s ecurity disabled only) 39 example: starting a coordinator 40 example: replacing a coordi nator (security disabled) 40 router operation 40 discovering zigbee networks 40 joining a network 41 authentication 41 persistent data 41 xbee zb router joining 41 permit joining 42 joining always enabled 42 joining temporarily enabled 42 router network connectivity 42 leaving a network 43 resetting the router 44 example: joining a network 44 end device operation 44 discovering zigbee networks 44 joining a network 45 parent child relationship 45 end device capacity 45 authentication 45 persistent data 45 orphan scans 46 xbee zb end device joining 46 parent connectivity 47 resetting the end device 47 leaving a network 47 example: joining a network 47 channel scanning 48 managing multiple zigbee networks 48
contents xbee?/xbee \ pro? ? smt ? zb ? rf ? modules ??? ? ? ? 2010 ? digi ? internaitonal, ? inc. ????? 4 pan id filtering 48 preconfigured security keys 48 permit joining 48 application messaging 48 transmission, addre ssing, and routing 49 addressing 49 64-bit device addresses 49 16-bit device addresses 49 application layer addressing 49 data transmission 49 broadcast transmissions 50 unicast transmissions 50 data transmission examples 52 rf packet routing 53 link status transmission 54 aodv mesh routing 55 many-to-one routing 57 source routing 57 encrypted transmissions 60 maximum rf payload size 60 throughput 61 zdo transmissions 61 zigbee device objects (zdo) 62 sending a zdo command 62 receiving zdo comman ds and responses 62 transmission timeouts 64 unicast timeout 64 extended timeout 64 transmission examples 65 security 67 security modes 67 zigbee security model 67 network layer security 67 frame counter 68 message integrity code 68 network layer encryption and decryption 68 network key updates 68 aps layer security 68 message integrity code 69 aps link keys 69 aps layer encryption and decryption 69 network and aps layer encryption 69 trust center 70 forming and joining a secure network 70 implementing security on the xbee 70 enabling security 71 setting the network security key 71 setting the aps trust center link key 71 enabling aps encryption 71 using a trust center 71 xbee security examples 72 example 1: forming a networ k with security (pre-con- figured link keys) 72 example 2: forming a networ k with security (obtain- ing keys during joining) 72 network commissioning and diagnostics 74 device configuration 74 device placement 74 link testing 74 rssi indicators 75 device discovery 75 network discovery 75 zdo discovery 75 joining announce 75 commissioning pushbutton and associate led 75 commissioning pushbutton 76 associate led 77 managing end devices 79 end device operation 79 parent operation 79 end device poll timeouts 80 packet buffer usage 80 non-parent device operation 80 xbee end device configuration 81 pin sleep 81 cyclic sleep 83 transmitting rf data 86 receiving rf data 86 i/o sampling 87 waking end devices with the commissioning pushbut- ton 87 parent verification 87 rejoining 87 xbee router/coordinat or configuration 87 rf packet buffering timeout 88 child poll timeout 88 transmission timeout 88
contents xbee?/xbee \ pro? ? smt ? zb ? rf ? modules ??? ? ? ? 2010 ? digi ? internaitonal, ? inc. ????? 5 putting it all together 89 short sleep periods 89 extended sleep periods 89 sleep examples 89 xbee analog and digital i/o lines 91 i/o configuration 91 i/o sampling 92 queried sampling 94 periodic i/o sampling 94 change detection sampling 94 rssi pwm 94 i/o examples 95 pwm1 95 api operation 96 api frame specifications 96 api examples 98 api serial port exchanges 99 at commands 99 transmitting and re ceiving rf data 99 remote at commands 99 source routing 100 supporting the api 100 api frames 100 at command 100 at command - queue parameter value 101 zigbee transmit request 101 explicit addressing zi gbee command frame 103 remote at command request 105 create source route 106 at command response 107 modem status 107 zigbee transmit status 108 zigbee receive packet 109 zigbee explicit rx indicator 110 zigbee io data sample rx indicator 111 xbee sensor read indicator 112 node identification indicator 114 remote command response 115 over-the-air firmware update status 116 route record indicator 117 many-to-one route request indicator 118 sending zigbee device objects (zdo) commands with the api 119 sending zigbee cluster library (zcl) commands with the api 121 sending public profile commands with the api 123 xbee command reference tables 126 module support 137 x-ctu configurat ion tool 137 customizing xbee zb firmware 137 design considerations for digi drop-in networking 137 xbee bootloader 137 programming xbee modules 138 serial firmware updates 138 invoke xbee bootloader 138 send firmware image 138 writing custom firmware 138 regulatory compliance 138 enabling gpio 1 and 2 139 detecting xbee vs. xbee-pro 139 special instructions for us ing the jtag interface 139 appendix a: agency certifications 141 appendix b:migrating from xbee zb to xbee zb smt 147 appendix c:manufacturing information 150 appendix d:warranty information 153 appendix e:definitions 154
? ? 2010 ? digi ? international, ? inc. ????? 6 1. ? overview this manual describes the operation of the xbee/xbee-pro zb smt rf module, which consists of zigbee firmware loaded onto xbee s2c and pro s2c hardware. xbee? and xbee-pro? zb smt embedded rf modules provide wireless connec- tivity to end-point devices in zigbee me sh networks. utilizing the zigbee pro feature set, these modules are interopera ble with other zigbee devices, includ- ing devices from other vend ors. with the xbee?, users can have their zigbee network up-and-running in a matter of minutes without configuration or addtional development. the xbee?/xbee-pro? zb modules are compatible with other devices that use xbee? ?zb? technology. these include connectportx gateways, xb ee? and xbee-pro? adapters, wall routers, xbee? sensors, and other products with the ?zb? name. worldwide acceptance fcc approval (usa) refer to appendix a for fcc requirements. systems that contain xbee?/ xbee-pro? zb smt rf modules inherit digi certifications. ism (industrial, scientific & medical) 2.4 ghz frequency band manufactured under iso 9001:2000 registered standards xbee?/xbee-pro? smt zb rf modules are optimize d for use in us, canada, europe, australia, and japan (contact digi for comple te list of agency approvals). what?s new in 401x firmware ? an alternative serial port is avai lable using spi slave mode operation. ? six software images (c oordinator at, coordinator api, router at, router api, end device at, and end device api) are combin ed into a single software. ? fragmentation is now available in both api mode and transparent mode. ? p3 (dout), p4 (din), d8 (sleeprq), and d9 (on-sleep ) are now available for i/o sampling. ? both pull-up and pull-down resi stors can now be applied to pins configured for inputs.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 7 specifications specifications ? of ? the ? xbee?/xbee \ pro? ? zb ? smt ? rf ? module ? specification xbee xbee-pro performance indoor/urban range up to 200 ft . (60 m) up to 300 ft. (90 m) outdoor rf line-of-sight range up to 4000 ft. (1200 m) up to 2 miles (3200 m) transmit power output 6.3mw (+8dbm), boost mode 3.1mw (+5dbm), normal mode channel 26 max power is +3dbm 63mw (+18 dbm, adjustable to 0 dbm) rf data rate 250,000 bps receiver sensitivity -102 dbm, boost mode -100 dbm, normal mode -101 dbm power requirements adjustable power yes supply voltage 2.1 - 3.6 v 2.2 - 3.6 v for programmable version 2.7 - 3.6 v operating current (transmit)) 45ma (+8 dbm, boost mode) 33ma (+5 dbm, normal mode) 100ma @ +3.3 v, +18 dbm operating current (receive) 31ma ( boost mode) 28ma (normal mode) 31ma power-down current < 1 ? a @ 25 o c general operating frequency band ism 2.4 - 2.5 ghz dimensions 0.866? x 1.33? x 0.120? (2.199cm x 3.4cm x 0.305cm) weight 1.4 oz. (40 g) operating temperature -40 to 85o c (industrial) antenna options rf pad, pcb antenna, or u.fl connector networking & security supported network topologies point-to-point, point-to-multipoint, peer-to-peer, and mesh number of channels 16 direct sequence channels 15 direct sequence channels interface immunity dsss (direct sequence spread spectrum) channels 11 to 26 11 to 25 addressing options pan id and addresses, cluster ids and endpoints (optional) interface options uart 1 mbps maximum (burst) spi 5 mbps maximum (burst) agency approvals united states (fcc part 15.247) fcc id: mcq-xbs2c fcc id: mcq-xbps2c industry canada (ic) ic: 1846a-xbs2c ic: 1846a-xbps2c europe (ce) etsi australia pending
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 8 serial communicatio ns specifications xbee rf modules support both uart (universal asyn chronous receiver / tran smitter) and spi (serial peripheral interface) serial connections. uart the sc1 (serial communication port 1) of the ember 357 is connected to the uart port. more information on uart operation is found in the uart se ction in chapter 2. spi the sc2 (serial communication port 2) of the ember 357 is connected to the spi port. for more information on spi operatio n, see the spi section in chapter 2. gpio specifications xbee rf modules have 15 gpio (general purpose input / output) ports available. the exact list will depend on the module configuration, as so me gpio pads are used for purpos es such as serial communication. see gpio section for more information on configur ing and using gpio ports. japan pending rohs compliant uart ? pin ? assignments uart pins module pin number dout 3 din / config 4 cts / dio7 25 rts / dio6 29 spi ? pin ? assignments spi pins module pin number spi_sclk / dio18 14 spi_ssel / dio17 15 spi_mosi / dio16 16 spi_miso / dio15 17 electrical ? specifications ? for ? gpio ? pads gpio electrical specification value voltage - supply 2.1 - 3.6 v low schmitt switching threshold 0.42 - 0.5 x vcc high schmitt switching threshold 0.62 - 0.8 x vcc input current for logic 0 -0.5 ? a input current for logic 1 0.5 ? a input pull-up resistor value 29 k ? input pull-down resistor value 29 k ? output voltage for logic 0 0.18 x vcc (maximum) specifications ? of ? the ? xbee?/xbee \ pro? ? zb ? smt ? rf ? module ? specification xbee xbee-pro
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 9 hardware specs for pr ogrammable variant if the module has the programmable se condary processor, add the following table values to the specifications listed on page 7. for example, if th e secondary processor is running at 20 mhz and the primar y processor is in recieve mode then the new current value will be i total = i r2 + i rx = 14 ma + 9 ma = 23 ma, where i r2 is the runtime current of the secondary processor and i rx is the recieve current of the primary. output voltage for logic 1 0.82 x vcc (minimum) output source current for pad numbers 3, 4, 5, 10, 12, 14, 15, 16, 17, 25, 26, 28, 29, 30, and 32 4 ma output source current for pad numbers 3, 4, 5, 10, 12, 14, 16, 17, 26, 28, 29, 30, and 33 4 ma output source current for pad numbers 7, 8, 24, 31, and 33 8 ma output sink current for pad numbers 7, 8, 24, 31, and 33 8 ma total output current (for gpio pads) 40 ma specifications ? of ? the ? programmable ? secondary ? processor optional secondary processor specification these numbers add to specifications (add to rx, tx, and sleep currents depending on mode of operation) runtime current for 32k running at 20mhz +14ma runtime current for 32k running at 1mhz +1ma sleep current +0.5 ? a typical for additional specifications see freescale datasheet and manual mc9so8qe32 minimum reset low pulse time for em357 +26 ? s vref range 1.8vdc to vcc electrical ? specifications ? for ? gpio ? pads gpio electrical specification value
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 10 mechanical drawings mechanical ? drawings ? of ? the ? xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? (antenna ? options ? not ? shown). ? all ? dimentions ? are ? in ? inches. ? . ?       

  

    
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 11 pin signals ? signal direction is specified with respect to the module ? see design notes section below for details on pin connections. ? * refer to the writing custom firmware section for instructions on using these pins if jtag functions are needed. pin ? assignments ? for ? xbee ? modules ? (low \ asserted ? signals ? are ? distinguished ? with ? a ? horizontal ? line ? above ? signal ? name.) pin # name direction default state description 1 gnd - - ground 2 vcc - - power supply 3 dout / dio13 both output uart data out / gpio 4 din / config / dio14 both input uart data in / gpio 5 dio12 both gpio 6 reset input module reset 7 rssi pwm / dio10 both output rx signal strength indicator / gpio 8 pwm1 / dio11 both disabled pulse width modulator / gpio 9 [reserved] - disabled do not connect 10 dtr / sleep_rq / dio8 both input pin sleep control line / gpio 11 gnd - - ground 12 spi_attn / bootmode / dio19 output output serial peripheral interface attention do not tie low on reset 13 gnd - - ground 14 spi_clk / dio18 input input serial peripheral interface clock / gpio 15 spi_ssel / dio 17 input input serial peripheral interface not select / gpio 16 spi_mosi / dio16 input input serial peripheral interface data in / gpio 17 spi_miso / dio15 output output serial peripheral interface data out / gpio 18 [reserved]* - disabled do not connect 19 [reserved]* - disabled do not connect 20 [reserved]* - disabled do not connect 21 [reserved]* - disabled do not connect 22 gnd - - ground 23 [reserved] - disabled do not connect 24 dio4 both disabled gpio 25 cts / dio7 both output clear to send flow control / gpio 26 on / sleep / dio9 both output module status indicator / gpio 27 vref input - not used for em357. used for programmable secondary processor. for compatibility with other xbee modules, we recommend connecting this pin to the voltage reference if analog sampling is desired. otherwise, connect to gnd. 28 associate / dio5 both output associate indicator / gpio 29 rts / dio6 both input request to send flow control / gpio 30 ad3 / dio3 both disabled analog input / gpio 31 ad2 / dio2 both disabled analog input / gpio 32 ad1 / dio1 both disabled analog input / gpio 33 ad0 / dio0 both input analog input / gpio 34 [reserved] - disabled do not connect 35 gnd - - ground 36 rf both - rf io for rf pad variant 37 [reserved] - disabled do not connect
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 12 em357 pin mappings the following table shows how the em357 pins are used on the xbee. note: some lines may not go to the external xbee pins in the programmable secondary processor version. design notes the xbee modules do not specifically require any exte rnal circuitry or specific connections for proper operation. however, there are some general design guidelines that are re commended for help in troubleshooting and buil ding a robust design. power supply design poor power supply can lead to poor radio performance, especially if the supply voltage is not kept within tolerance or is excessively noisy. to help reduce noise, we recommend placing both a 1 ? f and 8.2pf capacitor as near to pin 2 on the pcb as possible. if using a switching regulator for your power supply, switching frequencies above 500khz are preferre d. power supply ripple sh ould be limited to a maximum 250mv peak to peak. note ? for designs using the progra mmable modules, an additional 10 ? f decoupling cap is recommended near pin 2 of the module. the nearest proximity to pin 2 of th e three caps should be in the following order: 8.2pf, 1 ? f followed by 10 ? f. recommended pin connections the only required pin connections are vcc, gnd, dout and din. to support serial firmware updates, vcc, gnd, dout, din, rts, and dtr should be connected. em357 pin # em357 pin name xbee pin # other usage 12 rst 6 programming 18 pa7 8 19 pb3 29 used for uart 20 pb4 25 used for uart 21 pa0 / sc2mosi 16 used for spi 22 pa1 / sc2miso 17 used for spi 24 pa2 / sc2sclk 14 used for spi 25 pa3 / sc2ssel 15 used for spi 26 pa4 / pti_en 32 ota packet tracing 27 pa5 / pti_data / bootmode 12 ota pacet tracing, force embedded serial bootloader, and spi attention line 29 pa6 7 30 pb1 / sc1txd 3 used for uart 31 pb2 / sc1rxd 4 used for uart 33 pc2 / jtdo / swo 26 jtag (see writing custom firmware section) 34 pc3 / jtdi 28 jtag (see writing custom firmware section) 35 pc4 / jtms / swdio 5 jtag (see writing custom firmware section) 36 pb0 10 38 pc1 / adc3 30 41 pb7 / adc2 31 42 pb6 / adc1 33 43 pb5 / adc0 temperature sensor on pro version
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 13 all unused pins should be left disconnected. all inputs on the radio can be pulled high or low with 30k internal pull-up or pull-down re sistors using the pr and pd software commands. no specif ic treatment is needed for unused outputs. for applications that need to ensu re the lowest sleep current, unconnec ted inputs should never be left floating. use internal or external pull-up or pull-down resistors, or set the unused i/o lines to outputs. other pins may be connected to exte rnal circuitry for convenience of op eration, including the associate led pad (pad 28) and the commissioning pa d (pad 33). the associate led pad wi ll flash different ly depending on the state of the module to the network, and a pushbutton attached to pad 33 can enable various join functions without having to send serial port commands. please see the commissioning pushbutton and associate led section in chapter 7 for more details. the source and si nk capabilities are limited to 4ma for pad numbers 3, 4, 5, 10, 12, 14, 15, 16, 17, 25, 26, 28, 29, 30 and 32, and 8ma for pad numbers 7, 8, 24, 31 and 33 on the module. the vref pad (pad 27) is only used on the programmabl e versions of these modules. for compatibility with other xbee modules, we recommend connecting this pin to a voltage reference if analog sa mpling is desired. otherwise, connect to gnd. board layout xbee modules are designed to be self sufficient and have minimal sensitivity to nearby processors, crystals or other pcb components. as with all pcb designs, power and ground traces should be th icker than signal traces and able to comfortably support th e maximum current specifications. a recommended pcb footprint for the module can be found in appendix c. no other special pcb design consider ations are required for integrating xbee radios except in the antenna section. the choice of antenna and antenna loca tion is very important for correct performance. with the exception of the rf pad variant, xbees do not require additional gr ound planes on the host pcb. in general, antenna elements radiate perpendicular to the direction they point. thus a vertical antenna emits across the horizon. metal objects near the antenna caus e reflections and may re duce the ability for an antenna to radiate efficiently. metal objects between the transmitter and rece iver can also block the radiation path or reduce the transmission distance, so external antennas should be positioned away from them as much as possible. some objects that are often overlooked are metal poles, metal studs or beams in structures, concrete (it is usually reinforced with metal rods), metal enclosures, vehicles, elevators, ventilation ducts, refrigerators, microwave ovens, batteries, and tall electrolytic capacitors. design notes for pcb antenna modules pcb antenna modules should not have any ground pl anes or metal objects above or below the antenna. for best results, th e module should not be plac ed in a metal enclosure, which may greatly reduce the range. the module should be placed at the edge of the pcb on which it is mounted. the ground, power and signal planes should be va cant immediately belo w the antenna section. the drawing on the following page illustrates important recommendation s for designing with the pcb antenna module. it should be noted that fo r optimal performance, this module sh ould not be mounted on the rf pad footprint described in the next se ction because the footprint requires a ground plane within the pcb antenna keep out area.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 14
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 15 design notes for rf pad modules the rf pad is a soldered antenna connection. the rf signal travels from pin 36 on the module to the antenna through an rf trace transmis sion line on the pcb. please note that any additional components between the module and antenna wi ll violate modular certification. the rf trace should have a controlled impedance of 50 ohms. we recommend using a microstrip trac e, although coplanar waveguide may also be used if more isolation is need ed. microstrip generally requires less area on the pcb than coplanar waveguide. stri pline is not recommended because se nding the signal to different pcb layers can introduce matching and performance problems. it is essential to follow good de sign practices when implementing the rf trace on a pcb. the following figures show a layout example of a host pcb that co nnects an rf pad module to a right angle, through hole rpsma jack. the top two layers of the pcb have a controlled thickness dielectric material in between. the second layer has a ground plane whic h runs underneath the en tire rf pad area. this ground plane is a distance d, the th ickness of the dielectric, below the top layer. the top layer has an rf trace running from pin 36 of the module to the rf pin of the rpsma connector. the rf trace's width determines the impedanc e of the transmission line with relation to the ground plane. many online tools can estimate this value, although the pcb manufac turer should be consulted for the exact width. assuming d=0.025", and that the dielectric has a relative permittivi ty of 4.4, the width in this example will be approximately 0.045" for a 50 ohm trace. this trace width is a good fit with the module footprint's 0.060" pad width. usin g a trace wider than the pad widt h is not recommended, and using a very narrow trace (under 0.010") can cause unwanted rf loss. the length of the trace is minimized by placing the rpsma jack close to the module. all of the grounds on the jack and the module are connected to the ground planes directly or through cl osely placed vias. any ground fill on the top layer should be spaced at least twice the distance d (in this case, at least 0.050") from the microstrip to minimize their interaction. implementing these design suggestions will help ensure that the rf pad module performs to its specifications. pcb ? layer ? 1 ? of ? rf ? layout ? example
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 16 pcb ? layer ? 2 ? of ? rf ? layout ? example module operation for programmable variant the modules with the programmable option have a second ary processor with 32k of fl ash and 2k of ram. this allows module integrators to put cu stom code on the xbee module to fit their own unique needs. the din, dout, rts, cts, and reset lines are intercepted by the se condary processor to allow it to be in control of the data transmitted and received. all other lines are in para llel and can be controlled by either the em357 or the mc9so8qe micro (see block diagram for details). the em 357 by default has control of certain lines. these lines can be released by the em357 by sending the prop er command(s) to disable th e desired dio line(s) (see xbee command reference tables). in order for the secondary processor to sample with adcs, the xbee pin 27 (vref) must be connected to a reference voltage. digi provides a bootloader that can take care of prog ramming the processor over the air or through the serial interface. this means that over the air updates can be supported through an xm odem protocol. the processor can also be programmed and debugged throug h a one wire interfa ce bkgd (pin 9).
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 17
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 18 xbee programmable bootloader overview the xbee programmable module is equipped with a freescale mc9s08qe3 2 application processor. this application processor come s with a supplied bootload er. this section descri bes how to interface the customer's application code runnin g on this processor to the xbee programmable module's supplied bootloader. the first section discusses how to in itiate firmware updates using the su pplied bootloader for wired and over- the-air updates. bootloader software specifics memory layout the figure below shows the memory map fo r the mc9s08qe32 application processor. the supplied bootloader occupies th e bottom pages of the flash from 0xf200 to 0xffff. application code cannot write to this space. the application code can exist in flash from address 0x8400 to 0xf1bc. 1k of flash from 0x8000 to 0x83ff is reserved for non volatile application data that will not be erased by the bootloader during a flash update. a portion of ram is accessible by both the applic ation and the bootloader. specifically, there is a shared data region used by both the application and the bootloader that is located at ram address 0x200 to 0x215. application code should not write anything to appresetcause or blresetcause unless informing the bootloader of the impending reset reason.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 19
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 20 operation upon reset of any kind, the execution control begins with the bootloader. if the reset cause is power-on re set (por), pin reset (pin), or low voltage detect (lvd) reset (lvd) the bootloader will not jump to the application co de if the override bits are set to rts(d7)=1, dtr(d5)=0, and din(b0)=0. othe rwise, the bootloader writes the reset cause "nothing" to the shared data region, and jumps to the application. reset causes are defined in the file common. h in an enumeration with the following definitions: typedef enum { bl_cause_nothing = 0x0000, //pin, lvd, por bl_cause_nothing_count = 0x0001,//bl_reset_cause counter // bootloader increments cause every reset bl_cause_bad_app = 0x0010,//bootloader considers app invalid } bl_reset_causes; typedef enum { app_cause_nothing = 0x0000, app_cause_use001 = 0x0001, // 0x0000 to 0x00ff are considered valid for app use. app_cause_use255 = 0x00ff, app_cause_firmware_update = 0x5981, app_cause_bypass_mode = 0x4682, app_cause_bootloader_menu = 0x6a18, } app_reset_causes; otherwise, if the reset cause is a "watchdog" or other reset, the bootloader checks the shared memory region for the app_reset_cause. if the reset cause is: 1."app_cause_nothing" or 0x0000 to 0x 00ff, the bootloader increments the ? bl_reset_causes, verifies that it is stil l less than bl_cause_bad_app, and jumps back to ? the application. if the application does not clear the bl_reset_cause, it can prevent an ? infinite loop of running a bad application that continues to perform illegal instructions or ? watchdog resets. 2."app_cause_firmware_ update", the bootloader has be en instructed to update the ? application "over-the-air" from a specific 64-b it address. in this case, the bootloader will ? attempt to initiate an xmodem transfer from the 64-bit address located in shared ram. 3."app_cause_bypass_mode", the b ootloader executes bypass mode. this mode passes the ? local uart data directly to the em357 allowing for direct communication with the em357. ? the only way to exit bypass mode is to reset or power cycle the module. if none of the above is true, the bootloader will enter "command mode". in this mode, users can initiate firmware downloads both wired and over-the-air, check applic ation/bootloader version strings, and enter bypass mode. application version string figure 1 shows an "application versio n string pointer" area in application flash which holds the pointer to where the application version st ring resides. the application's linker command file ultimately determines where this string is placed in application flash. it is preferable that the applicat ion version string be located at address 0x8400 for mc9s08qe32 parts. the application string can be any ch aracters terminated by the null character (0x00). there is not a strict limit on the number of char acters in the stri ng, but for practical purpos es should be kept under 100 bytes including the terminating null character. during an update the boot loader erases the entire application from 0x8400 on. the last page has the vect or table specifically the redirected reset vector. the version string pointer and reset vector are used to determine if the application is valid.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 21 application interrupt vector table and linker command file since the bootloader flash region is read-only, the interrupt vector ta ble is redirected to the region 0xf1c0 to 0xf1fd so that applicat ion developers can use hardware inte rrupts. note that in order for application interrupts to function properly, the a pplication's linker command file (*.prm extension) must be modified appropriately to allow the linker to place the developers code in the correct place in memory. for example, the develo per desires to use the serial communications port sci1 receive interrupt. the developer would add the following li ne to the codewarrior linker command file for the project: vector address 0x0000f1e0 vsci1rx this will inform the linker that the interrupt function "vsci1rx() " should be plac ed at address 0x0000f1e0. next, the developer should add a file to their project "vector_table.c" that creates an array of function pointers to the is r routines used by the application. extern void _startup(void);/* _s tartup located in start08.c */ extern void vsci1rx(void );/* sci1 rx isr */ extern short iwriteto sci1(unsigned char *); void vdummyisr(void); #pragma const_seg vectors void (* const vector_table[])(void) = /* relocated interrupt vector table */{ vdummyisr,/* int.no. 0 vtpm3ovf (at f1c0)unassigned */ vdummyisr, /* int.no. 1 vtpm3c h5 (at f1c2) unassigned */ vdummyisr, /* int.no. 2 vtpm3c h4 (at f1c4) unassigned */ vdummyisr, /* int.no. 3 vtpm3c h3 (at f1c6) unassigned */ vdummyisr, /* int.no. 4 vtpm3c h2 (at f1c8) unassigned */ vdummyisr, /* int.no. 5 vtpm3c h1 (at f1ca) unassigned */ vdummyisr, /* int.no. 6 vtpm3c h0 (at f1cc) unassigned */ vdummyisr, /* int.no. 7 vrtc (a t f1ce) unassigned */ vdummyisr, /* int.no. 8 vsci2t x (at f1d0) unassigned */ vdummyisr, /* int.no. 9 vsci2rx (at f1d2) unassigned */ vdummyisr, /* int.no. 10 vsci 2err (at f1d4) unassigned */ vdummyisr, /* int.no. 11 vacmpx (at f1d6) unassigned */ vdummyisr, /* int.no. 12 vadc (a t f1d8) unassigned */ vdummyisr, /* int.no. 13 vkeyboard (at f1da) unassigned */ vdummyisr, /* int.no. 14 viic (at f1dc) unassigned */ vdummyisr, /* int.no. 15 vsci1t x (at f1de) unassigned */ vsci1rx, /* int.no. 16 vsci1rx (at f1e0) sci1rx */ vdummyisr, /* int.no. 17 vsci 1err (at f1e2) unassigned */ vdummyisr, /* int.no. 18 vspi (a t f1e4) unassigned */ vdummyisr, /* int.no. 19 vres erved12 (at f1e6) unassigned */ vdummyisr, /* int.no. 20 vtpm2o vf (at f1e8) unassigned */ vdummyisr, /* int.no. 21 vtpm2c h2 (at f1ea) unassigned */ vdummyisr, /* int.no. 22 vtpm2c h1 (at f1ec) unassigned */ vdummyisr, /* int.no. 23 vtpm2c h0 (at f1ee) unassigned */ vdummyisr, /* int.no. 24 vtpm1o vf (at f1f0) unassigned */ vdummyisr, /* int.no. 25 vtpm1c h2 (at f1f2) unassigned */ vdummyisr, /* int.no. 26 vtpm1c h1 (at f1f4) unassigned */ vdummyisr, /* int.no. 27 vtpm1c h0 (at f1f6) unassigned */
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 22 vdummyisr, /* int.no. 28 vlvd (at f1f8) unassigned */ vdummyisr, /* int.no. 29 virq (a t f1fa) unassigned */ vdummyisr, /* int.no. 30 vswi (at f1fc) unassigned */ _startup /* int.no. 31 vreset (at f1fe) reset vector */ }; void vdummyisr(void){ for(;;){ if(iwritetosci1("stuck in unassigned isr\n\r>")); } } the interrupt routines themselves can be de fined in separate files. the "vdummyisr" function is used in conjunction with "iwritetos ci1" for debugging purposes. bootloader menu commands the bootloader accepts commands from both the local uart and ota. all ota commands sent must be unicast with only 1 byte in the payl oad for each command. a response wi ll be returned to the sender. all broadcast and multiple byte ota packets are droppe d to help prevent general ota traffic from being interpreted as a command to th e bootloader while in the menu. bypass mode - "b" the bootloader provides a "bypass" mode of oper ation that essentially connects the sci1 serial communications peripheral of the freescale mcu to the em357's serial uart channel. this allows direct communication to the em357 radio for the purpose of firmware and radio config uration changes. once in bypass mode, the x-ctu utility can change mo dem configuration and/or update em357 firmware. bypass mode automatically handles any baud rate up to 115.2kbps. note that this command is unavailable when module is accessed remotely. update firmware - "f" the "f" command initiates a firmware download fo r both wired and over-the -air configurations. depending on the source of the command (received via over the air or local uart), the download will proceed via wired or over -the-air respectively. adjust timeout for update firmware - "t" the "t" command changes the timeout before sendin g a nak by base-time*2^(t). the base-time for the local uart is different than the base-time fo r over the air. during a firmware update, the bootloader will automatically increase the timeout if repeat packets ar e received or mu ltiple naks for the same packet without success occur. application version string - "a" the "a" command provides the version of the currently loaded application. if no application is present, "unkown" will be returned. bootloader version string - "v" the "v" command provides the version of the currently loaded bootloader. the version will return a string in the format blfff-hhh-xyz_ddd wher e fff represents the flash size in kilo bytes, hhh is the hardware, xyz is the ve rsion, and ddd is the preferred xmodem packet size for updates. double the preferre d packet size is also possible, but not guaranteed. for example "bl032-2b0-023_064" will take 64-byte crc xmodem payloads and may take 128-byte crc xmodem payloads also. in this case, both 64 and 128 payloads are hand led, but the 64-byte payload is preferred for better over -the-air reliability.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 23 firmware updates wired updates a user can update their application using the bootlo ader in a wired configuration with the following steps: a. plug xbee programmabl e module into a suitable serial port on a pc. b. open a hyperterminal (or similar dumb terminal application) session with 9600 baud, no parity, and 8 data bits wi th one stop bit. c. hit enter to display the bootloader menu. d. hit the "f" key to initia te a wired firmware update. e. a series of "c" characters wi ll be displayed within the hyperterminal window. at this point, select the "transfer->send file" menu item. select the desired flat binary ou tput file. (the file should start at 0x8400 not 0x0000). f. select "xmodem" as the protocol. g. click "send" on the "send fi le" dialog. the file will be downloaded to the xbee programmable module. upon a successful update, the bootloader will jump to the newly loaded application. over-the-air updates a user can update their application using the bootlo ader in an "over-the-air" configuration with the following steps: (this procedure assumes that the bootloader is runn ing and not the application. the em357 baud rate must be set to 9600 baud. the bootloader only operates at 9600 baud. the application must be programmed with some way to support returning to the bootloader in order to support over-the-air (ota) updates without local intervention.) a. the xbee module sending the file ota (host module) should be set up with a series 2 xbee module with transparent mode firmware. b. the xbee programmable modu le receiving the update (remote module) is configured with api mode enabled. c. open a hyperterminal session to the host modu le with 9600 baud, no parity, no hardware flow control, 8 data bits and 1 stop bit. d.enter 3 pluses "+++" to pl ace the em357 in command mode. e. set the host module destinat ion address to the target module ?s 64-bit address that the host module will update (atdh aabbc cdd, atdl eeffgghh, atcn, where aabbccddeeffgghh is the hexa- decimal 64-bit a ddress of the target module). f. hit enter and the bootloader command menu will be displayed from th e remote module. (note that the option "b" doesn't exist for ota) g. hit the "f" key to cause the remote module to request the new firmwa re file over-the-air. h. the host module will begin receiving "c" characters indicati ng that the remote module is requesting an xmodem crc transfer. using x-ctu or another terminal prog ram, select "xmodem" file transfer. select the binary file to upload/tra nsfer. click send to start the transfer. at the con- clusion of a successful transfer, the bootloader will jump to the newly loaded application. output file configuration bkgd programming p&e micro provides a background debug tool that al lows flashing applications on the mc9s08qe parts through their background debug mode port. by de fault, the codewarrior t ool produces an "abs" output file for use in programming parts through th e background debug interf ace. the programmable xbee from the factory has the bkgd debugging capabili ty disabled. in order to debug, a bootloader with the debug interface enabled ne eds to be loaded on the secondary processor or a stand-alone app needs to be loaded.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 24 bootloader updates the supplied bootloader requires fi les in a "flat binary" format whic h differs from the default abs file produced. the codewarrior tool also produces a s 19 output file. in order to successfully flash new applications, the s19 file must be converted into the flat binary format. utilities are available on the web that will convert s19 output to "bin" outputs. often times, the "bin" file conversion will pad the addresses from 0x0000 to the code space with the sa me number. (often 0x00 or 0xff) these extra bytes before the app code starts will need to be deleted from the bin file before the file can be transferred to the bootloader.
? ? 2010 ? digi ? international, ? inc. ????? 25 2. ? rf ? module ? operation serial communications xbee rf modules interface to a host device through a serial port. throug h its serial port, the module can communicate with any logic and voltage compatible uart, through a level translator to any serial device (for example, through a rs-232 or usb interface board), or thro ugh a serial peripheral interface, which is a synchronous interface to be described later. two wire serial interface (twi) is also available, but no t supported by digi. for info rmation on the twi, see the em357 specification. uart data flow devices that have a uart interface can connect directly to the pins of the rf modu le as shown in the figure below. system ? data ? flow ? diagram ? in ? a ? uart \ interfaced ? environment ? (low \ asserted ? signals ? distinguished ? with ? horizontal ? line ? over ? signal ? name.) serial data data enters the module uart through the din (pin 4) as an asynchronous serial signal. the signal should idle high when no data is being transmitted. each data byte consists of a start bi t (low), 8 data bits (least significan t bit first) and a stop bit (high). the following figure illustrates the serial bit pattern of data passing through the module. uart ? data ? packet ? 0x1f ? (decimal ? number ?? 31 ? ) ? as ? transmitted ? through ? the ? rf ? module ? example ? data ? format ? is ? 8 \ n \ 1 ? (bits ?\? parity ?\? # ? of ? stop ? bits) serial communications depend on the two uarts (the microcontrolle r's and the rf module's) to be configured with compatible settings (baud rate , parity, start bits, st op bits, data bits). the uart baud rate, parity, and stop bits settings on the xbee module can be configured with the bd, nb, and sb commands respectively. see the command table in ch apter 10 for details. spi communications the xbee modules support spi communications in slave mo de. slave mode receives the clock signal and data from the master and returns data to the master. th e spi port uses the following signals on the xbee: ? spi_mosi (master out, slave in) - inputs serial data from the master ? spi_miso (master in, slave out) - outputs serial data to the master ? spi_sclk (serial clock) - clocks data transfers on mosi and miso din (data in) din (data in) dout (data out) dout (data out)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 26 ?spi_ssel (slave select) - enables serial communication with the slave the above four pins are standard for sp i. this module also supports an addi tional pin, which may be configured to alert the spi master when it has data to send. this pin is called spi_attn . if the master monitors this pin (through polling or interru pts), it can know when it needs to receive data from the module. spi_attn asserts whenever it has data to send and it remains asserted until all available data has been shifted out to the spi master. in this mode, th e following apply: ? data/clock rates of up to 5 mbps are possible ? data is msb first ? frame format mode 0 is used (see below) frame ? format ? for ? spi ? communications spi operation when the slave select (spi_ssel ) signal is asserted by the master, spi tr ansmit data is driven to the output pin (spi_miso), and spi data is received fro m the input pin spi_mosi. the spi_ssel pin has to be asserted to enable the transmit serializer to drive data to the output signal spi_miso. a falling edge on spi_ssel resets the spi slave shift registers. if the spi_sclk is present, the sp i_miso line is always driven wh ether with or without the spi_ssel line driven. this is a known issue with the ember em357 chip, and makes additional hardware necessary if multiple slaves are using the same bus as the xbee. if the input buffer is empty, the spi serializer transmits a busy token (0xff). otherwis e, all transactions on the spi port use api operation. see chapter 9 - api operation for more information. the spi slave controller must guarantee that there is ti me to move new transmit data from the transmit buffer into the hardware serializer. to prov ide sufficient time, the spi slave controller inserts a byte of padding at the start of every new string of transmit data. whenever th e transmit buffer is empty an d data is placed into the transmit buffer, the spi hardwa re inserts a byte of padding onto the front of the tran smission as if this byte were placed there by software. serial port selection in the default configuration the uart and spi ports will both be configured for serial port operation. if both interfaces are configured, serial da ta will go out the uart until the spi_ssel signal is asserted. thereafter, all serial co mmunications will operat e on the spi interface. if only the uart is enabled, then on ly the uart will be used, and spi_ssel will be ignored. if only the spi is enabled, then only the spi will be used. if neither serial port is enabled, the module will not support serial op erations and all co mmunications must occur over the air. all data that would norm ally go to the serial port is discarded. serial buffers the xbee modules maintain smal l buffers to collect received serial and rf data, which is illustrated in the figure below. the serial receive buffe r collects incoming serial characters and holds them until they can be processed.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 27 the serial transmit buffer collects data that is received via the rf link that will be transmitted out the uart or spi port. internal ? data ? flow ? diagram serial receive buffer when serial data enters the rf module through the serial port, the data is stored in the serial receive buffer until it can be processed. under certain conditions, the module may re ceive data when the serial receive buffer is already full. in that case the data is discarded. the serial receive buffer becomes full when data is streaming into the se rial port faster than it can be processed and sent over the air (ota). while the spee d of receiving the data on the serial port can be much faster than the speed of transmitting to data fo r a short period, sustained op eration in that mode will cause data to be dropped due to runn ing out of places in the module to put the data. some things that may delay over the air transmissions are address discovery, route discovery, and retransmissions. processing received rf data can also take away time and resources for processing incoming serial data. if the uart is the serial port and cts flow control is enabled, the external data source is alerted when the receive buffer is almost full. then the host holds off sending da ta to the module until the module asserts cts again, allowing more data to come in. if the spi is the serial port, no hardware flow control is available. it is the user 's responsibility to ensure that that receive buffer is not overflowed. one reliable strategy is to wait for a tx_status response after each frame sent to ensu re that the module has had time to process it. serial transmit buffer when rf data is received, the data is moved into th e serial transmit buffer and sent out the uart or spi port. if the serial transmit buffer be comes full enough such that all data in a received rf packet won't fit in the serial transmit buffer, the en tire rf data packet is dropped. cases in which the serial transmit buffer may become full resulting in dropped rf packets: 1 if the rf data rate is set higher than the inte rface data rate of the module, the module could receive data faster than it ca n send the data to the host. 2 if the host does not allow the module to transmit data out from the serial transmit buffer because of being held off by hardware flow control. uart flow control the rts and cts module pins can be used to provide rts and/or cts flow control. cts flow control provides an indication to the host to stop sending serial data to th e module. rts flow control allo ws the host to signal the module to not send data in the seri al transmit buffer out the uart. rts and cts flow control are enabled using the d6 and d7 commands. please note that serial port flow control is no t possible when using the spi port. serial receiver buffer rf tx buffer transmitter rf switch antenna port receiver serial transmit buffer rf rx buffer processor t din or mosi cts (if d7 is 1 and uart is in use) dout or miso rts (if uart is in use, ignored un- less d6 is 1)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 28 cts flow control if cts flow control is enabled (d7 command), when the seri al receive buffer is 17 bytes away from being full, the module de-asserts cts (sets it high) to signal to the host de vice to stop sending serial data. cts is re-asserted after the serial rece ive buffer has 34 bytes of space. rts flow control if rts flow control is enabled (d6 command), data in the serial transm it buffer will not be sent out the dout pin as long as rts is de-asserted (set high). the host device should not de-assert rts for long periods of time to avoid filling the serial transmit buffe r. if an rf data packet is received, and the serial transmit buffer does not have enough space for all of the data bytes, th e entire rf data packet will be discarded. note : if the xbee is sending data out the uart when rts is de-asserted (set high), the xbee could send up to 5 characters out the uart or spi port after rts is de-asserted. serial interface protocols the xbee modules support bo th transparent and api (application prog ramming interface) se rial interfaces. transparent operation when operating in transparent mode, the modules act as a seri al line replacement. all uart or spi data received through the din or mosi pin is queued up for rf transmission. when rf data is received, the data is sent out through the serial po rt. the module configuration parame ters are configured using the at command mode interface. please note that transparent operation is not provided when using the spi. data is buffered in the seri al receive buffer until one of the followin g causes the data to be packetized and transmitted: ?no serial characters are received for the amount of time de termined by the ro (packetization time- out) parameter. if ro = 0, packetizatio n begins when a character is received. ?the command mode sequence (gt + cc + gt) is received. any character buffered in the serial receive buffer befo re the sequence is transmitted. ?the maximum number of characters that will fit in an rf packet is received. api operation api operation is an alternative to transparent operation. the frame-base d api extends the level to which a host application can interact with the networking capa bilities of the module. wh en in api mode, all data entering and leaving the module is co ntained in frames that define operat ions or events within the module. transmit data frames (received through the serial port) include: ?rf transmit data frame ?command frame (equivalent to at commands) receive data frames (sent out the serial port) include: ?rf-received data frame ?command response ?event notifications such as reset, associate, disassociate, etc. the api provides alternative means of configuring module s and routing data at the host application layer. a host application can send data frames to the module that contain address and payload information instead of using command mode to modify addresses. the module will send data frames to the application containing status packets; as we ll as source, and payload inform ation from received data packets. the api operation option facilitates many op erations such as the examples cited below: -> transmitting data to multiple dest inations without entering command mode -> receive success/failure status of each transmitted rf packet -> identify the source address of each received packet
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 29 a comparison of transp arent and api operation the following table compares the advantages of transparent and api modes of operation: as a general rule of thumb, api mo de is recommended when a device: ? sends rf data to multiple destinations ? sends remote configuration commands to manage devices in the network ? receives rf data packets from multiple devices, an d the application needs to know which device sent which packet ? must support mult iple zigbee endpoints, cluste r ids, and/or profile ids ? uses the zigbee device profile services. api mode is required when: ? using smart energy firmware ? using spi for the serial port ? receiving i/o samples from remote devices ? using source routing if the above conditions do not apply (e.g. a sensor no de, router, or a simple appl ication), then transparent operation might be suitable. it is acceptable to use a mixture of devi ces running api mode and transparent mode in a network. transparent operation features simple interface all received serial data is transmitted unless the module is in command mode. easy to support it is easier for an application to support transparent operation and command mode api operation features easy to manage data transmissions to multiple destinations transmitting rf data to multiple remotes only requi res changing the address in the api frame. this process is much faster than in transparent oper ation where the application must enter at command mode, change the address, exit command mode, and then transmit data. each api transmission can return a transmit status frame indicating the success or reason for failure. received data frames indicate the sender's address all received rf data api frames indicate the source address. advanced zigbee addressing support api transmit and receive frames can expose zi gbee addressing fields including source and destination endpoints, cluster id and profile id. this makes it easy to support zdo commands and public profile traffic. advanced networking diagnostics api frames can provide indication of io samples from remote devices, and node identification messages. remote configuration set / read configuration commands can be sent to remote devices to configure them as needed using the api.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 30 modes of operation idle mode when not receiving or transmitting data, the rf module is in idle mode. the module shifts into the other modes of operation under the following conditions: ?transmit mode (serial data in the serial receive buffer is ready to be packetized) ?receive mode (valid rf data is received through the antenna) ?sleep mode (end devices only) ?command mode (command mode sequ ence is issued, not available with smart energy software or when using the spi port) transmit mode when serial data is received and is ready for packetization, the rf module will exit idle mode and attempt to transmit the data. the destination address dete rmines which node(s) will receive the data. prior to transmitting the data, the module ensures that a 16-bit network address and route to the destination node have been established. if the destination 16-bit network address is not known, ne twork address discovery will take place. if a route is not known, route discovery will take place for the purpos e of establishing a route to the destination node. if a module with a matching network address is not discovered, the packet is disc arded. the data will be transmitted once a route is established. if route discovery fails to establish a route, the pa cket will be discarded. transmit ? mode ? sequence 16-bit network address discovery data discarded successful transmission yes no new transmission 16-bit network address discovered? route known? route discovered? 16-bit network address known? route discovery transmit data idle mode no yes no no yes yes
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 31 when data is transmitted from one node to another, a network-level acknowledgement is transmitted back across the established route to the source node. this ac knowledgement packet indicate s to the source node that the data packet was received by th e destination node. if a network acknowledgement is not received, the source node will re-transmit the data. it is possible in rare circumstances for the destination to receive a data pa cket, but for the source to not receive the network acknowledgment. in this case, the source will retransmit the data, which could cause the destination to receive the same data packet multiple times. the xbee modules do not filter out duplicate packets. the application should include pr ovisions to address this potential issue see data transmission and routing in chapter 4 for mo re information. receive mode if a valid rf packet is received, the data is transferred to the serial transmit buffer. command mode to modify or read rf module parameters, the module must first enter into command mode - a state in which incoming serial characters are interpreted as commands. command mode is only available over the uart when not using the smart energy firmware . the api mode section in chapter 9 describes an alternate means for configuring modules which is available with the spi and with smart energy, as well as over the uart with zb code. at command mode to enter at command mode: send the 3-character command se quence ?+++? and observe guard times before and after the com- mand characters. [refer to the ?defau lt at command mode sequence? below.] default at command mode sequence (for transition to command mode): ?no characters sent for one second [gt (guard times) parameter = 0x3e8] ?input three plus characters (? +++?) within one second [cc (command sequence character) parame- ter = 0x2b.] ?no characters sent for one second [gt (guard times) parameter = 0x3e8] once the at command mode sequence has been issued, the module sends an "ok\r" out the uart pad. the "ok\r" characters can be delayed if the module ha s not finished transmitting received serial data. when command mode has been ente red, the command mode timer is started (c t command), and the module is able to receive at commands on the uart port. all of the parameter values in the sequence can be modified to reflect user preferences. note: failure to enter at command mode is most commonly due to ba ud rate mismatch. by default, the bd (baud rate) parameter = 3 (9600 bps). to send at commands: send at commands and parameters using the syntax shown below. ? syntax ? for ? sending ? at ? commands ? to read a parameter value stored in the rf module?s register, omit the parameter field. the preceding example would change the rf module de stination address (low) to ?0x1f?. to store the new value to non-volatile (long term) memory, subsequently send the wr (write) command. example: atdl 1f at prefix ascii command space (optional) parameter (optional, hex) carriage return
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 32 for modified parameter values to persist in the module ?s registry after a reset, changes must be saved to non-volatile memory using the wr (write) command. otherw ise, parameters are re stored to previously saved values after th e module is reset. command response when a command is sent to the module, the modu le will parse and execute the command. upon successful execution of a command, the module retu rns an ?ok? message. if execution of a command results in an error, the modu le returns an ?error? message. applying command changes any changes made to the configuration command register s through at commands will not take effect until the changes are applied. for example, sending the bd command to change the baud rate will not change the actual baud rate until change s are applied. changes can be appl ied in one of the following ways: ?the ac (apply changes) command is issued. ?at command mode is exited. to exit at command mode: 1. send the atcn (exi t command mode) command (fol lowed by a carriage return). [or] 2. if no valid at commands are received within the time specified by ct (command mode timeout) command, the rf module automa tically returns to idle mode. for an example of programming the rf module using at commands and descriptions of each config- urable parameter, please see th e command reference table chapter. sleep mode sleep modes allow the rf module to enter states of lo w power consumption when not in use. xbee rf modules support both pin sleep (sleep mode en tered on pin transition) an d cyclic sleep (module sl eeps for a fixed time). xbee sleep modes are discusse d in detail in chapter 7.
? ? 2010 ? digi ? international, ? inc. ????? 33 3. ? xbee ? zigbee ? networks introduction to zigbee zigbee is an open global standard bu ilt on the ieee 802.15.4 mac/phy. zi gbee defines a network layer above the 802.15.4 layers to support advanced mesh routing capabili ties. the zigbee specificatio n is developed by a growing consortium of companies that make up the zigbee alliance. the alliance is made up of over 300 members, including semiconductor, module, stack, and software developers. zigbee stack layers the zigbee stack consists of several layers including the phy, mac, network, applicat ion support sublayer (aps), and zigbee device objects (zdo) layers. technically, an a pplication framework (af) laye r also exists, but will be grouped with the aps layer in rema ining discussions. the zigbee laye rs are shown in the figure below. a description of each layer a ppears in the following table: networking concepts device types zigbee defines three different device types: coordinato r, router, and end device. node types / sample of a basic zigbee network topology a coordinator has the following characteristics: it ... ?selects a channel and pan id (both 64 -bit and 16-bit) to start the network ?can allow routers and end de vices to join the network ?can assist in routing data ?cannot sleep--should be mains powered ?can buffer rf data packets for sleeping end device children. zigbee layer description phy defines the physical operation of the zigbee device including receive sensitivity, channel rejection, output power, number of channels, chip modulation, and transmission rate specifications. most zigbee applications operate on the 2.4 ghz ism band at a 250kbps data rate. see the ieee 802.15.4 specification for details. mac manages rf data transactions betw een neighboring devices (point to point). the mac includes services such as transmission retry and acknowledgment management, and collision avoidance techniques (csma-ca). network adds routing capabilities that allows rf data packets to traverse multiple devices (multiple "hops") to route data from source to destination (peer to peer). aps (af) application layer that defines various addressing objects including profiles, clusters, and endpoints. zdo application layer that provides devi ce and service discovery features and advanced network management capabilities.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 34 a router has the following characteristics: it ... ?must join a zigbee pan before it can transmit, receive, or route data ?after joining, can allow routers an d end devices to join the network ?after joining, can assist in routing data ?cannot sleep--should be mains powered. ?can buffer rf data packets for sleeping end device children. an end device has the following char acteristics: it ... ?must join a zigbee pan before it can transmit or receive data ?cannot allow devices to join the network ?must always transmit and re ceive rf data through its pa rent, and cannot route data. ?can enter low power modes to conserve power and can be battery-powered. an example of such a network is shown below: in zigbee networks, the coordinator must select a pan id (64-bit and 16-bit) and ch annel to start a network. after that, it behaves essentially like a router. the coor dinator and routers can allow other devices to join the network and can route data. after an end device joins a ro uter or coordinator, it must be able to transmit or receive rf data through that router or coordinator. the router or coordinator that al lowed an end device to join becomes the "parent" of the end device. since the en d device can sleep, the parent must be able to buffer or retain incoming data packets destined for the end device until the end devi ce is able to wake and receive the data. a module can only operate as one of th e three device types. th e device type is selected by configuration rather than by firmware image as was the case on earlier hardware platforms. by default, the module operates as a router in transparent mode. to select coordinator operation, set ce to 1. to select end device operation, set sm to a non-zero value. to select router operatio n, both ce and sm must be 0. one complication is that if a device is a coordinator and it needs to be changed into an end device, ce must be set back to 0 first. if not, the sm configuration will conflict with the ce configuration. likewise, to change an end device into a coordi nator, it must be changed into a router first. another complication is that default pa rameters for a router build don't alwa ys work very well for a coordinator build. for example: dh/dl is 0 by default, which allows routers and end devices to send data to the coordinator when they first come up. if dh/dl is not changed from the default value when the device is changed to a coordinator, then the device will send data to itself, causing characters to be echoed back to the screen as they are typed. since this is probably not the desired operation, dh/dl should be set to the broadcas t address or some specific unicast address when the device is changed to a coordinator. another example is eo for smart energy builds. this value should be 08 for routers and end devices and it should be 02 for the coordinator to de signate it as the trust center. therefore, if using authentication, which is the normal case for smart energy builds, eo should be changed from 02 to 08 when ce is set to 1. in general, when changing de vice types, it is the user's responsibility to ensure that parameters are set to be compatible with the new device type.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 35 pan id zigbee networks are called personal area networks or pans. each netw ork is defined with a unique pan identifier (pan id). this identifier is common among all devices of the same network. zigbee devices are either preconfigured with a pan id to join , or they can discover nearby netw orks and select a pan id to join. zigbee supports both a 64-bit and a 16- bit pan id. both pan ids are used to uniquely identify a network. devices on the same zigbee network must share the same 64-bit and 16-bit pan ids. if multiple zigbee networks are operating within range of each ot her, each should have unique pan ids. the 16-bit pan id is used as a mac layer addressing fi eld in all rf data transmis sions between devices in a network. however, due to the limited addressing space of the 16-bit pan id (65,535 possibilities), there is a possibility that multiple zigbee networks (within range of each other) could use the same 16-bit pan id. to resolve potential 16-bit pan id conflicts, the zigbee alliance created a 64-bit pan id. the 64-bit pan id (also called the extended pan id), is intended to be a unique, non-duplicated value. when a coordinator starts a network, it can either start a networ k on a preconfigured 64-bit pan id, or it can select a random 64-bit pan id. the 64-bit pan id is used during joining; if a device has a preconfigured 64-bit pan id, it will only join a network with the same 64-bit pan id . otherwise, a device could join any detected pan and inherit the pan id from the network when it joins. the 64-bit pan id is included in all zigbee beacons and is used in 16-bit pan id conflict resolution. routers and end devices are typically configured to join a network with any 16-bit pan id as long as the 64-bit pan id is valid. coordinators typically sele ct a random 16-bit pan id for their network. since the 16-bit pan id only allows up to 65,535 unique values, and since the 16-bit pan id is randomly selected, provisions exist in zigbee to detect if two networks (with different 64-bit pan ids) are operating on the same 16-bit pan id. if such a conflict is detected, the zigbee stack can perform pan id conflict resolution to change the 16-bit pan id of the network in order to reso lve the conflict. see the zigbee specification for details. to summarize, zigbee routers and end devices should be configured with the 64-bit pan id of the network they want to join. they typically acquire the 16-b it pan id when they join a network. operating channel zigbee utilizes direct-sequence spread spectrum modulation and operates on a fixed channel. the 802.15.4 phy defines 16 operating channels (channels 11 to 26) in th e 2.4 ghz frequency band. xbee modules support all 16 channels. zigbee application layers: in depth this section provides a more in-depth look at the zigbee application stack layers (aps, zdo) including a discussion on zigbee endpoints, clusters, and profiles. much of the material in this section can introduce unnecessary details of the zigbee stack that are not required in many cases. skip this section if ?the xbee does not need to interoperate or talk to non-digi zigbee devices ?the xbee simply needs to send data between devices. read this section if ?the xbee may talk to non-digi zigbee devices ?the xbee requires network management and discovery capabilities of the zdo layer ?the xbee needs to operate in a public application profile (smart energy, home automation, etc.) application support sublayer (aps) the aps layer in zigbee adds support for appl ication profiles, cluster ids, and endpoints. application profiles application profiles specify various device descriptions in cluding required functionalit y for various devices. the collection of device descriptions form s an application profile. application profiles can be defined as "public" or "private" profiles. private profiles are defined by a manufacturer whereas publ ic profiles are defined, developed,
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 36 and maintained by the zigbee alliance . each application profile has a unique profile identifier assigned by the zigbee alliance. examples of public profiles include: ?home automation ?smart energy ?commercial building automation the smart energy profile, for example, defines various device types includ ing an energy serv ice portal, load controller, thermostat, in-home display, etc. the smart energy profile defi nes required functi onality for each device type. for example, a load cont roller must respond to a defined comma nd to turn a load on or off. by defining standard communication protoc ols and device functional ity, public profiles al low interoperable zigbee solutions to be developed by independent manufacturers. digi xbee zb firmware oper ates on a private profile called the digi drop-in networking profile. however, api mode can be used in many cases to talk to devices in public profiles or non-digi private profiles. see the api operations chapter for details. clusters a cluster is an applicatio n message type defined within a profile. clusters are used to specify a unique function, service, or action. for ex ample, the following are some cluste rs defined in the home automation profile: ?on/off - used to switch devices on or off (lights, th ermostats, etc.) ?level control - used to control devices that can be set to a level between on and off ?color control - controls the color of color capable devices. each cluster has an associated 2-byte cluster identifier (cluster id). the cluster id is included in all application transmissions. clusters often have associ ated request and response messages. for example, a smart energy gateway (service portal ) might send a load control event to a load controller in order to schedule turning on or off an applia nce. upon executing the event, the load controller would send a load control report message back to the gateway. devices that operate in an applicat ion profile (private or public) must respond correctly to all required clusters. for example, a light switch that will operate in the home automa tion public profil e must correctly implement the on/off and other requir ed clusters in order to interoperate with other home automation devices. the zigbee alliance has defi ned a zigbee cluster libr ary (zcl) that contains definitions or various general use clusters that could be implemented in any profile. xbee modules implement va rious clusters in the digi private profile. in addition, the api can be used to send or receive messages on any cluster id (and prof ile id or endpoint). see the explicit addressing zigbee command api frame in chapter 3 for details. endpoints the aps layer includes supports for endpoints. an endpo int can be thought of as a running application, similar to a tcp/ip port. a single device can support one or more endpo ints. each application endpoint is identified by a 1-byte value, ranging from 1 to 240. each defined endpoint on a device is tied to an application profile. a device could, for example, implement one endpoint that supports a smart energy load controller, and another endpoint that support s other functionality on a private profile. zigbee device profile profile id 0x0000 is reserved for the zigbee device profile. this profile is implemented on all zigbee devices. device profile defines many device and service discovery features and network management capabilities. endpoint 0 is a reserved endpoint that su pports the zigbee device pr ofile. this endpoint is called the zigbee device objects (zdo) endpoint. zigbee device objects (zdo) the zdo (endpoint 0) support s the discovery and manageme nt capabilities of the zi gbee device profile. a complete listing of all zdp services is included in the zigbee specification. each service has an associated cluster id. the xbee zb firmware allows applications to easily send zdo messages to devices in the network using the api. see the zdo transmissions section in chapter 4 for details.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 37 coordinator operation forming a network the coordinator is responsible for sele cting the channel, pan id (16-bit an d 64-bit), security policy, and stack profile for a network. since a coordinator is the only de vice type that can start a network, each zigbee network must have one coordinator. after the coordinator has st arted a network, it can allo w new devices to join the network. it can also route data packets and communicate with other devices on the network. to ensure the coordinator starts on a good channel and unused pan id, the coordinator performs a series of scans to discover any rf activity on different channels (energy scan) and to discover any nearby operating pans (pan scan). the process for selecting the channel an d pan id are described in the following sections. channel selection when starting a network, the coordinator must select a "good" channel for the network to operate on. to do this, it performs an energy sc an on multiple channels (f requencies) to dete ct energy levels on each channel. channels with excessive energy levels are removed from its list of potentia l channels to start on. pan id selection after completing the energy scan, the coordinator scans it s list of potential channels (remaining channels after the energy scan) to obtain a list of neighboring pans . to do this, the coordinator sends a beacon request (broadcast) transmission on each potential channel. al l nearby coordinators and routers (that have already joined a zigbee network) will respon d to the beacon request by sending a beacon back to the coordinator. the beacon contains information about the pan the device is on, including the pan identifiers (16-bit and 64-bit). this scan (collecting beacons on the potential channels) is typically called an active scan or pan scan. after the coordinator completes the channel and pan scan, it selects a random channel and unused 16-bit pan id to start on. security policy the security policy determines wh ich devices are allowed to join th e network, and which device(s) can authenticate joining devices. see chapter 5 for a detailed discussion of various security policies. persistent data once a coordinator has started a network, it retains the following information th rough power cycle or reset events: ?pan id ?operating channel ?security policy and frame counter values ?child table (end device children that are joined to the coordinator). the coordinator will retain this inform ation indefinitely until it leaves the network. when the coordinator leaves a network and starts a new network, the previous pan id, operating channe l, and child table data are lost. xbee zb coordinator startup the following commands control the co ordinator network formation process. network ? formation ? commands ? used ? by ? the ? coordinator ? to ? form ? a ? network. command description id used to determine the 64-bit pan id. if set to 0 (default), a random 64-bit pan id will be selected. sc determines the scan channels bitmask (up to 16 c hannels) used by the coordinator when forming a network. the coordinator will perf orm an energy scan on all enabled sc channels. it will then perform a pan id scan and then form the network on one of the sc channels.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 38 once the coordinator starts a network, the network conf iguration settings and child table data persist through power cycles as mentioned in the "persistent data" section. when the coordinator has successfully started a network, it ? allows other devices to join the network for a time (see nj command) ? sets ai=0 ? starts blinking the associate led ? sends an api modem status frame ("coordinator st arted") out the serial po rt when using api mode. these behaviors are configurable using the following commands: if any of the command values in the network formation commands table chan ges, the coordinato r will leave its current network and start a new network, possibly on a different channel. note that command changes must be applied (ac or cn command) before taking effect. permit joining the permit joining attribute on the coordinator is config urable with the nj command. nj can be configured to always allow joining, or to allow joining for a short time. joining always enabled if nj=0xff (default), joining is permanently enabled. this mode should be used carefully. once a network has been deployed, the application should strongly consider disabling joining to prevent unwanted joins from occurring. joining temporarily enabled if nj < 0xff, joining will be enabled only for a number of seconds, based on the nj parameter. the timer is started once the xbee joins a network. joining will not be re-enabled if the module is power cycled or reset. the following mechanisms can re start the permit-joining timer: ? changing nj to a different value (and a pplying changes with the ac or cn commands) ? pressing the commissioning button twice ? issuing the cb command with a parameter of 2 the last two cases enable joining fo r one minute if nj is 0x0 or 0xff. otherwise, the comm issioning button and the cb2 command enable joining for nj seconds. resetting the coordinator when the coordinator is reset or power cycled, it checks its pan id, operating channe l and stack profile against the network configuration settings (id, ch, zs). it also verifies the saved security policy against the security configuration settings (ee, nk, ky). if the coordinator' s pan id, operating channel, stack profile, or security sd set the scan duration period. this value determines how long the coordinator pe rforms an energy scan or pan id scan on a given channel. zs set the zigbee stack profile for the network. ee enable or disable security in the network. nk set the network security key for the network. if se t to 0 (default), a random ne twork security key will be used. ky set the trust center link key for the network. if set to 0 (default), a random link key will be used. eo set the security policy for the network. command description nj sets the permit-join time on the coordinator, measured in seconds. d5 enables the associate led functionality. lt sets the associate led blink time when joined. default is 1 blink per second.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 39 policy is not valid based on its network and security co nfiguration settings, then the coordinator will leave the network and attempt to form a new network ba sed on its network formation command values. to prevent the coordinator from leaving an existing ne twork, the wr command should be issued after all network formation commands have been configured in or der to retain these settin gs through power cycle or reset events. leaving a network there are a couple of mechanisms th at will cause the coordinator to le ave its current pan and start a new network based on its network formation para meter values. these include the following: ?change the id command such that the current 64-bit pan id is invalid. ?change the sc command such that the current channel (ch) is not included in the channel mask. ?change the zs or any of the security command values (excluding nk). ?issue the nr0 command to cause the coordinator to leave. ?issue the nr1 command to send a broadcast transmission, causing all devices in the network to leave and migrate to a different channel. ?press the commissioning button 4 times or issue the cb command with a parameter of 4. ?issue a network leave command. note that changes to id, sc, zs, and security command values only take effect wh en changes are applied (ac or cn commands). replacing a coordinator (security disabled only) in rare occasions, it may become necessary to replace an existing coordinator in a network with a new physical device. if security is not enabled in the network, a replacement xbee coordinator can be configured with the pan id (16-bit and 64-bit), channel, and stack profile settings of a running network in order to replace an existing coordinator. note: having two coordinators on the same channel, st ack profile, and pan id ( 16-bit and 64-bit) can cause problems in the network and should be avoided. when replacin g a coordinator, the old coordinator should be turned off before starti ng the new coordinator. to replace a coordinator, the fo llowing commands should be read from a device on the network: each of the commands listed above can be read from any device on the network. (these parameters will be the same on all devices in the networ k.) after reading these commands from a device on the network, these parameter values should be programmed into the new coordinator using the following commands. at command description op read the operating 64-bit pan id. oi read the operating 16-bit pan id. ch read the operating channel. zs read the stack profile. at command description id set the 64-bit pan id to match the read op value. ii set the initial 16-bit pan id to match the read oi value. sc set the scan channels bitmask to enable the read operating channel (ch command). for example, if the operating channel is 0x0b, set sc to 0x0001. if the operating channel is 0x17, set sc to 0x1000. zs set the stack profile to match the read zs value.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 40 note : ii is the initial 16-bit pan id. under certain conditio ns, the zigbee stack can change the 16-bit pan id of the network. for this reason, the ii command cannot be saved using the wr comman d. once ii is set, the coordinator leaves the network and starts on the 16-bit pan id specified by ii. example: starting a coordinator 1. set ce (coordinator enable) to 1, and use the wr command to save the changes. 2. set sc and id to the desired sc an channels and pan id values. (the defaults sh ould suffice.) 3. if sc or id is changed from the default, issue the wr command to save the changes. 4. if sc or id is changed from the default, appl y changes (make sc and id changes take effect) either by sending the ac command or by exiting at command mode. 5. the associate led will start blinking once the coordinator has selected a channel and pan id. 6. the api modem status frame ("co ordinator started") is sent out the serial port when using api mode. 7. reading the ai command (association status) will return a value of 0, indicating a successful startup. 8. reading the my command (16-bit address) will re turn a value of 0, the zigbee-defined 16-bit address of the coordinator. after startup, the coordinator will allow joining based on its nj value. example: replacing a coordinator (security disabled) 1. read the op, oi, ch, and zs commands on the running coordinator. 2. set the ce, id, sc, and zs parameters on th e new coordinator, followed by wr command to save these parameter values. 3. turn off the running coordinator. 4. set the ii parameter on the new coordinator to match the read oi value on the old coordinator. 5. wait for the new coordinator to start (ai=0). router operation routers must discover and join a vali d zigbee network before they can part icipate in a zigbee network. after a router has joined a network, it can allow new devices to join the network. it can also route data packets and communicate with other devices on the network. discovering zigbee networks to discover nearby zigbee networks, the router performs a pan (or active) scan, ju st like the coordinator does when it starts a network. during th e pan scan, the router sends a beacon request (broadcast) transmission on the first channel in its scan channels list. all nearby coor dinators and routers operating on that channel (that are already part of a zigbee network) re spond to the beacon request by sendin g a beacon back to the router. the beacon contains information about the pan the nearby device is on, includin g the pan identifier (pan id), and whether or not joining is allowed. the router evaluates each beacon received on the channel to determine if a valid pan is found. a router considers a pan to be valid if the pan: ?has a valid 64-bit pan id (pan id matches id if id > 0) ?has the correct stack profile (zs command) ?is allowing joining. if a valid pan is not found, the router performs the pan scan on the next channel in its scan channels list and continues scanning until a valid network is found, or until all channels have been scanned. if all channels have been scanned and a valid pan was not discover ed, all channels will be scanned again. the zigbee alliance requires that certified solutions not send beacon request messages too frequently. to meet certification requirements, the xbee fi rmware attempts 9 scans per minute for the first 5 minutes, and 3 scans per minute thereafter. if a valid pan is within range of a joining router, it should typically be discovered within a few seconds.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 41 joining a network once the router discovers a valid network, it sends an as sociation request to the device that sent a valid beacon requesting a join on the zigbee network. the device allo wing the join then sends an association response frame that either allows or denies the join. when a router joins a network, it receives a 16-bit address from the devi ce that allowed the join. the 16-bit address is randomly selected by the device that allowed the join. authentication in a network where security is enabled, the router must then go through an authen tication process. see the security chapter for a discussion on security and authentication. after the router is joined (and authenticated, in a secure network), it can allow new devices to join the network. persistent data once a router has joined a network, it retains the fo llowing information through power cycle or reset events: ?pan id ?operating channel ?security policy and frame counter values ?child table (end device children that are joined to the coordinator). the router will retain this information indefinitely until it leaves the network. when the router leaves a network, the previous pan id, operating channe l, and child table data are lost. xbee zb router joining when the router is powered on, if it is not already joined to a valid zigbee network, it immediately attempts to find and join a vali d zigbee network. note: the dj command can be set to 1 to disable joinin g. the dj parameter cannot be written with wr, so a power cycle always clears the dj setting. the following commands control the router joining process. once the router joins a network, the network configurat ion settings and child table data persist through power cycles as mentioned in the "persistent data" section prev iously. if joining fails, the status of the last join attempt can be read in the ai command register. if any of the above command valu es change, when command register changes are applied (ac or cn commands), the router will leave it s current network and attempt to discover and join a new valid network. when a zb router has successfully joined a network, it: ?allows other devices to jo in the network for a time ?sets ai=0 ?starts blinking the associate led command description id sets the 64-bit pan id to join. setting id=0 allows the router to join any 64-bit pan id. sc set the scan channels bitmask that determines which channels a router will scan to find a valid network. sc on the router should be set to match sc on the coordinator. for example, setting sc to 0x281 enables scanning on channels 0x0b, 0x12, and 0x14, in that order. sd set the scan duration, or time that the router will listen for beacons on each channel. zs set the stack profile on the device. ee enable or disable security in the network. this must be set to match the ee value (security policy) of the coordinator. ky set the trust center link key. if set to 0 (default), the link key is expected to be obtained (unencrypted) during joining.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 42 ?sends an api modem st atus frame ("associated") out the serial port when using api mode. these behaviors are configurable using the following commands: permit joining the permit joining attribute on the router is configurable with the nj command. nj can be configured to always allow joining, or to allow joining for a short time. joining always enabled if nj=0xff (default), joining is permanently enabled. th is mode should be used carefully. once a network has been deployed, the a pplication should strongly consider disabl ing joining to prevent unwanted joins from occurring. joining temporarily enabled if nj < 0xff, joining will be enabled only for a number of seconds, based on the nj parameter. the timer is started once the xbee joins a network. joining will not be re-enabled if the module is power cycled or reset. the following mechanisms can rest art the permit-joining timer: ? changing nj to a different value (and a pplying changes with the ac or cn commands) ? pressing the commissioning button twice ? issuing the cb command with a parameter of 2 (software emulation of a 2 button press) ? causing the router to leave and rejoin the network. the middle two cases enable joining for one minute if nj is 0x0 or 0xff. otherwise, the commissioning button and the cb2 command enable joining for nj seconds. router network connectivity once a router joins a zigbee network, it remains connected to the network on the same channel and pan id as long as it is not forced to leave. (see ?leaving a network? section for details.) if the scan channels (sc), pan id (id) and security settings (ee, ky) do not change after a power cycle, the router will remain connected to the network after a power cycle. if a router may physically move out of range of the ne twork it initially joined, the application should include provisions to detect if the router can still communicat e with the original network. if communication with the original network is lost, the application may choose to force the router to leave the network (see leaving a network section below for details). th e xbee firmware includes two provis ions to automatically detect the presence of a network, and leave if the check fails. power-on join verification the jv command (join verification) enables the power-on join verification check. if enabled, the xbee will attempt to discover the 64-bit address of the coordinator when it first joins a network. once it has joined, it will also attempt to discover the 64-bit address of th e coordinator after a power cycle event. if 3 discovery attempts fail, the router will leave the network and try to join a new network. powe r-on join verification is disabled by default (jv defaults to 0). network watchdog the nw command (network watchdog timeout) can be us ed for a powered router to periodically check for the presence of a coordinator to verify network co nnectivity. the nw command specifies a timeout in command description nj sets the permit-join time on the router, or the time that it will allow new devices to join the network, measured in seconds. if nj=0xff, permit joining will always be enabled. d5 enables the associate led functionality. lt sets the associate led blink time when joined. default is 2 blinks per second (router).
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 43 minutes where the router must receive communication from the coordinator or data collector. the following events restart the network watchdog timer: ?rf data received from the coordinator ?rf data sent to the coordinator and an acknowledgment was received ?many-to-one route request wa s received (from any device) ?changing the value of nw. if the watchdog timer expires (no valid data received fo r nw time), the ro uter will attempt to discover the 64-bit address of the coordinator. if the address ca nnot be discovered, the router records one watchdog timeout. once three consecutive network watchdog ti meouts have expired (3 * nw) and the coordinator has not responded to the address discovery attempts, the router will leave the network and attempt to join a new network. anytime a router receives valid data fro m the coordinator or data collector, it will clear the watchdog timeouts counter and restart the watchdog timer. the watchdog timer (nw command) is settable to several days. the network watchdog feature is disabled by defaul t (nw defaults to 0). leaving a network there are a couple of mechan isms that will cause the router to leav e its current pan and attempt to discover and join a new network based on it s network joining parameter values. these include the following: clear network watchdog failure count restart network watchdog timer received rf communication from coordinator or data collector yes network watchdog timer expired? no no discover coordinator yes coordinator found? yes network watchdog failure count +=1 no network watchdog failure count =3 ? leave yes no network watchdog behavior
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 44 ? change the id command such that the current 64-bit pan id is invalid. ? change the sc command such that the current ch annel (ch) is not included in the channel mask. ? change the zs or any of the security command values. ? issue the nr0 command to cause the router to leave. ? issue the nr1 command to send a broadcast transmissi on, causing all devices in the network to leave and migrate to a different channel. ? press the commissioning button 4 times or issue the cb command with a parameter of 4. ? issue a network leave command. note that changes to id, sc, zs, and security command values only take effect wh en changes are applied (ac or cn commands). resetting the router when the router is re set or power cycled, it checks its pan id, op erating channel and stac k profile against the network configuration settings (id, sc , zs). it also verifies the saved se curity policy is valid based on the security configuration commands (ee, ky ). if the router's pan id, operating channel, stack profile, or security policy is invalid, the router will leave the network and attempt to join a new network based on its network joining command values. to prevent the router from leaving an existing network, the wr command should be issued after all network joining commands have been configured in order to reta in these settings through po wer cycle or reset events. example: joining a network after starting a coordinator (that is allowing joins), the following steps will cause a router to join the network: 1. set id to the desired 64-bit pan id, or to 0 to join any pan. 2. set sc to the list of channels to scan to find a valid network. 3. if sc or id is changed from the default, a pply changes (make sc and id changes take effect) by issuing the ac or cn command. 4. the associate led will start blinki ng once the router has joined a pan. 5. if the associate led is not blinking, the ai command can be read to determine the cause of join failure. 6. once the router has joined, the op and ch comm ands will indicate the operating 64-bit pan id and channel the router joined. 7. the my command will reflect the 16-bit a ddress the router received when it joined. 8. the api modem status frame (" associated") is sent out the se rial port when using api mode. 9. the joined router will allo w other devices to join for a time based on its nj setting. end device operation similar to routers, end devices must al so discover and join a valid zigbee ne twork before they can participate in a network. after an end device has jo ined a network, it can communicate with other devices on the network. since end devices are intended to be battery powered and therefore su pport low power (sleep) modes, end devices cannot allow other devices to join, nor can they route data packets. discovering zigbee networks end devices go through the same proces s as routers to discover networks by issuing a pan scan. after sending the broadcast beacon request transmission, the end device listens for a short time in order to receive beacons sent by nearby routers and coordinato rs on the same channel. the end devi ce evaluates each beacon received on the channel to determine if a valid pan is found. an end device considers a pan to be valid if the pan: ?has a valid 64-bit pan id (pan id matches id if id > 0) ?has the correct stack profile (zs command) ?is allowing joining ?has capacity for additional end devices (see end device capa city section below).
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 45 if a valid pan is not found, the end device performs the pan scan on the ne xt channel in its scan channels list and continues this process until a valid network is found, or until all channels have been scanned. if all channels have been scanned and a valid pan was not discovered, the end device may enter a low power sleep state and scan again later. if scanning all sc channels fails to discover a valid pan, xbee zb modules will attempt to enter a low power state and will retry sc anning all sc channels after the module wakes from sleeping. if the module cannot enter a low power state, it will retry sc anning all channels, similar to the router. to meet zigbee alliance requirements, the end device will attempt up to 9 sc ans per minute for the firs t 5 minutes, and 3 scans per minute thereafter. note : the xbee zb end device will not enter sleep until it has completed sc anning all sc channels for a valid network. joining a network once the end device discovers a valid network, it jo ins the network, similar to a router, by sending an association request (to the device that sent a valid beacon) to request a join on the zigbee network. the device allowing the join then sends an association response frame that ei ther allows or denies the join. when an end device joins a network, it receives a 16-bit address from the device that allowed the join. the 16- bit address is randomly selected by the device that allowed the join. parent child relationship since an end device may enter low po wer sleep modes and not be immediatel y responsive, the en d device relies on the device that allowed the join to receive and buffer incoming messages in its behalf until it is able to wake and receive those messages. the device that allowed an end device to jo in becomes the parent of the end device, and the end device becomes a chil d of the device that allowed the join. end device capacity routers and coordinators maintain a table of all child devices that have joined called the child table. this table is a finite size and determines how many end devices can jo in. if a router or coordinator has at least one unused entry in its child table, the device is said to have end device capacity. in other word s, it can allow one or more additional end devices to join. zigbee networks should have sufficient routers to en sure adequate end device capacity. the initial release of software on this platform supports up to 20 end devices when configured as a coordinator or a router. in zb firmware, the nc command (num ber of remaining end device childr en) can be used to determine how many additional end devices ca n join a router or coordinator. if nc re turns 0, then the ro uter or coordinator device has no more end device ca pacity. (its child table is full.) also of note, since routers cannot slee p, there is no equivalent need for routers or coordinators to track joined routers. therefore, there is no limit to the number of ro uters that can join a given router or coordinator device. (there is no "router capacity" metric.) authentication in a network where security is enable d, the end device must then go thro ugh an authentication process. see chapter 5 for a discussion on security and authentication. persistent data the end device can retain its pan id, operating channel, and security policy informat ion through a power cycle. however, since end devices rely heavil y on a parent, the end device does an orphan scan to try and contact its parent. if the end device does no t receive an orphan sc an response (called a coordinator realignment command), it will leave the network an d try to discover and join a new netw ork. when the end device leaves a network, the previous pan id and op erating channel settings are lost.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 46 orphan scans when an end device comes up from a powe r cycle, it performs an orphan scan to verify it still has a valid parent. the orphan scan is sent as a broadc ast transmission and contains the 64-b it address of the end device. nearby routers and coordinator device s that receive the broadcast check their child tables for an entry that contains the end device's 64-bit address. if an entry is found with a matching 64-bi t address, the device sends a coordinator realignment command to the end device that includes the end device's 16- bit address, 16-bit pan id, operating channel, and the parent's 64-bit and 16-bit addresses. if the orphaned end device receives a coordinator realignment comm and, it is considered joined to the network. otherwise, it will attempt to discover and join a valid network. xbee zb end device joining when an end device is powered on, if it is not joined to a valid zigbee network, or if the orphan scan fails to find a parent, it immediately at tempts to find and join a valid zigbee network. note: the dj command can be set to 1 to disable joinin g. the dj parameter cannot be written with wr, so a power cycle always clears the dj setting. similar to a router, the following commands control the end device joining process. once the end device joins a network, the network configuration settings can persist through power cycles as mentioned in the "persistent data" section previously. if jo ining fails, the status of the last join attempt can be read in the ai command register. if any of these command values chan ges, when command register changes are applied, the end device will leave its current network and attempt to discover and join a new valid network. when a zb end device has successfully started a network, it ? sets ai=0 ? starts blinking the associate led ? sends an api modem status frame ("associated ") out the serial port when using api mode ? attempts to enter low power modes. these behaviors are configurable using the following commands: network ? joining ? commands ? used ? by ? an ? end ? device ? to ? join ? a ? network. command description id sets the 64-bit pan id to join. setting id=0 allows the router to join any 64-bit pan id. sc set the scan channels bitmask that determines which channels an end device will scan to find a valid network. sc on the end device should be set to match sc on the coordinator and routers in the desired network. for example, setting sc to 0x281 enables scanning on channels 0x0b, 0x12, and 0x14, in that order. sd set the scan duration, or time that the end device will listen for beacons on each channel. zs set the stack profile on the device. ee enable or disable security in the network. this must be set to match the ee value (security policy) of the coordinator. ky set the trust center link key. if set to 0 (default), the link key is expected to be obtained (unencrypted) during joining. command description d5 enables the associate led functionality. lt sets the associate led blink time when joined. default is 2 blinks per second (end devices). sm, sp, st, sn, so parameters that configure the sleep mode characteristics. (see managing end devices chapter for details.)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 47 parent connectivity the xbee zb end device se nds regular poll transmissions to its pa rent when it is awake. these poll transmissions query the parent for any new received data packets. th e parent always sends a mac layer acknowledgment back to the end device. the acknowledg ment indicates whether the parent has data for the end device or not. if the end device does not receive an acknowledgment for 3 consecutive poll requests, it considers itself disconnected from its parent and will attempt to discover and join a valid zigbee network. see "managing end devices" chapter for details. resetting the end device when the end device is reset or power cycled, if the orphan scan successfully locates a parent, the end device then checks its pan id, operating channel and stack prof ile against the network configuration settings (id, sc, zs). it also verifies the saved security policy is valid based on the security configuration commands (ee, ky). if the end device's pan id, operating channe l, stack profile, or security policy is invalid, the end device will leave the network and attempt to join a new network based on its network joining command values. to prevent the end device from leaving an existing ne twork, the wr command should be issued after all network joining commands have been configured in order to retain these settings th rough power cycle or reset events. leaving a network there are a couple of mechan isms that will cause the router to leav e its current pan and attempt to discover and join a new network based on its network join ing parameter values. these include the following: ? the id command changes such that the current 64-bit pan id is invalid. ? the sc command changes such that the current operating channel (ch) is not included in the channel mask. ? the zs or any of the security command values change. ? the nr0 command is issued to cause the end device to leave. ? the nr1 command is issued to send a broadcast tran smission, causing all devices in the network to leave and migrate to a different channel. ? the commissioning button is pre ssed 4 times or the cb command is issued with a parameter of 4. ? the end device's parent is powered down or the end device is moved out of range of the parent such that the end device fails to receiv e poll acknowledgment messages. note that changes to command valu es only take effect when change s are applied (ac or cn commands). example: joining a network after starting a coordinator (that is allowing joins), the following steps will cause an xbee end device to join the network: 1. set id to the desired 64-bit pan id, or to 0 to join any pan. 2. set sc to the list of channels to scan to find a valid network. 3. if sc or id is changed from the default, a pply changes (make sc and id changes take effect) by issuing the ac or cn command. 4. the associate led will start blinking once the end device has joined a pan. 5. if the associate led is not blinking, the ai command can be read to determine the cause of join failure. 6. once the end device has joined, the op and ch commands will indicate the operating 64-bit pan id and channel the end device joined. 7. the my command will reflect the 16-bit a ddress the router received when it joined. 8. the api modem status frame (" associated") is sent out the se rial port when using api mode. 9. the joined end device will attempt to enter low power sl eep modes based on its sleep configuration commands (sm, sp, sn, st, so).
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 48 channel scanning as mentioned previously, routers and end devices must scan one or more channels to discover a valid network to join. when a join attempt begins, the xbee sends a beacon request tr ansmission on the lowest channel specified in the sc (scan channels) command bitmask. if a valid pan is found on the channel, the xbee will attempt to join the pan on that channel. otherwise, if a valid pan is not found on the channel, it will attempt scanning on the next higher channel in the sc command bitmask. the xbee will continue to scan each channel (from lowest to highest) in the sc bitmask until a valid pan is found or all channels have been scanned. once all channels have been scanned, the next join attempt will st art scanning on the lowest channel specified in the sc command bitmask. for example, if the sc command is set to 0x400f, the xb ee would start scanning on channel 11 (0x0b) and scan until a valid beacon is found, or until channels 11, 12, 13, 14, and 25 have been scanned (in that order). once an xbee router or end device join s a network on a given channel, if the xbee is told to leave (see "leaving a network" section), it will leave the channel it joined on and continue scanning on the next higher channel in the sc bitmask. for example, if the sc command is se t to 0x400f, and the xbee joins a pan on channel 12 (0x0c), if the xbee leaves the channel, it will start scanning on channel 13, followed by channels 14 and 25 if a valid network is not found. once all channels have been scanned, the next jo in attempt will start scanning on the lowest channel specified in the sc command bitmask. managing multiple zigbee networks in some applications, multiple zigbee networks may exist in proximity of each other. the application may need provisions to ensure the xbee joins the desired network. there are a number of feat ures in zigbee to manage joining among multiple networks . these include the following: ?pan id filtering ?preconfigured security keys ?permit joining ?application messaging pan id filtering the xbee can be configured with a fixed pan id by sett ing the id command to a non-zero value. if the pan id is set to a non-zero value, the xbee will only join a network with the same pan id. preconfigured security keys similar to pan id filtering, this method requires a known security key be inst alled on a router to ensure it will join a zigbee network with the same security key. if the security key (ky command) is set to a non-zero value, and if security is enabled (ee command) , an xbee router or end device will only join a network with the same security key. permit joining the permit joining parameter can be disabled in a network to prevent unw anted devices from joining. when a new device must be added to a networ k, permit-joining can be enabled for a short time on the desired network. in the xbee firmware, joining is disabled by setting the nj command to a value less than 0xff on all routers and coordinator devices. joining can be enabled for a shor t time using the commissioning push-button (see network commissioning chapter for de tails) or the cb command. application messaging if the above mechanisms are not feas ible, the application could build in a messaging framework between the coordinator and devices that join its network. for example, the application code in joining devices could send a transmission to the coordinator after joining a network, and wait to receive a defi ned reply message. if the application does not receive the expected response mess age after joining, the application could force the xbee to leave and continue scanning (see nr parameter).
? ? 2010 ? digi ? international, ? inc. ????? 49 4. ? transmission, ? addressing, ? and ? routing addressing all zigbee devices have two different addresses, a 64-bit and a 16-bit addres s. the characteristics of each are described below. 64-bit device addresses the 64-bit address is a uniqu e device address assigned during manufactu ring. this address is unique to each physical device. the 64-bit address in cludes a 3-byte organizationally unique identifier (oui) assigned by the ieee. the 64-bit address is also called the extended address. 16-bit device addresses a device receives a 16-bit address when it joins a zigbee network. for this reason, the 16-bit address is also called the "network address". the 16-bit address of 0x0 000 is reserved for the coor dinator. all other devices receive a randomly generated address from the router or coordinator device that allows the join. the 16-bit address can change under certain conditions: ? an address conflict is detected where two devi ces are found to have the same 16-bit address ? a device leaves the network and later joins (it can receive a different address) all zigbee transmissions are sent using the source an d destination 16-bit addresses. the ro uting tables on zigbee devices also use 16-bit addresses to determine how to route data packets through the network. however, since the 16-bit address is not static, it is not a reliable way to identify a device. to solve this problem, the 64-bit destination address is often included in data transmissions to guarantee data is delivered to the correct dest ination. the zigbee stack can discover th e 16-bit address, if unknown, before transmitting data to a remote. application layer addressing zigbee devices can support multiple application profiles , cluster ids, and endpoints . (see "zigbee application layers - in depth" in chap ter 3.) application layer addressing allows data transmissions to be addressed to specific profile ids, cluster ids, an d endpoints. application layer addressing is useful if an application must ? interoperate with other zigbee devices outside of the digi application profile ? utilize service and network mana gement capabiliti es of the zdo ? operate on a public application profile such as home contro ls or smart energy. api mode provides a simple yet powerfu l interface that can easily send da ta to any profile id, endpoint, and cluster id combination on any device in a zigbee network. data transmission zigbee data packets can be se nt as either unicast or broadcast transmis sions. unicast transmissions route data from one source device to one destination de vice, whereas broadcast transmissions are sent to many or all devices in the network.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 50 broadcast transmissions broadcast transmissions within the zigbee protocol are intended to be propagated throughout the entire network such that all nodes receive the transmission. to accomplish this, the coordinator and all routers that receive a broadcast transmission will retransmit the pack et three times. note: when a router or coordinator delive rs a broadcast transmission to an en d device child, the transmission is only sent once (i mmediately after the end device wakes and polls the parent fo r any new data). see parent operation section in chapter 6 for details. broadcast ? data ? transmission ? each node that transmits the broadcast will also create an entry in a loca l broadcast transmis sion table. this entry is used to keep track of each received broa dcast packet to ensure the packets are not endlessly transmitted. each entry persists for 8 seconds. the broadcast transmission table holds 8 entries. for each broadcast transmission, the zigbee stack must re serve buffer space for a copy of the data packet. this copy is used to retransmit the packet as needed. larg e broadcast packets will requ ire more buffer space. this information on buffer space is provid ed for general knowledge; the user do es not and cannot change any buffer spacing. buffer spacing is handled automatically by the xbee module. since broadcast transmissions are retransmitted by each device in the network, broa dcast messages should be used sparingly. unicast transmissions unicast transmissions are sent from one source device to another destination device. the destination device could be an immediate neighbor of the source, or it could be seve ral hops away. unicast transmissions that are sent along a multiple hop path requir e some means of establishing a route to the destination device. see the "rf packet routing" sectio n in chapter 4 for details. address resolution as mentioned previously, each device in a zigbee network has both a 16 -bit (network) address and a 64-bit (extended) address. the 64-bit addres s is unique and assigned to the de vice during manufacturing, and the c r r e r e r e e r e r legend c=coordinator r=router e=end d evice e
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 51 16-bit address is obtained after joining a network. the 16-bit address can al so change under certain conditions. when sending a unicast transmission, the zigbee network layer uses the 16-bit address of the destination and each hop to route the data pack et. if the 16-bit address of the dest ination is not known, the zigbee stack includes a discovery provision to automatically discover the destinat ion device's 16-bit address before routing the data. to discover a 16-bit address of a remote, the device initiating the discovery sends a broadcast address discovery transmission. the address di scovery broadcast includes the 64-b it address of th e remote device whose 16-bit address is bein g requested. all nodes that receive this transmission check the 64-bit address in the payload and compare it to their own 64-bit a ddress. if the addresses ma tch, the device sends a response packet back to the initia tor. this response includes the remote's 16-bit address. when the discovery response is received, the in itiator will then transmit the data. address table each zigbee device maintains an a ddress table that maps a 64-bit a ddress to a 16-bit address. when a transmission is addressed to a 64-bit address, the zi gbee stack searches the a ddress table for an entry with a matching 64-bit address, in hopes of determining the destination's 16-bit address. if a known 16-bit address is not found, the zigbee st ack will perform address discovery to discover the de vice's current 16- bit address. the xbee modules can store up to 10 address table entries. for applicat ions where a single device (e.g. coordinator) may send unicast transmissions to more than 10 devices, the application should implement an address table to store the 16-bit and 64-bit addresses for each remote device. any xbee that will send data to more than 10 remotes should also use api mode. the appl ication can then send both the 16-bit and 64- bit addresses to the xbee in the api transmit frames which will significantly re duce the number of 16-bit address discoveries and greatl y improve data throughput. if an application will support an a ddress table, the size should ideally be larger than the maximum number of destination addresses the device will communicate with. each entry in the address table should contain a 64-bit destination address and its last known 16-bit address. when sending a transmission to a destination 64-bit addre ss, the application should search the address table for a matching 64-bit address. if a match is fo und, the 16-bit address shou ld be populated into the 16-bit address field of the api frame. if a match is not found, the 16-bit address should be set to 0xfffe (unknown) in the api transmit frame. the api provides indication of a remote device's 16-bit a ddress in the following frames: ? all receive data frames ? rx data (0x90) ? rx explicit data (0x91) ? i/o sample data (0x92) ? node identification indicator (0x95) ? route record indicator (0xa1) ? etc. ? transmit status frame (0x8b) sample ? address ? tabl e 64-bit address 16-bit address 0013 a200 4000 0001 0x4414 0013 a200 400a 3568 0x1234 0013 a200 4004 1122 0xc200 0013 a200 4002 1123 0xfffe (unknown)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 52 the application should always update the 16-bit address in the address ta ble when one of these frames is received to ensure the table has the most recently known 16-bit address. if a transmission failure occurs, the application should set the 16-bit address in the table to 0xfffe (unknown). fragmentation each unicast transmission may support up to 84 bytes of rf payload. (enabling security or using source routing can reduce this number. see the np command fo r details.) however, the xb ee zb firmware supports a zigbee feature called frag mentation that allows a single large data packet to be broken up into multiple rf transmissions and reassembled by th e receiver before sendin g data out its serial port. this is shown in the image below. the transmit frame can include up to 255 bytes of data, which will be broken up in to multiple transmissions and reassembled on the receiving side. if one or more of the frag mented messages are not received by the receiving device, the receiver will drop the entire message, and the se nder will indicate a transmission failure in the tx status api frame. applications that do not wish to use fragmentation should avoid sending more than the maximum number of bytes in a single rf transmission. see the "maximum rf payload size" section for details. if rts flow control is enabled on the receiving modu le (using the d6 command) and a fragmented message is received, then rts flow control will be ignored. data transmission examples at firmware to send a data packet in transparent mode, the dh and dl commands must be set to match the 64-bit address of the destination device. dh must match the upper 4-bytes, and dl must match the lower 4 bytes. since the coordinator al ways receives a 16-bit address of 0x0000, a 64-bit address of 0x0000000000000000 is defined as the coordinator's addres s (in zb firmware). the default values of dh and dl are 0x00, which sends data to the coordinator. example 1: send a transmission to the coordinator. (in this example, a '\r' refers to a carriage re turn character.) a router or end device can send data in two wa ys. first, set the destination address (dh and dl commands) to 0x00. 1. enter command mode ('+++') 2. after receiving an ok\r, issue the following commands: a. atdh0\r b. atdl0\r c. atcn\r 3. verify that each of the 3 comm ands returned an ok\r response. 4. after setting these command values, all serial ch aracters will be sent as a unicast transmission to the coordinator.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 53 alternatively, if the coordinator's 64- bit address is known, dh and dl can be set to the coordinator's 64-bit address. suppose the coordinator's address is 0x0013a200404a2244. 1. enter command mode ('+++') 2. after receiving an ok\r, issue the following commands: a. atdh13a200\r b. atdl404a2244\ c. atcn\r 3. verify that each of the 3 comm ands returned an ok\r response. 4. after setting these command values, all serial ch aracters will be sent as a unicast transmission to the coordinator. api firmware use the transmit request, or explicit transmit reques t frame (0x10 and 0x11 respectively) to send data to the coordinator. the 64-bit address can either be se t to 0x0000000000000000, or to the 64-bit address of the coordinator. the 16-bit address should be set to 0xfffe when using the 64-bit address of all 0x00s. to send an ascii "1" to the coordinator's 0x00 address, the following api frame can be used: 7e 00 0f 10 01 0000 0000 0000 0000 fffe 00 00 31 c0 if the explicit transmit frame is used, the cluster id should be set to 0x0011, the profile id to 0xc105, and the source and destination endpoints to 0xe8 (recommended defaults for data tran smissions in the digi profile.) the same transmission could be sent using the following explicit transmit frame: 7e 00 15 11 01 0000 0000 0000 0000 fffe e8 e8 0011 c105 00 00 31 18 notice the 16-bit address is set to 0xfffe. this is required when sending to a 64-bit address of 0x00s. now suppose the coordinator's 64-bit address is 0x 0013a200404a2244. the followin g transmit request api frame (0x10) will send an ascii "1" to the coordinator: 7e 00 0f 10 01 0013 a200 404a 2244 0000 0000 31 18 example 2: send a broadcast transmission. (in this example, a '\r' refers to a carriage re turn character.) perform the following steps to configure a broadcast transmission: 1. enter command mode ('+++') 2. after receiving an ok\r, issue the following commands: a. atdh0\r b. atdlffff\r c. atcn\r 3. verify that each of the 3 co mmands returned an ok\r response 4. after setting these command values, all seri al characters will be sent as a broadcast transmission. api firmware this example will use the transmit request api frame (0x10) to se nd an ascii "1" in a broadcast transmission. to send an ascii "1" as a broadcast transm ission, the following api frame can be used: 7e 00 0f 10 01 0000 0000 0000 ffff fffe 00 00 31 c2 notice the destination 16-bit address is set to 0xfffe for broadcast transmissions. rf packet routing unicast transmissions may require some type of routing. zi gbee includes several different ways to route data, each with its own advantages and disadvantages. these are summarized in the table below.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 54 note ? end devices do not make use of these routing protocols. rather, an end device sends a unicast transmission to its parent and allows the parent to route the data packet in its behalf. note - a network cannot revert from many-to-one routing to aodv routing without first doing a network reset (nr). link status transmission before discussing the various routing protocols, it is worth understanding the primary mechanism in zigbee for establishing reliable bi-directional links. this mechan ism is especially useful in networks that may have a mixture of devices with vary ing output power and/or receiver sensitivity levels. each coordinator or router device periodically sends a link status message. this message is sent as a 1-hop broadcast transmission, received only by one-hop neig hbors. the link status message contains a list of neighboring devices and incoming an d outgoing link qualities for each neighbor. using these messages, neighboring devices can dete rmine the quality of a bi-directional link with each neighbor and use that information to select a route that works well in both directions. for example, consider a network of two neighboring devi ces that send periodic link status messages. suppose that the output power of device a is +18dbm, and the output power of device b is +3dbm (considerably less than the output power of device a). the link status messages might indicate the following: routing approach description when to use ad hoc on-demand distance vector (aodv) mesh routing routing paths are created between source and destination, possibly traversing multiple nodes (?hops?). each device knows who to send data to next to eventually reach the destination use in networks that will not scale beyond about 40 destination devices. many-to-one routing a single broadcast transmission configures reverse routes on all devices into the device that sends the broadcast useful when many remote devices must send data to a single gateway or collector device. source routing data packets include the entire route the packet should traverse to get from source to destination improves routing efficiency in large networks (over 40 remote devices)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 55 this mechanism enables devices a and b to recognize that th e link is not reliable in both directions and select a different neighbor when establishing routes. (such links ar e called asymmetric links, meaning the link quality is not similar in both directions.) when a router or coordinator device powers on, it sends link status messages every couple seconds to attempt to discover link qualities with its neighbors quickly. after being powered on for so me time, the link status messages are sent at a much slower rate (about every 3-4 times per minute). aodv mesh routing zigbee employs mesh ro uting to establish a route between the source device and the destin ation. mesh routing allows data packets to traverse multiple nodes (hops) in a network to route data from a source to a destination. routers and coordinators can participat e in establishing routes between so urce and destination devices using a process called route discovery. the route discovery proc ess is based on the aodv (ad-hoc on-demand distance vector routing) protocol. sample ? transmission ? through ? a ? mesh ? network aodv (ad-hoc on-demand distance vector) routing algorithm routing under the aodv protocol is accomplished using tables in each node that store the next hop (intermediary node between so urce and destination nodes) for a destinat ion node. if a next hop is not known, route discovery must take place in orde r to find a path. since only a limited number of routes can be stored on a router, route discovery will take place more often on a large network with communication between many different nodes. when a source node must discover a route to a destin ation node, it sends a broa dcast route request command. the route request command contains the source network address, the destination ne twork address and a path cost field (a metric for measuring route quality). as the route request command is propagated through the node destination address next hop address r3 router 6 coordinator c router 6 router 5 r5 router 6 router 6
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 56 network (refer to the broadcast transmission), each node that re-broadcasts the message updates the path cost field and creates a temporary entry in its route discovery table. sample ? route ? request ? (broadcast) ? transmission ? where ? r3 ? is ? trying ? to ? discover ? a ? route ? to ? r6 ? when the destination node receives a route request, it co mpares the ?path cost? field against previously received route request commands. if the path cost stored in the route request is better than any previously received, the destination node will transmit a route reply packet to the node that origin ated the route requ est. intermediate nodes receive and forward the route repl y packet to the source node (the no de that originated route request). sample ? route ? reply ? (unicast) ? where ? r6 ? sends ? a ? route ? reply ? to ? r3. ? note: r6 could send multiple replie s if it identifies a better route. retries and acknowledgments zigbee includes acknowledgment packet s at both the mac and application support (aps) layers. when data is transmitted to a remote device, it may traverse multiple hops to reach the destinatio n. as data is transmitted from one node to its neighbor, an ac knowledgment packet (ack) is transmit ted in the opposite direction to indicate that the transmission was successfully received. if the ack is not received, the transmitting device will retransmit the data, up to 4 times. this ack is called the mac layer acknowledgment. in addition, the device that origin ated the transmission expects to re ceive an acknowledgment packet (ack) from the destination device. this ack will traverse the same path that the data traversed, but in the opposite
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 57 direction. if the originator fails to re ceive this ack, it will retransmit th e data, up to 2 times until an ack is received. this ack is called th e zigbee aps layer acknowledgment. refer to the zigbee specif ication for more details. many-to-one routing in networks where many devices must send data to a central collector or gateway device, aodv mesh routing requires significant overhead. if every device in the networ k had to discover a route befo re it could send data to the data collector, the network could easily become inundated with broadcast route discovery messages. many-to-one routing is an optimization for these kinds of networks. rather than requir e each device to do its own route discovery, a single many-to-one broadcast transm ission is sent from the da ta collector to establish reverse routes on all devices. this is shown in the figure below. the left side shows the many broadcasts the devices can send when they create their own routes and the route replies ge nerated by the data collector. the right side shows the benefits of ma ny-to-one routing where a single broadcast creates reverse routes to the data collector on all routers. the many-to-one broadcast is a route request message with the target discovery address set to the address of the data collector. devices that receive this route request create a reverse many-to-one routing table entry to create a path back to the data collector. the zigbee st ack on a device uses historic al link quality information about each neighbor to select a reli able neighbor for the reverse route. when a device sends data to a data collector, and it finds a many-to-one route in its routing table, it will transmit the data without performing a route discov ery. the many-to-one route request should be sent periodically to update and refresh the reverse routes in the network. applications that require multiple da ta collectors can also use many-to-on e routing. if more than one data collector device sends a many-to-one broadcast, devices will create one reverse routin g table entry for each collector. in zb firmware, the ar command is used to enable many-to-one broadcas ting on a device. the ar command sets a time interval (measured in 10 second units) for sending the many to one broadcast tr ansmission. (see the command table for details.) source routing in applications where a devi ce must transmit data to many remotes, aodv routing would require performing one route discovery for each destinatio n device to establish a route. if th ere are more destin ation devices than there are routing table entries, established aodv routes would be overwritten with new routes, causing route discoveries to occur more regularly. this could result in larger packet delays and poor network performance. zigbee source routing helps solve these problems. in co ntrast to many-to-one routin g that establishes routing paths from many devices to one data collector, source rout ing allows the collector to store and specify routes for many remotes. to use source routing, a device must use the api mode , and it must send periodic many-to-one route request broadcasts (ar command) to create a many-to-one route to it on all devi ces. when remote devices send rf data using a many-to-one route, they first send a route record transmission . the route record transmission is unicast along the many-to-one route until it reaches the data collector. as the route record traverses the many- to-one route, it appends the 16-bit a ddress of each device in the route in to the rf payload. when the route record reaches the data collec tor, it contains the address of the sender , and the 16-bit address of each hop in the route. the data collector can store the routing inform ation and retrieve it later to send a source routed packet to the remote. this is shown in the images below.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 58 acquiring source routes acquiring source routes requires the remote devices to send a unicast to a data collector (device that sends many-to-one route request broadcasts). there are seve ral ways to force remotes to send route record transmissions. the data collector sends a many-to-one route request broadcast to create reverse routes on all devices. a remote device sends an rf data packet to the data collector. (this is prefaced by a route record transmission to the data collector.) after obtaining a source route, the data collector sends a source routed transmission to the remote device.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 59 1. if the application on remote devices periodically sends data to the data collector, each transmission will force a route record to occur. 2. the data collector can issue a network disc overy command (nd command) to force all xbee devices to send a network discovery response. each netw ork discovery response will be prefaced by a route record. 3. periodic io sampling can be enabled on remotes to force them to send data at a regular rate. each io sample would be prefaced by a route record. (see chapter 8 for details.) 4. if the ni string of the remote de vice is known, the dn command can be issued with the ni string of the remote in the payload. the remote device with a matc hing ni string would send a route record and a dn response. storing source routes when a data collector receives a rout e record, it sends it out the serial port as a route record indicator api frame (0xa1). to use source routing, the application should receive these frames and store the source route information. sending a source routed transmission to send a source routed transmission, the application should send a create source route api frame (0x21) to the xbee to create a source route in its internal source route table. after sending the create source route api frame, the application can send data transm ission or remote command request frames as needed to the same destination, or any destination in the source route. once data must be sent to a new destination (a destination not included in the last source route), the application should first send a new create source route api fr ame. the xbee can buffer one source route that includes up to 11 hops (excluding source and destination). for example, suppose a network exis ts with a coordinator and 5 routers (r1, r2, r3, r4, r5) with known source routes as shown below. to send a source-routed packet to r3, the applicatio n must send a create source route api frame (0x21) to the xbee, with a destination of r3 , and 2 hops (r1 and r2). if the 64- bit address of r3 is 0x0013a200 404a1234 and the 16-bit addresses of r1, r2, and r3 are: then the create source route api frame would be: 7e 0012 21 00 0013a200 404a1234 eeff 00 02 ccdd aabb 5c device 16-bit address r1 0xaabb r2 0xccdd r3 0xeeff
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 60 where: 0x0012 - length 0x21 - api id (create source route) 0x00 - frame id (set to 0 always) 0x0013a200 404a1234 - 64-bit address of r3 (destination) 0xeeff - 16-bit address of r3 (destination) 0x00 - route options (set to 0) 0x02 - number of intermediate devices in the source route 0xccdd - address of furthest device (1-hop from target) 0xaabb - address of next-closer device 0x5c - checksum (0xff - sum (all bytes after length)) repairing source routes it is possible in a network to have an existing source route fail (i.e. a device in the route moves or goes down, etc.). if a devi ce goes down in a source ro uted network, all ro utes that used th e device will be broken. as mentioned previously, source routing must be used with many-to-one routing. (a device that uses source routing must also send a periodic many-to-one br oadcast in order to keep ro utes fresh). if a source route is broken, remote devices must send in new route record transmissions to the data collector to provide it with a new source route. this requires that remote devices periodically send data transmissions into the data collector. see the earlier "a cquiring source routes " section for details. retries and acknowledgments zigbee includes acknowledgm ent packets at both the ma c and application support (aps) layers. when data is transmitted to a remote device, it may traverse mu ltiple hops to reach the destination. as data is transmitted from one node to its neighbor, an acknowle dgment packet (ack) is transmitted in the opposite direction to indicate that the transmission was succ essfully received. if the ack is not received, the transmitting device will retransm it the data, up to 4 times. this ack is called the mac layer acknowledgment. in addition, the device that originated the transmission expects to receive an acknowledgment packet (ack) from the destination device. this ack will traverse the same path that the data traversed, but in the opposite direction. if the originator fails to receive this ack, it will retransmit the data, up to 2 times until an ack is received. this ack is called the zigbee aps layer acknowledgment. refer to the zigbee specif ication for more details. encrypted transmissions encrypted transmissions are routed similar to non-encrypted transmissions with one exception. as an encrypted packet propagates from one device to another, each device decrypts th e packet using the network key, and authenticates the packet by verifying pa cket integrity. it then re-encrypts the packet with its own source address and frame counter values, and sends the message to the ne xt hop. this process adds some overhead latency to unicast transmissions, but it helps prevent replay attacks. see chapter 5 for details. maximum rf payload size xbee zb firmware includes a command (atnp) that returns the maximum numbe r of rf payload bytes that can be sent in a unicast transmission. querying the np command, like most other commands, returns a hexadecimal value. this number will change base d on whether security is en abled or not. if security is enabled (ee command), the maximum number of rf payload bytes decreases si nce security re quires additional overhead. after reading the np value, the following conditions can affect the maximum number of data bytes in a single rf transmission:
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 61 ?broadcast transmissions can support 8 bytes more than unicast transmissions. ?if source routing is used, the 16-bit addresses in the so urce route are inserted into the rf payload space. for example, if np returns 84 bytes, and a source route mu st traverse 3 intermediate hops (3 16-bit addresses), the total number of bytes that can be sent in one rf packet is 78. ?enabling aps encryption (api tx option bit set) will reduce the number of payload bytes by 4. throughput throughput in a zigbee network can vary by a number of va riables, including: number of hops, encryption enabled/ disabled, sleeping end devices, failures/route discoveries. our empi rical testing showed the following throughput performance in a robust operatin g environment (low interference). data throughput* rr = router to router, re = router to end de vice (non-sleeping), er = end device (non-s leeping) to router, sd = security disabled, se = security enabled. 4 hops = 5 nodes total, 3 intermediate router nodes * data throughput measurements were made setting th e serial interface rate to 115200 bps, and measuring the time to send 100,000 bytes from source to destination. du ring the test, no route discoveries or failures occurred. zdo transmissions zigbee defines a zigbee device objects layer (zdo) that can provide device and se rvice discovery and network management capabilities. this layer is described below. configuration data throughput 1 hop, rr, sd 58kbps 1 hop, rr, se 34kbps 1 hop, re, sd not yet available 1 hop, re, se not yet available 1 hop, er, sd not yet available 1 hop, er, se not yet available 4 hops, rr, sd not yet available 4 hops, rr, se not yet available
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 62 zigbee device objects (zdo) the zigbee device objects (zdo) is supported to some extent on all zigbee devices. the zdo is an endpoint that implements services desc ribed in the zigbee device profile in the zigbee specification. each service has an assigned cluster id, and most service requests have an associated response . the following tabl e describes some common zdo services. refer to the zigbee specification for a detailed de scription of all zigbee device profile services. sending a zdo command to send a zdo command, an explicit transmit api frame must be used an d formatted correctly . the source and destination endpoints must be set to 0, and the profile id must be set to 0. the cluster id must be set to match the cluster id of the appropriate service. for example, to send an active endpoints request, the cluster id must be set to 0x0005. the first byte of payload in the api frame is an appl ication sequence number (transaction sequence number) that can be set to any single byte valu e. this same value will be used in the first byte of the zdo response. all remaining payload bytes must be set as required by the zdo. all multi-byte va lues must be sent in little endian byte order. receiving zdo commands and responses in xbee zb firmware, zdo commands ca n easily be sent using the api. in order to receive incoming zdo commands, receiver application addressi ng must be enabled with the ao comm and. (see examples later in this section.) not all incoming zdo commands are passed up to the application. when a zdo message is received on endpoint 0 and profile id 0, the cl uster id indicates the type of zdo message that was received. the first byte of payload is gene rally a sequence number that corresponds to a sequence number of a re quest. the remaining bytes ar e set as defined by the zdo. similar to a zdo request, all multi-byte values in the response are in little endian byte order. example 1: send a zdo lqi request to read the neighbor table contents of a remote. looking at the zigbee specification, the cluster id for an lqi request is 0x0031, and the payload only requires a single byte (start index). this example will send an lqi re quest to a remote device with a 64-bit address of 0x0013a200 40401234. the start index will be set to 0, and the transaction sequence number will be set to 0x76 api frame: 7e 0016 11 01 0013a200 40401234 fffe 00 00 0031 0000 00 00 76 00 ce 0x0016 - length cluster name cluster id description network address request 0x0000 request a 16-bit address of the radio with a matching 64-bit address (requir ed parameter). active endpoints request 0x0005 request a list of endpoints from a remote device. lqi request 0x0031 request data from a neighbor table of a remote device. routing table request 0x0032 request to retrieve routing table entries from a remote device. network address response 0x8000 response that includes the 16-bit address of a device. lqi response 0x8031 response that includes neighbor table data from a remote device. routing table response 0x8032 response that includes routing table entry data from a remote device.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 63 0x11 - explicit transmit request 0x01 - frame id (set to a non-zero value to enable th e transmit status message, or set to 0 to disable) 0x0013a200 40401234 - 64-bit address of the remote 0xfffe - 16-bit address of the remote (0xfffe = unknown). optionally, set to the 16-bit address of the destination if known. 0x00 - source endpoint 0x00 - destination endpoint 0x0031 - cluster id (lqi request, or neighbor table request) 0x0000 - profile id (zigbee device profile) 0x00 - broadcast radius 0x00 - tx options 0x76 - transaction sequence number 0x00 - required payload for lqi request command 0xce - checksum (0xff - sum (all bytes after length)) description: this api frame sends a zdo lqi reques t (neighbor table request) to a remote device to obtain data from its neighbor table. recall that the ao command must be set corre ctly on an api device to enable the explicit api receive frames in order to receive the zdo response. example 2: send a zdo network address request to discover the 16-bit address of a remote. looking at the zigbee specification, the cluster id for a network address request is 0x0000, and the payload only requires the following: [64-bit address] + [reque st type] + [start index] this example will send a network address request as a broadcast transmission to discover the 16-bit address of the device with a 64-bit address of 0x0013a200 40401234. the request type and start index will be set to 0, and the transaction se quence number will be set to 0x44 api frame: 7e 001f 11 01 00000000 0000ffff fffe 00 00 0000 0000 00 00 44 34124040 00a21300 00 00 33 0x001f - length 0x11 - explicit transmit request 0x01 - frame id (set to a non-zero value to enable th e transmit status message, or set to 0 to disable) 0x00000000 0000ffff - 64-bit address for a broadcast transmission 0xfffe - set to this value fo r a broadcast transmission. 0x00 - source endpoint 0x00 - destination endpoint 0x0000 - cluster id (network address request) 0x0000 - profile id (zigbee device profile) 0x00 - broadcast radius 0x00 - tx options 0x44 - transaction sequence number 0x34124040 00a21300 00 00 - required payload for network address request command 0x33 - checksum (0xff - sum (all bytes after length)) description: this api frame sends a broadcast zd o network address request to obtain the 16-bit address of a device with a 64-bit address of 0x0013a200 40401234. note the bytes for the 64-bit address were inserted in little endian byte order. all multi-byte fields in the api payload of a zdo command must have their data inserted in little endian byte order. also recall that the ao command must be set correctly on an api device to enable the explicit api receive frames in order to receive the zdo response.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 64 transmission timeouts the zigbee stack includes two kinds of transmission time outs, depending on the nature of the destination device. for destination devices such as routers whose receiver is always on, a unicast timeout is used. the unicast timeout estimates a timeout based on the number of unicast hops the packet should traverse to get data to the destination device. for transmissions destined for end devices, the zigbee stack uses an extended timeout that includes the unicast timeout (to route data to the end device's parent), and it includes a timeout fo r the end device to finish sleeping, wake, and poll the parent for data. the zigbee stack includes some provisio ns for a device to detect if the dest ination is an end device or not. the zigbee stack uses the unicast timeout unless it knows the destination is an end device. the xbee api includes a transmit options bit that can be set to specify if the extended timeout should be used for a given transmission. if this bit is set, the extended timeout will be used when sending rf data to the specified destination. to improve routing reliability, applications sh ould set the extended timeout bit when sending data to end devices if: ?the application sends data to 10 or more remo te devices, some of wh ich are end devices, and ?the end devices may sleep longer than the unicast timeout equations for these timeouts are co mputed in the following sections. note: the timeouts in this section are worst-case timeou ts and should be padded by a few hundred milliseconds. these worst-case timeouts apply when an existing route br eaks down (e.g. intermediate hop or destination device moved). unicast timeout the unicast timeout is settable with the nh command. th e actual unicast timeout is computed as ((50 * nh) + 100). the default nh value is 30 which equates to a 1.6 second timeout. the unicast timeout includes 3 transmission attempts (1 attempt and 2 retries). the maximum total timeout is about: 3 * ((50 * nh) + 100). for example, if nh=30 (0x1e), the unicast timeout is about 3 * ((50 * 30) + 100), or 3 * (1500 + 100), or 3 * (1600), or 4800 ms, or 4.8 seconds. extended timeout the worst-case transmission timeout when sending data to an end device is somewhat larger than when transmitting to a router or coordinator. as described later in chapter 6, rf data packets are actually sent to the parent of the end device , who buffers the packet until the end device wakes to receive it. the parent will buffer an rf data packet for up to (1.2 * sp) time. to ensure the end device has adequate time to wake and receive the data, the extended transmission timeout to an end device is: (50 * nh) + (1.2 * sp) this timeout includes the packet buffering timeout (1.2 * sp) and time to account fo r routing through the mesh network (50 * nh). if an acknowledgment is not received within this time, th e sender will resend the tr ansmission up to two more times. with retries included, the longest transmission timeout when sending data to an end device is: 3 * ((50 * nh) + (1.2 * sp)) the sp value in both equations must be entered in mill isecond units. (the sp comm and setting uses 10ms units and must be converted to milliseconds to be used in this equation.)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 65 for example, suppose a router is configured with nh=3 0 (0x1e) and sp=0x3e8 (10,000 ms), and that it is either trying to send data to one of its end device children, or to a remote end device. the total extended timeout to the end device is about: 3 * ((50 * nh) + (1.2 * sp)), or 3 * (1500 + 12000), or 3 * (13500), or 40500 ms, or 40.5 seconds. transmission examples example 1: send a unicast api da ta transmission to the coordinator using 64-bit address 0, with payload "txdata". api frame: 7e 0014 10 01 00000000 00000000 fffe 00 00 54 78 44 61 74 61 ab field composition: 0x0014 - length 0x10 - api id (tx data) 0x01 - frame id (set greater than 0 to enable the tx-status response) 0x00000000 00000000 - 64-bit address of coordinator (zb definition) 0xfffe - required 16-bit address if sending data to 64-bit address of 0. 0x00 - broadcast radius (0 = max hops) 0x00 - tx options 0x54 78 44 61 74 61 - ascii representation of "txdata" string 0xab - checksum (0xff - sum (all bytes after length)) description: this transmission sends the string "txdata" to the coordinator, without knowing the coordinator device's 64-bit address. a 64-bit address of 0 is defined as the coordinator in zb firm ware. if the coordinator's 64-bit address was known, the 64-bit address of 0 co uld be replaced with the coordinato r's 64-bit address, and the 16-bit address could be set to 0. example 2 - send a broadcast api data transmission that all devices can rece ive (including sleeping end devices), with payload "txdata". api frame: 7e 0014 10 01 00000000 0000ffff fffe 00 00 54 78 44 61 74 61 ad field composition: 0x0014 - length 0x10 - api id (tx data) 0x01 - frame id (set to a non-zero va lue to enable the tx-status response) 0x00000000 0000ffff - broadcast definition (including sleeping end devices 0xfffe - required 16-bit address to send broadcast transmission. 0x00 - broadcast radius (0 = max hops) 0x00 - tx options 0x54 78 44 61 74 61 - ascii representation of "txdata" string 0xad - checksum (0xff - sum (all bytes after length)) description: this transmission sends the string "txdata" as a broadcast transmission. since the destination address is set to 0xffff, all devices, including sleeping end devices can receiv e this broadcast.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 66 if receiver application addressing is enabled, the xbee will report all received da ta frames in the explicit format (0x91) to indicate the source and destination endpoints, cluster id, and profile id that each packet was received on. (status messages like mo dem status and route record indicators are not affected.) to enable receiver application addressing, set the ao command to 1 using the at command frame (0x08). here's how to do this: api frame: 7e 0005 08 01 414f 01 65 field composition: 0x0005 - length 0x08 - api id (at command) 0x01 - frame id (set to a non-zero value to enable at comman d response frames) 0x414f - ascii representation of 'a ','o' (the command being issued) 0x01 - parameter value 0x65 - checksum (0xff - sum (all bytes after length)) description: setting ao=1 is required fo r the xbee to use the explicit receive ap i frame (0x91) when rf data packets are received. this is required if the application needs indication of source or destination endpoin t, cluster id, and/ or profile id values used in receiv ed zigbee data packets. zdo messag es can only be received if ao=1.
? ? 2010 ? digi ? international, ? inc. ????? 67 5. ? security zigbee supports various levels of security that can be conf igured depending on the needs of the application. security provisions include: ? 128-bit aes encryption ? two security keys that can be prec onfigured or obtained during joining ? support for a trust center ? provisions to ensure message integrity, confidentiality, and authentication. the first half of this chapter describes various security features defined in th e zigbee specification, while the last half illustrates how the xbee modules can be configured to support these features security modes the zigbee standard supports three security modes ? residential, standard , and high security. residential security was first supported in the zigbee 2006 standard. this leve l of security requires a network key be shared among devices. standard security adds a numbe r of optional security enhancements ov er residential security, including an aps layer link key. high security adds entity authentica tion, and a number of other features not widely supported. xbee zb modules primarily support standard security, although end devices that support residential security can join and interoperate with standard security devices. the remain der of this chapter focuses on material that is relevant to standard security. zigbee security model zigbee security is applied to the ne twork and aps layers. packets are encrypted with 128-bit aes encryption. a network key and optional link key can be used to encrypt data. only devices with the same keys are able to communicate together in a network. routers and end devices that will communicate on a secure network must obtain the correct security keys. network layer security the network key is used to encrypt th e aps layer and application data. in addition to encrypting application messages, network security is also applied to route request and repl y messages, aps commands, and zdo commands. network encryption is not applied to mac layer transmissions such as beacon transmissions, etc. if security is enabled in a network, all data pa ckets will be encrypted with the network key. packets are encrypted and authenti cated using 128-bit aes. this is shown in the figure below.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 68 frame counter the network header of encrypted packets includes a 32-bi t frame counter. each device in the network maintains a 32-bit frame counter that is increm ented for every transmission. in addition, devices track the last known 32- bit frame counter for each of its neighbors. if a device receives a packet from a ne ighbor with a smaller frame counter than it has previously seen, the packet is discar ded. the frame counter is used to protect against replay attacks. if the frame counter reaches a maximum value of 0xffffffff , it does not wrap to 0 and no more transmissions can be sent. due to the size of the frame counters, reaching the maximum value is a very unlikely event for most applications. the following table shows the required time under different co nditions, for the frame counter to reach its maximum value. to clear the frame counters without compromising security, the network key can be changed in the network. when the network key is updated, the frame counters on all devices reset to 0. (see the network key updates section for details.) message integrity code the network header, aps header, and application data are all authenticated with 128-bit aes. a hash is performed on these fields and is appe nded as a 4-byte messag e integrity code (mic) to the end of the packet. the mic allows receiving devices to ensure the message has not been changed. the mic provides message integrity in the zigbee security mode l. if a device receives a packet and the mic does not match the device?s own hash of the data, the packet is dropped. network layer encryp tion and decryption packets with network layer encryption are encrypted and decrypted by each hop in a route. when a device receives a packet with network encryption, it decrypts the packet and authenticates the packet. if the device is not the destination, it then encrypts and authentica tes the packet, using its own frame counter and source address in the network header section. since network encryption is performed at each hop, packet late ncy is slightly longer in an encrypted network than in a non-encrypted network. also, security requires 18 bytes of overhead to include a 32-bit frame counter, an 8-byte source address, 4-byte mi c, and 2 other bytes. this reduces the number of pa yload bytes that can be sent in a data packet. network key updates zigbee supports a mechanism for changi ng the network key in a network. when the network key is changed, the frame counters in all devices reset to 0. aps layer security aps layer security can be used to encrypt application data using a key that is shared between source and destination devices. where network layer security is appl ied to all data transmission s and is decrypted and re- encrypted on a hop-by-hop basis, aps security is optional and provides end-to-end security using an aps link key that only the source and destination device know. aps security can be applied on a packet-by-packet basis. aps security cannot be applie d to broadcast transmissions. if aps security is enabled, packets are encrypted and authenticated using 128-bit aes. this is shown in the figure below: average transmission rate time until 32-bit frame counter expires 1 / second 136 years 10 / second 13.6 years
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 69 message integrity code if aps security is enabled, the aps header and data payload are authenticated with 128-bit aes. a hash is performed on these fields and append ed as a 4-byte message integrity co de (mic) to the end of the packet. this mic is different than the mic appended by the ne twork layer. the mic allows the destination device to ensure the message has not been changed. if the destin ation device receives a packet and the mic does not match the destination device?s own hash of the data, the packet is dropped. aps link keys there are two kinds of aps link keys ? trust center link keys and application link keys. a trust center link key is established between a de vice and the trust center, where an applicatio n link key is establis hed between a device and another device in the network where neither device is the trust center. aps layer encryption and decryption packets with aps layer encryption are encrypted at the so urce and only decrypted by the destination. since aps encryption requires a 5-byte header and a 4-byte mic, the maximum data payload is reduced by 9 bytes when aps encryption is used. network and aps layer encryption network and aps layer encryption can both be applie d to data. the following figure demonstrates the authentication and encryption performed on the final zigbee packet when both are applied.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 70 trust center zigbee defines a trust center device that is responsibl e for authenticating devices that join the network. the trust center also manages link key distribution in the network. forming and joining a secure network the coordinator is responsible for sele cting a network encryption key. this key can either be preconfigured or randomly selected. in addition, the coordinator generally operates as a trust center and must therefore select the trust center link key. the trust center link ke y can also be preconfigured or randomly selected. devices that join the network must obtain the networ k key when they join. when a device joins a secure network, the network and link keys can be sent to the jo ining device. if the joining device has a pre-configured trust center link key, the network key will be sent to th e joining device encrypted by the link key. otherwise, if the joining device is not pre-configured with the link key, the device could only join the network if the network key is sent unencrypted (?in the clear?). the trust center must decide whether or not to send the network key unencrypted to joining devices that are not pre-configured with the link key. sending the network key unencrypted is not recommende d as it can open a security hole in th e network. to maximize security, devices should be pre-configured with the correct link key. implementing secu rity on the xbee if security is enabled in the xbee zb firmware, devices acquire the network key when they join a network. data transmissions are always encrypted with the network key, and can optionally be end-to-end encrypted with the aps link key. the following sections discuss the security settings and options in the xb ee zb firmware.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 71 enabling security to enable security on a device, the ee command must be set to 1. if the ee co mmand value is changed and changes are applied (e.g. ac command), the xbee module will leave the network (pan id and channel) it was operating on, and attempt to form or join a new network. if ee is set to 1, all data transmissions will be encryp ted with the network key. when security is enabled, the maximum number of bytes in a single rf transmission will be reduced. see th e np command for details. note : the ee command must be set the sa me on all devices in a network. changes to the ee command should be written to non-volatile memory (to be preserve d through power cycle or reset events) using the wr command. setting the network security key the coordinator must select the network security key for the network. the nk command (write-only) is used to set the network key. if nk=0 (default), a random network key will be selected. (this should suffice for most applications.) otherwise, if nk is set to a non-zero va lue, the network security key will use the value specified by nk. nk is only suppo rted on the coordinator. routers and end devices with security enabled (atee=1) acquire the network key when they join a network. they will receive the network key encrypted with the link key if they share a pre-configured link key with the coordinator. see the following section for details. setting the aps trust center link key the coordinator must also select the trust center link key, using the ky command. if ky=0 (default), the coordinator will select a random trust center link key (not recommended). otherwise, if ky is set greater than 0, this value will be used as the pre-configured trust ce nter link key. ky is write-only and cannot be read. note: application link keys (sent between two device s where neither device is the coordinator) are not supported in zb firmware at this time. random trust center link keys if the coordinator selects a random trust center link ke y (ky=0, default), then it will allow devices to join the network without having a pre-config ured link key. however, this will cause the network key to be sent unencrypted over-the-air to joinin g devices and is not recommended. pre-configured trus t center link keys if the coordinator uses a pre-configured link key (ky > 0), then the coordinator will not send the network key unencrypted to joining devi ces. only devices with the correct pre-configured link key will be able to join and communicate on the network. enabling aps encryption aps encryption is an optional layer of security that uses the link key to encrypt the data payload. unlike network encryption that is decrypted and encr ypted on a hop-by-hop basis, aps en cryption is only decrypted by the destination device. the xbee must be configured with security enabled (ee set to 1) to use aps encryption. aps encryption can be enabled in api mode on a per- packet basis. to enable aps encryption for a given transmission, the "enable aps encryption " transmit options bit should be set in the api transmit frame. enabling aps encryption decreases the ma ximum payload size by 9 bytes. using a trust center the eo command can be used to define the coordinator as a trust center. if the coordinator is a trust center, it will be alerted to all new join attempts in the network. the trust center also has the ability to update or change the network key on the network. in zb firmware, a secure network ca n be established with or without a trust center. network and aps layer encryption are supported if a trust center is used or not.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 72 updating the network key with a trust center if the trust center has started a network and the nk value is changed, the coordinator will update the network key on all devices in the network. (changes to nk will not force the device to leave the network.) the network will continue to operate on the same ch annel and pan id, but the de vices in the network will update their network key, increment their network ke y sequence number, and rest ore their frame counters to 0. updating the network key without a trust center if the coordinator is not running as a trust center, the network reset command (nr1) can be used to force all devices in the network to leave the current networ k and rejoin the network on another channel. when devices leave and reform th en network, the frame counters are rese t to 0. this approach will cause the coordinator to form a new network that the remaining devices should join. resetting the network in this manner will bring the coordinator and routers in the network down for about 10 seconds, and will likely cause the 16-bit pan id and 16-bit addresses of the devices to change. xbee security examples this section covers some sample xbee configurations to support different security mo des. several at commands are listed with suggested parameter values. the notation in th is section includes an '=' si gn to indicate what each command register should be set to - fo r example, ee=1. this is not the correct notation for setting command values in the xbee. in at command mode, each command is issued with a leading 'at' and no '=' sign - for example atee1. in the api, the two byte command is used in the command field, and parameters are popu lated as binary values in the parameter field. example 1: forming a network with security (pre-configured link keys) 1. start a coordinator with the following settings: a. id=2234 (arbitrarily selected) b. ee=1 c. nk=0 d. ky=4455 e. wr (save networking parameters to preserve them through power cycle) 2. configure one or more routers or en d devices with the following settings: a. id=2234 b. ee=1 c. ky=4455 d. wr (save networking parameters to preserve them through power cycle) 3. read the ai setting on the coor dinator and joining devices until th ey return 0 (formed or joined ? a network). in this example, ee, id, and ky are set the same on al l devices. after successfully joining the secure network, all application data transmissions wi ll be encrypted by the network key. since nk was set to 0 on the coordinator, a random network key was selected. and sinc e the link key (ky) was configured the same on all devices, to a non-zero value, the ne twork key was sent encrypted by the pr e-configured link key (ky) when the devices joined. example 2: forming a network with secu rity (obtaining keys during joining) 1. start a coordinator with the following settings: a. id=2235 b. ee=1 c. nk=0 d. ky=0
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 73 e. wr (save networking parameters to preserve them through power cycle) 2. configure one or more routers or en d devices with the following settings: a. id=2235 b. ee=1 c. ky=0 d. wr (save networking parameters to preserve them through power cycle) 3. read the ai setting on the coordinator and joining devices until they return 0 (formed or joined a network). in this example, ee, id, and ky are set the same on al l devices. since nk was set to 0 on the coordinator, a random network key was selected. and since ky was set to 0 on all devices, the network key was sent unencrypted ("in the clear") when the devices joined. this approach introduces a secu rity vulnerability into the network and is not recommended.
? ? 2010 ? digi ? international, ? inc. ????? 74 6. ? network ? commissioning ? and ? diagnostics network commissioning is the process whereby devices in a me sh network are discovered and configured for operation. the xbee modules include several features to support device discovery and config uration. in addition to configuring devices, a strategy must be developed to place devices to en sure reliabl e routes. to accommodate these requirements, the xbee modules include various features to aid in device placement, configuration, and network diagnostics. device configuration xbee modules can be configured locally through serial co mmands (at or api), or re motely through remote api commands. api devices can send configuration commands to set or read the configuration settings of any device in the network. device placement for a mesh network installation to be successful, the instal ler must be able to determin e where to place individual xbee devices to establish reliable li nks throughout the mesh network. link testing a good way to measure the performance of a mesh network is to send uni cast data through the network from one device to another to determine th e success rate of many transmissions. to simplify link testing, the modules support a loopback cl uster id (0x12) on the data endpoint (0xe8) . any data sent to this cluster id on the data endpoint will be transm itted back to the sender. this is shown in the figure below: the configuration steps to send data to the loopback cluster id depend on the serial po rt mode as determined by the ap command. transparent mode to send data to the loopback cluste r id on the data endpoint of a remote device, set the ci command value to 0x12. the se and de commands should be set to 0xe8 (default value). the dh and dl commands should be set to the address of the remote (0 for the coordinator, or the 64-bit address of the remote). after exiting command mode, any received serial ch aracters will be transmitte d to the remote device, and returned to the sender.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 75 api mode send an explicit addressing zigbee command api frame (0x11) using 0x 12 as the cluster id and 0xe8 as the source and destination endpoint. data packets received by th e remote will be echoed back to the sender. rssi indicators it is possible to measure the receiv ed signal strength on a device usin g the db command. db returns the rssi value (measured in ?dbm) of the last received packet. however, this number can be misleading. the db value only indicates the received si gnal strength of the last ho p. if a transmission spans multiple hops, the db value provides no indication of the overall transmission path, or the quality of the worst link ? it only indicates the quality of the last link an d should be used sparingly. the db value can be determined in hardware using the rssi/pwm module pin (p in 6). if the rssi pwm functionality is enabled (p0 command), when the module receives data, the rssi pwm is set to a value based on the rssi of the received packet. (again, this value only indicates the quality of the last hop.) this pin could potentially be connected to an led to indicate if the link is stable or not. device discovery network discovery the network discovery command can be used to discover all digi modules that have joined a network. issuing the nd command sends a broadcast node discovery comman d throughout the network. all devices that receive the command will send a response that includes the device?s addressing information, node identifier string (see ni command), and other relevant information. this command is useful for generating a list of all module addresses in a network. when a device receives the node discovery command, it waits a random time before sending its own response. the maximum time delay is set on the nd sender with the nt command. the nd originator includes its nt setting in the transmission to provide a delay window for all devices in the network. large networks may need to increase nt to improve network discovery reliab ility. the default nt value is 0x3c (6 seconds). zdo discovery the zigbee device profile includes provisions to discover devices in a network that are supported on all zigbee devices (including non-digi products). these include the lqi request (cluster id 0x0031) and the network update request (cluster id 0x0038). the lqi request can be used to read the devices in the neighbor table of a remote device, and th e network update request can be used to have a remote device do an active scan to discover all nearby zigbee devices. both of these zd o commands can be sent us ing the xbee explicit api transmit frame (0x11). see the api chap ter for details. refer to the zigbee sp ecification for formatting details of these two zdo frames. joining announce all zigbee devices send a zdo device announce broadc ast transmission when they join a zigbee network (zdo cluster id 0x0013). these frames will be sent out the xbee 's serial port as an explicit rx indicator api frame (0x91) if ao is set to 1. the device announ ce payload includes th e following information: [ sequence number] + [16-bit address] + [64-bit address] + [capability] the 16-bit and 64-bit addresses are rece ived in little-endian byte order (lsb first). see the zigbee specification for details. commissioning pushbutto n and associate led the xbee modules support a set of commissioning and led behavior s to aid in device deployment and commissioning. these include the commissioning pushbu tton definitions and associ ate led behaviors. these features can be supported in hardware as shown below. ? commissioning ? pushbutton ? and ? associate ? led ? functionalities
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 76 commissioning pushbutton the commissioning pushbu tton definitions provide a variety of simple functions to aid in de ploying devices in a network. the commissioning bu tton functionality on pin 33 is enabled by setting the d0 command to 1 (enabled by default). button presses may be simulated in software using the at cb command. atcb should be issued with a parameter set to the number of button presses to execute. (e.g. sending atcb1 will execute the action(s) associated with a si ngle button press.) button presses if module is joined to a network if module is not joined to a net- work 1 ? wakes an end device for 30 seconds ? sends a node identifica- tion broadcast transmis- sion ? wakes an end device for 30 seconds ? blinks a numeric error code on the associate pin indicating the cause of join failure (see section 6.4.2). 2 ? sends a broadcast trans- mission to enable joining on the coordinator and all devices in the network for 1 minute. (if joining is permanently enabled on a device (nj = 0xff), this action has no effect on that device.) ?n/a 4 ? causes the device to leave the pan. ? issues atre to restore module parameters to default values, including id and sc. ? the device attempts to join a network based on its id and sc settings. ? issues atre to restore module parameters to default values, including id and sc. ? the device attempts to join a network based on its id and sc settings. a pushbutton and an led can be connected to module pins 33 and 28 respectively to support the commisioning pu shbutton and associate led functionalities.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 77 the node identification frame is similar to the node disc overy response frame ? it contains the device?s address, node identifier string (ni command), an d other relevant data. all api devices that receive the node identification frame send it out their serial port as an api node identifi cation indicator frame (0x95). associate led the associate pin (pin 28) can provide indication of the device?s network status and diagnostics info rmation. to take advantage of these indications, an led can be connec ted to the associate pin as shown in the figure above. the associate led functionality is enab led by setting the d5 command to 1 (e nabled by default). if enabled, the associate pin is configured as an output and will behave as desc ribed in the following sections. joined indication the associate pin indicates the network status of a device. if the module is not joined to a network, the associate pin is set high. once the module successfully joins a network, the associat e pin blinks at a regular time interval. this is show n in the following figure. joined ? status ? of ? a ? device ? the lt command defines the blin k time of the associate pin. if set to 0, the device uses th e default blink time (500ms for coordinator, 250ms for routers and end devices). diagnostics support the associate pin works with the commissioning pushbutton to provide additional diagno stics behaviors to aid in deploying and testing a network. if the commissioning push button is pressed once, and the device has not joined a network, the associate pin blin ks a numeric error code to indicate the cause of join failure. the number of blinks is equal to (ai value ? 0x20). for example, if ai=0x22, 2 blinks occur. if the commissioning push button is pressed once, and the device has joined a network, the device transmits a broadcast node identification packet. if the associate led functionalit y is enabled (d5 comm and), a device that receives this transmission will blink its associate pin rapidly for 1 second. the following figures demo nstrate these behaviors. ? ai ? = ? 0x22 t device not joined device has joined a network associate the associate pin can indicate the joined status of a device . once the device has joined a network, the associate pin toggles state at a regular interval ( t). the time can be set by using the lt command. associate (d5 = 1 device not joined) a single commissioning button press when the device has not joined a network that causes the associate pin to blink to indicate the ai code where: ai = # blinks + 0x20. in this example, ai = 0x22. ad0/dio0
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 78 ? broadcast ? node ? identification ? transmission ? associate pin (d5 = 1) ad0/dio0 pin (remote device) a single button press on a remote device causes a broadcast node identification transmission to be sent. all devices that receive this transmission blink their associate pin rapidly for one second if the associate led functionality is enabled. (d5 = 1)
? ? 2010 ? digi ? international, ? inc. ????? 79 7. ? managing ? end ? devices zigbee end devices are intended to be battery-powered devices capa ble of sleeping for extended periods of time. since end devices may not be awake to receive rf data at a given time, routers and coordinators are equipped with additional capabilities (including packet buffering and extended transmission timeouts ) to ensure reliable data delivery to end devices. end device operation when an end device joins a zigbee network, it must find a router or coordinator device that is allowing end devices to join. once the end device joins a network, a parent-chi ld relationship is formed be tween the end device and the router or coordinator that allowed it to join. see chapter 3 for details. when the end device is awake, it sends poll request messages to its parent. when the pare nt receives a poll request, it checks a packet queue to see if it has any buffere d messages for the end device. it then sends a mac layer acknowledgment back to the end device that indicates if it has data to send to the end device or not. if the end device receives the acknowledgment and finds th at the parent has no data for it, the end device can return to idle mode or sleep. otherwise, it will remain awake to receive the data. this polling mechanism allows the end device to enter idle mode and turn its receiver off when rf data is no t expected in order to reduce current consumption and conserve battery life. the end device can only send data dire ctly to its parent. if an end device must send a broadcast or a unicast transmission to other devices in the network, it sends th e message directly to its pare nt and the parent performs any necessary route or address discoveries to route the packet to the final destination. parent operation each router or coordinator maintains a ch ild table that contains the addresses of its end device children. a router or coordinator that has unused entries in its child table is said to have end device capacity , or the ability to allow new end devices to join. if the child table is completely filled (such that the number of its end device children matches the number of child table entries), the device ca nnot allow any more end devices to join to it. since the end device children are not guaranteed to be awake at a given time, the parent is responsible for managing incoming data packets in behalf of its end device children. if a pare nt receives an rf data transmission destined for one of its end device chil dren, and if the parent has enough u nused buffer space, it will buffer the packet. the data packet will remain bu ffered until a timeout expires, or until the end device sends a poll request to retrieve the data.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 80 the parent can buffer one broadcast tran smission for all of its end device chil dren. when a broadcas t transmission is received and buffered, the parent sets a flag in its child table when each child polls and retrieves the packet. once all children have received the broadcast pa cket, the buffered broadcast packet is discarded. if all children have not received a buffered broadcast packet an d a new broadcast is received, the old broadcast packet is discarded, the child table flags are cleared, and th e new broadcast packet is buffered fo r the end device ch ildren. this is demonstrated in the figure below. when an end device sends data to its pa rent that is destined for a remote device in the network, the parent buffers the data packet until it can establish a route to the destination. the parent may perform a route or 16-bit address discovery in behalf of its end device ch ildren. once a route is esta blished, the parent sends the data transmission to the remote device. end device poll timeouts to better support mobile end device s (end devices that can move around in a network), parent router and coordinator devices have a poll timeout for each end device child. if an end device does not se nd a poll request to its parent within the poll timeout, the parent will re move the end device from its child table. this allows the child table on a router or coor dinator to better accommodate mo bile end devices in the network. packet buffer usage packet buffer usage on a router or coordinator varies de pending on the application. the following activities can require use of packet buffers for up to several seconds: ? route and address discoveries ? application broadc ast transmissions ? stack broadcasts (e.g. zdo "device announce" messages when devices join a network) ? unicast transmissions (buffered until acknowledgment is received from destinat ion or retries exhausted) ? unicast messages waiting for end device to wake. applications that use regular broadcas ting or that require regular address or route discoveries will use up a significant number of buffers, reducing the buffer availability for managi ng packets for end device children. applications should reduce the number of required application br oadcasts, and consider implementing an external address table or many-to- one and source routing if necessar y to improve routing efficiency. non-parent device operation devices in the zigbee network treat data transmissions to end devices differently than transmissions to other routers and coordinators. recall that when a unicast transmission is sent, if a network acknowledgment is not received within a timeout, the device resends the transmission. when transmitting data to remote coordinator or router devices, the transmission timeout is relatively short since these devices are powered and responsive. however, since end devices may sleep for some time, unicast transmissions to end devices use an extended timeout mechanism in order to allow enough ti me for the end device to wake and re ceive the data transmission from its parent.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 81 if a non-parent device does not know the destination is an end device, it will use the st andard unicast timeout for the transmission. however, provisions exist in the ember zi gbee stack for the parent to inform the message sender that the destination is an en d device. once the sender discovers the dest ination device is an end device, future transmissions will use the extended timeout. see the xbee ro uter / coordinator configuration section in this chapter for details. xbee end device configuration xbee end devices support th ree different sleep modes: ? pin sleep ? cyclic sleep ? cyclic sleep with pin wake-up pin sleep allows an exte rnal microcontroller to determ ine when the xbee should sleep and when it should wake by controlling the sleep_rq pin. in contrast, cyclic sleep al lows the sleep period and wake times to be configured through the use of at commands. cyclic sleep with pin wake-up is the same as cyclic sleep except that the module can be awakened before the sl eep period expires by lowering the sleep_rq line. the sleep mode is configurable with the sm command. in both pin and cyclic sleep modes, xbee end devices poll their parent every 100ms while they are awake to retrieve buffered data. when a poll request has been sent, the end device enables the receiver until an acknowledgment is received from the parent. (i t generally takes less than 10ms from the time the poll request is sent until the acknowledgment is received.) the acknow ledgment indicates if the parent has bu ffered data for the end device child or not. if the acknowledgment indicates the parent has pending data, the end de vice will leave the receiver on to receive the data. otherwise, the end device will turn off the receiver and enter id le mode (until the next poll request is sent) to reduce current consum ption (and improve battery life). once the module enters sleep mode, the on/sleep pin (pin 26) is de-asserted (low) to indicate the module is entering sleep mode. if cts hardware flow control is en abled (d7 command), the cts pi n (pin 12) is de-asserted (high) when entering sleep to indicate that serial data should not be sent to the module. if the associate led pin is configured (d5 command), the associate pi n will be driven low to avoid using power to light the led. finally, the sleep_rq pin will be configured as a pu lled-down input so that an external de vice must drive it high to wake the module. all other pins will be left unmodified during sleep so that they can operate as previously configured by the user. the module will not respond to serial or rf data when it is sleeping. applications that must communicate serially to sleeping end devices are en couraged to observe cts flow control. when the xbee wakes from sleep, the on/s leep pin is asserted (high), and if fl ow control is enabled, the cts pin is also asserted (low). the associate led and all other pins resume their former configured operation. if the module has not joined a network, it will scan all sc channels after waking to try and find a valid network to join. pin sleep pin sleep allows the module to sleep and wake according to the state of the sleep_rq pin (pin 9). pin sleep mode is enabled by setting the sm command to 1. when sleep_rq is asserted (high), th e module will finish any transmit or receive operations and enter a low power state. for example, if the module has not joined a network and sleep_rq is asserted (high), the module will sleep once the current join attempt completes (i .e. when scanning for a va lid network completes). the module will wake from pin sleep when the sleep_rq pin is de-asserted (low).
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 82 in the figure above, t 1 , t 2 , t 3 and t 4 represent the following events: ? t 1 - time when sleep_rq is asserted (high) ? t 2 - time when the xbee enters sleep (cts state ch ange only if hardware flow control is enabled) ? t 3 - time when sleep_rq is de-ass erted (low) and the module wakes. ? t 4 - time when the module sends a poll request to its parent. the time between t 1 and t 2 varies depending on the state of the modu le. in the worst case scenario, if the end device is trying to join a network, or if it is waitin g for an acknowledgment from a data transmission, the delay could be up to a few seconds. the time between t3 and t4 is 1-2 ms for a regular module and about 6 ms for a pro module. when the xbee is awake and is joined to a network, it sends a poll request to its parent to see if the parent has any buffered data for it. the end device will continue to send poll requ ests every 100ms while it is awake.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 83 demonstration ? of ? pin ? sleep parent and remote devices mu st be configured to buffer data correctly and to utilize adequate transmission timeouts. see the xbee router / coordinator conf iguration section in this chapter for details. cyclic sleep cyclic sleep allows the module to slee p for a specified time and wake for a short time to poll its parent for any buffered data messages befo re returning to sleep again. cyclic sl eep mode is enabled by setting the sm command to 4 or 5. sm5 is a slight variation of sm4 that allows the module to be woken prematurely by asserting the sleep_rq pin (pin 10). in sm5, the xbee can wake after the sleep period ex pires, or if a high-to- low transition occurs on the sleep_rq pin. se tting sm to 4 disables the pin wake option. in cyclic sleep, the module sleeps for a specified time, an d then wakes and sends a poll request to its parent to discover if the parent has any pend ing data for the end devi ce. if the parent has buffered data for the end device, or if serial data is received, the xbee will remain awake for a time. otherwise, it will enter sleep mode immediately. the on/sleep line is asserted (high) when the module wakes, and is de-asserted (low) when the module sleeps. if hardware flow control is enabled (d7 command), the cts pin will assert (low) when the module wakes and can receive serial data, and de-asser t (high) when the module sleeps.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 84 in the figure above, t1, t2, and t3 represent the following events: ?t1 - time when the module wakes from cyclic sleep ?t2 - time when the mo dule returns to sleep ?t3 - later time when the module wakes from cyclic sleep. the wake time and sleep time are configurable with so ftware commands as descri bed in the sections below. wake time (until sleep) in cyclic sleep mode (sm=4 or 5), if serial or rf data is received, the module will start a sleep timer (time until sleep). any data received serially or over the rf link will restart the timer. the sleep timer value is settable with the st command. whil e the module is awake, it will se nd poll request transmissions every 100ms to check its parent for buffe red data messages. the module returns to sleep when the sleep timer expires, or if the si comman d is sent to it. the following image shows this behavior.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 85 sleep period the sleep period is configured based on the sp, sn, and so commands. the following table lists the behavior of th ese commands. the xbee module supports both a short cyclic sleep an d an extended cyclic sleep that make use of these commands. these two modes allow th e sleep period to be configured according to the application requirements. short cyclic sleep in short cyclic sleep mode, the sleep behavior of th e module is defined by the sp and sn commands, and the so command must be set to 0x00 (default) or 0x02. in short cyclic sleep mode, the sp command defines the sleep period and is settable up to 28 seconds. when the xbee enters short cyclic sleep, it remains in a low power state un til the sp time has expired. after the sleep period expires, the xb ee sends a poll request transmission to its parent to determine if its parent has any buffered data waitin g for the end device. since router and coordinator devices can buffer data for end device children up to 30 seconds, the sp range (up to 28 seconds) allows the end device to poll regularly enough to receiv e buffered data. if the parent has data for the end device, the end device will start its sleep timer (st) and contin ue polling every 100ms to receive data. if the end device wakes and finds that its parent has no data for it, the end device ca n return to sleep immediately. the sn command can be used to cont rol when the on/sleep line is asse rted (high). if sn is set to 1 (default), the on/sleep line will be set high each time the xbee wakes from slee p. otherwise, if sn is greater than 1, the on/sleep line will only be set high if rf data is received, or after sn wake cycles occur. this allows an external device to remain powered off until rf data is received, or until a number of sleep periods have expired (sn sleep period s). this mechanism allows the xbee to wake at regular intervals to poll its parent for data without waking an external de vice for an extended time (sp * sn time). this is shown in the figure below. command range description sp 0x20 - 0xaf0 (x 10 ms) (320 - 28,000 ms) configures the sleep period of the module. sn 1 - 0xffff configures the number of sleep periods multiplier. so 0 - 0xff defines options for sleep mode behavior. 0x02 - always wake for full st time 0x04 - enable extended sleep (sleep for full (sp * sn) time) din a cyclic sleep end device enters sleep mode when no serial or rf data is received for st time . st = time awake on/sleep legend on/sleep transmitting poll request
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 86 note: sp controls the packet buffer time on routers and coordi nators. sp should be set on all router and coordinator devices to match the longest end device sp time. see the xbee router / coordinator configuration section for details. extended cyclic sleep in extended cyclic sleep operation, an end device can sleep for a multiple of sp time which can extend the sleep time up to several days. the sleep period is configured using the sp and sn commands. the total sleep period is equal to (sp * sn) where sp is measured in 10ms un its. the so command must be set correctly to enable extended sleep. since routers and coordinators can only buffer incoming rf data for their end device children for up to 30 seconds, if an end device sleeps longer than 30 seconds, devices in the network need some indication when an end device is awake before they can send data to it. end devices that use extended cyclic sleep should send a transmission (such as an io sample) when they wake to inform other devices that they are awake and can receive data. it is recommended that extended sleep end de vices set so to wake for the full st time in order to provide other devices with enou gh time to send messag es to the end device. similar to short cyclic sleep, end devices running in this mode will return to sleep when the sleep timer expires, or when the si command is received. transmitting rf data an end device may transmit data wh en it wakes from sleep and has joined a network. end devices transmit directly to their parent and then wait for an acknowledgment to be re ceived. the parent will perform any required address and route discoverie s to help ensure the packet reache s the intended destination before reporting the transmission status to the end device. receiving rf data after waking from sleep, an end device sends a poll requ est to its parent to determ ine if the parent has any buffered data for it. in pin sleep mode, the end device polls every 100ms while the sleep_rq pin is de-asserted (low). in cyclic sleep mode, the end device will only poll once before returning to sleep un less the sleep timer (st) is started (serial or rf data is received). if the sleep timer is started, the end device will continue to poll every 100ms until the sleep timer expires. on/sleep t = sp t = sp * sn (sn = 1) setting sn > 1 allows the xbee to silently poll for data without asserting on /sleep. if rf data is received when polling, on/sleep will immediately assert . transmitting poll request to parent t = sp sleep_rq transmitting poll request legend t = sp * sn on/sleep (sn = 3) transmitting poll request to parent
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 87 this firmware includes an adaptive polling enhancement where, if an end device re ceives rf data from its parent, it sends another poll after a very short delay to check for more data. the end device co ntinues to poll at a faster rate as long as it receives data from its parent. this feature grea tly improves data throughput to end devices. when the end device no longer receives data from its pare nt, it resumes polling every 100ms. i/o sampling end devices can be configured to send one or more i/ o samples when they wake from sleep. to enable i/o sampling on an end device, th e ir command must be set to a non-zero va lue, and at least one analog or digital i/o pin must be enabled for sampling (d0 - d9, p0-p4 commands). if i/o sampling is enabled, an end device sends an i/o sample when it wakes and starts the st time r. it will continue sampling at the ir rate until the sleep timer (st) has expired. see chapter 8 for details. waking end devices with the commissioning pushbutton if the commissioning pushbutton functionality is enabled (d0 command), a high-to-low transition on the ad0/ dio0 pin (pin 33) will cause an end device to wake fo r 30 seconds. see the commissioning pushbutton section in chapter 7 for details. parent verification since an end device relies on its pare nt to maintain connectivity with other devices in the network, xbee end devices include provisions to verify its connection with its parent. end devices moni tor their link with their parent when sending poll messages and after a power cycle or reset ev ent as described below. when an end device wakes from sleep, it sends a poll request to its parent. in cyclic sleep, if rf or serial data is not received and the sleep timer is not started, the end device polls one time and re turns to sleep for another sleep period. otherwise, the end device continues po lling every 100ms. if the parent does not send an acknowledgment response to three consecutive poll request transmissions, the end device assumes the parent is out of range, and attempts to find a new parent. after a power-up or reset event, the en d device does an orphan scan to loca te its parent. if the parent does not send a response to the orphan scan, the en d device attempts to find a new parent. rejoining once all devices have joined a zigbee network, the permit -joining attribute should be disabled such that new devices are no longer allowed to join the network. pe rmit-joining can be enabled later as needed for short times. this provides some prot ection in preventing other devi ces from joining a live network. if an end device cannot communicate with its parent, th e end device must be able to join a new parent to maintain network connectivity. however, if permit-joining is disabled in the network, the end device will not find a device that is allowing new joins. to overcome this problem, zigbee su pports rejoining, where an end device can obtain a new parent in the same network even if joining is not enabled. when an end device join s using rejoining, it performs a pan id scan to discover nearby networks. if a network is discovered that has the same 64-bit pan id as the end device, it will join the network by sending a rejoin request to one of the discovered devi ces. the device that receives the rejoin request will send a rejo in response if it can allow the device to join the network (i.e. child table not full). the rejoin mechanism can be used to al low a device to join the same network even if permit-joining is disabled. to enable rejoining, nj should be set less than 0xff on the device that will join. if nj < 0xff, the device assumes the network is not allowing joining and first tries to join a network using rejoining. if multiple rejoining attempts fail, or if nj=0xff, the device will attempt to join using association. xbee router/coordinator configuration xbee routers and coordinators may require some config uration to ensure the fo llowing are set correctly: ? rf packet bu ffering timeout ? child poll timeout ? transmission timeout.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 88 the value of these timeouts depends on the sleep time used by the end devices. each of these timeouts are discussed below. rf packet buffering timeout when a router or coordinator receives an rf data packet intended for one of its end device children, it buffers the packet until the end device wakes and polls for the data, or until a packet buff ering timeout occurs. this timeout is settable using the sp command. the actual timeout is (1.2 * sp), with a minimum timeout of 1.2 seconds and a maximum of 30 seconds. since the packet buffering timeout is set slig htly larger than the sp setting, sp should be set the same on routers and coordinators as it is on cyclic sleep end devices. for pin sleep devices, sp should be set as long as the pin sleep device can sleep, up to 30 seconds. note: in pin sleep and extended cyclic sleep, end devices can sleep longer than 30 seconds. if end devices sleep longer than 30 seconds, parent and no n-parent devices must know when th e end device is awake in order to reliably send data. for applications th at require sleeping longer than 30 seconds, end devices should transmit an io sample or other data when they wake to alert ot her devices that they can send data to the end device. child poll timeout router and coordinator devices maintain a timestamp for each en d device child indicating when the end device sent its last poll request to check for buffered data packets. if an end device does not se nd a poll request to its parent for a certain period of time, the parent will assume the end device has moved out of range and will remove the end device from its child ta ble. this allows routers and coordina tors to be respon sive to changing network conditions. the nc command can be issued at any time to read the number of remaining (unused) child table entries on a router or coordinator. the child poll timeout is settable with the sp and sn commands. sp and sn should be set such that sp * sn matches the longest expected sleep time of any end devices in the network. the actual timeout is calculated as (3 * sp * sn), with a minimum of 5 seconds. for networks consisting of pin sleep end devices, the sp and sn values on the coordinator and routers should be set such that sp * sn matches the longest expected sleep period of any pin sleep device . the 3 multiplier ensures the end device will not be removed unless 3 sleep cycles pass without receiving a poll request. the poll timeout is se ttable up to a couple of months. adaptive polling the po command determines the regular polling rate. however, if rf data has been recently received by an end device, it is likely that yet more rf da ta could be on the way. therefore, the end device will poll at a faster rate, gradually decreasing its adaptive poll rate until poll ing resumes at the regular rate as defined by the po command. transmission timeout as mentioned in chapte r 4, when sending rf data to a remote rout er, since routers are always on, the timeout is based on the number of hops the transmission may traverse. this timeout it settable using the nh command. (see chapter 4 for details.) since end devices may sleep for lengthy periods of time, the transmission timeout to end devices also includes some allowance for the slee p period of the end device. when send ing data to a remo te end device, the transmission timeout is calculated using the sp and nh commands. if the timeout occurs and an acknowledgment has not been received, the source device will resend the transmission until an acknowledgment is received , up to two more times. the transmission timeout per attempt is: 3 * ((unicast router timeout) + (end device sleep time)), or 3 * ((50 * nh) + (1.2 * sp)), where sp is measured in 10ms units.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 89 putting it all together short sleep periods pin and cyclic sleep devices that sleep less than 30 seconds can receive data transmissions at any time since their parent device(s) will be able to buffer data long en ough for the end devices to wa ke and poll to receive the data. sp should be set the same on all devices in the ne twork. if end devices in a network have more than one sp setting, sp on the routers and coor dinators should be set to match the largest sp setting of any end device. this will ensure the rf packet buffering, poll timeout, and transmis sion timeouts are set correctly. extended sleep periods pin and cyclic sleep devices that might sleep longer than 30 seconds cannot receive data transmissions reliably unless certain design approaches ar e taken. specifically, the end devices should use io sampling or another mechanism to transmit data when they wake to inform the network they can receive data. sp and sn should be set on routers and coordinators such that (sp * sn) matches the longest expected sleep time. this configures the poll timeout so end devices are not expired from the ch ild table unless a poll requ est is not received for 3 consecutive sleep periods. as a general rule of thumb, sp and sn should be set the same on all devices in almost all cases. sleep examples this section covers some sample xbee configurations to support different sleep modes. severa l at commands are listed with suggested parameter values. the notation in th is section includes an '=' si gn to indicate what each command register should be set to - for example, sm=4. this is not th e correct notation for setting command values in the xbee. in at command mode, each command is issued with a leading 'at' and no '= ' sign - for example atsm4. in the api, the two byte command is used in the command field, and parameters are popu lated as binary values in the parameter field. example 1 configure a device to sleep for 20 seconds, but set sn such that the on/sleep line will remain de- asserted for up to 1 minute. the following settings should be configured on the end device. sm = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake) sp = 0x7d0 (2000 decimal). this causes the end device to sleep for 20 seconds since sp is measured in units of 10ms. sn = 3. (with this setting, the on/sle ep pin will assert once every 3 sleep cycles, or when rf data is received) so = 0 all router and coordinator devices on the network should set sp to match sp on th e end device. this ensures that rf packet buffering times and transm ission timeouts will be set correctly. since the end device wakes after each sleep period (ats p), the sn command can be set to 1 on all routers and the coordinator. example 2 configure an end device to sleep for 20 seconds, send 4 io sample s in 2 seconds, and return to sleep. since sp is measured in 10ms units, and st and ir are measured in 1ms uni ts, configure an end device with the following settings: sm = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake) sp = 0x7d0 (2000 decimal). this causes the end device to sleep for 20 seconds. sn = 1 so = 0 st = 0x7d0 (2000 decimal). this sets the sleep timer to 2 seconds.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 90 ir = 0x258 (600 decimal). set ir to a value greater than (2 seconds / 4) to get 4 samples in 2 seconds. the end device sends an io sample at the ir rate until the sleep timer has expired. at least one analog or digital io line must be enabled for io sampling to work. to enable pin 32 (ad1/dio1) as a digital input line, the following must be set: d1 = 3 all router and coordinator devices on the network should set sp to match sp on th e end device. this ensures that rf packet buffering times and transm ission timeouts will be set correctly. example 3 configure a device for extended sleep: to sleep for 4 minutes. sp and sn must be set such that sp * sn = 4 minutes. sinc e sp is measured in 10ms units, the following settings can be used to obtain 4 minute sleep. sm = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake) sp = 0x7d0 (2000 decimal, or 20 seconds) sn = 0x0b (12 decimal) so = 0x04 (enable extended sleep) with these settings, the module will sleep for sp * sn time, or (20 seconds * 12) = 240 seconds = 4 minutes. for best results, the end device should send a transmission when it wakes to inform the coordinator (or network) when it wakes. it should al so remain awake for a short time to allow devices to send data to it. the following are recommended settings. st = 0x7d0 (2 second wake time) so = 0x06 (enable extended sleep and wake for st time) ir = 0x800 (send 1 io sample after waking). at least one analog or digital io sample should be enabled for io sampling. with these settings, the end device will wake after 4 mi nutes and send 1 io sample. it will then remain awake for 2 seconds before returning to sleep. sp and sn should be set to the same values on all routers and coordinators that could allow the end device to join. this will ensure the parent does not timeout the end device from its child ta ble too quickly. the si command can optionally be sent to the end device to cause it to sleep before the sl eep timer expires.
? ? 2010 ? digi ? international, ? inc. ????? 91 8. ? xbee ? analog ? and ? digital ? i/o ? lines xbee zb firmware supports a number of an alog and digital i/o pins that are configured through software commands. analog and digital i/o lines can be se t or queried. the following table list s the configurable i/o pins and the corresponding configuration commands. i/o configuration to enable an analog or digital i/o function on one or more xbee module pin(s), the appropriate configuration command must be issued with the correct parameter. af ter issuing the configuration command, changes must be applied on the module for the i/o settings to take effect. module pin names module pin at command command range dout/dio13 3 p3 0, 1, 3-5 din/config /dio14 4 p4 0, 1, 3-5 pwm rssi/dio10 7 p0 0, 1, 3-5 pwm1/dio11 8 p1 0, 1, 3-5 dtr/slp_rq/dio8 10 d8 0, 1, 3-5 pti_data/spi_attn /adc5/ dio19 12 p9 0, 1, 6 spi_sclk/dio18 14 p8 0, 1 spi_ssel/ dio17 15 p7 0, 1 spi_mosi/dio16 16 p6 0, 1 spi_miso/dio15 17 p5 0,1 jtms/swdio/dio12/cd 21 p2 0, 3-5 jtrst/dio4 24 d4 0, 3-5 cts /dio7 25 d7 0, 1, 3-7 jtdo/on_slp /dio9 26 d9 0, 1, 3-5 jtdi/assoc/dio5 28 d5 0, 1, 3-5 rts/dio6/sclk2 29 d6 0, 1, 3-5 ad3/dio3 30 d3 0, 2-5 ad2/dio2 31 d2 0, 2-5 pti_en/ad1/dio1 32 d1 0, 2-6 ad0/dio0/comm 33 d0 0-5 pin command parameter description 0 disabled. (see below) 1 peripheral control 2 analog 3 data in monitored. (see below)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 92 when the pin command para meter is a 0 or a 3, it operates the same on this platform, except th at the pin will not be monitored by i/o sampling if the parameter is 0. inputs have three variations: ? floating ? pulled-up ? pulled-down a floating input is appropriate if the pin is attached to an output that always dr ives the line. in this case, a pull-up or pull-down resistor would ca use more current to be drawn. a pulled-up input is useful where there might not always be an external source to drive th e pin and it is desirable to have the line read high in the absence of an external driver. likewise, a pulled-down input is useful when there is not always an external source to drive the pin and it is desir- able to have the line read low in the absence of an external driver. two commands are available to configure the input type: ? pr determines whet her or not an input is pulled. if the correspond ing bit in pr is set, th en the signal will be pulled. if it is clear, then the signal will be floating. ? pd determines the pull direction. it only applies when the corresponding bit in pr is set. the bit in pd should be set to enable an internal pull-up resistor. it should be cleared to en able an internal pull-down resistor. i/o sampling the xbee zb modules have the ability to monitor and samp le the analog and digital i/o lines. i/o samples can be read locally or transmitted to a remote device to provide indication of the curre nt i/o line states. api mode must be enabled on the receiving device in order to send i/o sample s out the serial port. if this mode is not enabled, then remote i/o samples will be discarded there are three ways to obtain i/o sa mples, either locally or remotely: ? queried sampling ? periodic sampling ? change detect ion sampling. io sample data is formatted as shown in the table below 4 data out default low 5 data out default high 6 rs485 enable low / packet trace interface 7 rs485 enable high >7 unsupported bytes name description 1 sample sets number of sample sets in the packet. (always set to 1.) pin command parameter description
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 93 the sampled data set will in clude 2 bytes of digital i/o data only if one or more i/o lines on the device are configured as digital i/o. if no pins ar e configured as digital io, these 2 bytes wi ll be omitted. pins are configured as digital i/o by sett ing them to a value of 3, 4, or 5. the digital i/o data is only relevant if the same bit is enabled in the digital i/o mask. analog samples are returned as 10-bit values. the analog reading is scaled such that 0x0000 represents 0 v, and 0x3ff = 1.2 v. (the analog inputs on the module cannot read mo re than 1.2 v.) analog samples are returned in order starting with ain0 and finishing with ain3, and the su pply voltage. only enabled an alog input chan nels return data as shown in the figure below. to convert the a/d reading to mv, do the following: ad(mv) = (a/d reading * 1200mv) / 1024 the reading in the sample frame represents voltag e inputs of 1143.75 and 342.1875 mv for ad0 and ad1 respectively. 2 digital channel mask indicates which digital io lines have sampling enabled. each bit corresponds to one digital io line on the module. ? bit 0 = ad0/dio0 ? bit 1 = ad1/dio1 ? bit 2 = ad2/dio2 ? bit 3 = ad3/dio3 ? bit 4 = dio4 ? bit 5 = assoc/dio5 ?bit 6 = rts/dio6 ?bit 7 = cts/gpio7 ?bit 8 = slp_rq/dio8 ? bit 9 = on_slp /dio9 ? bit 10 = rssi/dio10 ? bit 11 = pwm/dio11 ? bit 12 = cd/dio12 ? bit 13 = dout/dio13 ? bit 14 = din/dio14 for example, a digital channel mask of 0x 002f means dio0,1,2,3, and 5 are enabled as digital i/o. 1 analog channel mask indicates which lines have analog inputs enabl ed for sampling. each bit in the analog channel mask corresponds to one analog input channel. ? bit 0 = ad0/dio0 ? bit 1 = ad1/dio1 ? bit 2 = ad2/dio2 ? bit 3 = ad3/dio3 ? bit 7 = supply voltage variable sampled data set a sample set consisting of 1 sample for each enabled adc and/or dio channel, which has voltage inputs of 1143.75 and 342.1875mv. if any digital i/o lines are enabled, the first two bytes of the data set indicate the state of all enabled digital i/o. only digital c hannels that are enabled in the digital channel mask bytes have any meaning in the sample set. if no digital i/o are enabled on the device, these 2 bytes will be omitted. following the digital i/o data (if any), each e nabled analog channel will return 2 bytes. the data starts with ain0 and continue s sequentially for each enabled analog input channel up to ain3, and the supply voltage (if enabled) at the end. bytes name description
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 94 queried sampling the is command can be sent to a device locally, or to a remote device using th e api remote command frame (see chapter 8 for details). when the is command is sent, the receivin g device samples all enabled digital io and analog input channels and returns an io sample. if is is sent locally, the io samp le is sent ou t the serial port. if the is command was received as a remote command, the io sample is sent over-the-air to the device that sent the is command. if the is command is issued in command mode, the module returns a carriage return-delimited list containing the above-listed fields. if the is command is issued in api mode, an api command response contains the same information. the following table shows an example of the fields in an is response. periodic i/o sampling periodic sampling allows an xbee module to take an i/o sample and transmit it to a remote device at a periodic rate. the periodic sample rate is set by the ir command. if ir is set to 0, periodic sampling is disabled. for all other values of ir, data will be samp led after ir milliseconds have elapse d and transmitted to a remote device. the dh and dl commands determine the destination addres s of the i/o samples. dh and dl can be set to 0 to transmit to the coordinator, or to the 64-bit address of the remote device (sh and sl). only devices running in api mode can send i/o data samples out their serial po rt. devices running in tran sparent mode will discard received i/o data samples. a sleeping end device wi ll transmit periodic io samples at the ir ra te until the st timer expires and the device can resume sleeping. change detection sampling modules can be configured to transmit a data sample immediately whenever a monito red digital i/o pin changes state. the ic command is a bitmask th at can be used to set which digital i/o lines should be monitored for a state change. if one or more bits in ic is set, an i/o sample will be tran smitted as soon as a state change is observed in one of the monitored digital io lines. ch ange detection samples are transmitted to the 64-bit address specified by dh and dl. rssi pwm the xbee module features an rssi/pwm pin (pin 7) that, if enabled, will adjust the pwm output to indicate the signal strength of the last received packet. the p0 (p -zero) command is used to enable the rssi pulse width modulation (pwm) output on the pin. if p0 is set to 1 (and p1 is not set to 1), the rssi/pwm pin will output a pulse width modulated signal where the frequency is adjusted base d on the received signal st rength of the last packet. otherwise, for all other p0 settings, the pin can be us ed for general purpose io. when a data packet is received, if p0 is set to enable the rssi/pwm feature, the rssi pwm output is adjusted based on the rssi of the last packet. the rssi/pwm output will be enabled for a time based on the rp command. each time an rf packet is received, the rssi/pwm output is adjusted based on the rssi of the new packet, and the rssi timer is reset. if the rssi timer expi res, the rssi/pwm pin is driven low. rp is measured in 100ms units and defaults to a value of 40 (4 seconds). the rssi pwm runs at 12mhz and has 2400 total counts (200us period). rssi (in dbm) is converted to pwm counts using the following equation: pwm counts = (41 * rssi_unsigned) - 5928 example sample at response 0x01 [1 sample set] 0x0c0c [digital inputs: dio 2, 3, 10, 11 low] 0x03 [analog inputs: a/d 0, 1] 0x0408 [digital input states: dio 3, 10 high, dio 2, 11 low] 0x03d0 [analog input adio 0= 0x3d0] 0x0124 [analog input adio 1=0x120]
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 95 i/o examples example 1: configure the following i/o settings on the xbee. configure ad1/dio1 as a digital in put with pullup resistor enabled configure ad2/dio2 as an analog input configure dio4 as a digital output, driving high. to configure ad1/dio1 as an input, issue the atd1 command with a paramete r of 3 ("atd13"). to enable pull- up resistors on the same pin, the pr command should be issued with bit 3 set (e.g. atpr8, atpr1fff, etc.). the atd2 command should be issued with a parameter of 2 to enable the analog input ("atd22"). finally, dio4 can be set as an output, driving hi gh by issuing the atd4 command with a parameter value of 5 ("atd45"). after issuing these commands, changes must be appl ied before the module io pins will be updated to the new states. the ac or cn commands can be issued to apply changes (e.g. atac). example 2: calculate the pwm counts for a pa cket received with an rssi of -84dbm. rssi = -84 = 0xac = 172 decimal (unsigned) pwm counts = (41 * 172) - 5928 pwm counts = 1124 with a total of 2400 counts, this yields an on time of (1124 / 2400) = 46.8% example 3: configure the rssi/pwm pin to operate for 2 seconds after each received rf packet. first, ensure the rssi/pwm functional ity is enabled by reading the p0 (p-z ero) command. it should be set to 1 (default). to configure the duration of the rssi/pwm output, set the rp command. to achieve a 2 second pwm output, set rp to 0x14 (20 decimal, or 2 seco nds) and apply changes (ac command). after applying changes, all rece ived rf data packets should se t the rssi timer for 2 seconds. pwm1 when p1 is configured for peripheral operation by settin g the value to 1, it outputs a 50% duty cycle pwm with a clock rate of 32,787 hz, wh ich is a period of 30.5 ? s. the main purpose of the pwm output is to provide a clock for the plus processor, although it may also be used for other purposes. *when this feature is enabled, the rssi pwm output is automatically disabled, even if it is configured.
? ? 2010 ? digi ? international, ? inc. ????? 96 9. ?? api ? operation as an alternative to transparent operation, api (applicat ion programming interface) operations are available. api operation requires that commun ication with the module be done through a structured in terface (data is communicated in frames in a defined or der). the api specifies how commands, command responses and module status messages are sent and received from the module usin g a serial port data frame. please note that digi may add new api frames to future versio ns of firmware, so please build into your software interface the ability to filter out additional api frames with unknown frame types. api frame specifications two api modes are supported and both can be enabled usin g the ap (api enable) comm and. use the following ap parameter values to configure the modu le to operate in a particular mode: ?ap = 1: api operation ?ap = 2: api operation (w ith escaped characters) api operation (ap parameter = 1) when this api mode is enabled (ap = 1), the serial port data frame structur e is defined as follows: serial ? port ? data ? frame ? structure: msb ? = ? most ? significant ? byte, ? lsb ? = ? least ? significant ? byte any data received prior to the start delimiter is silently discarded. if the frame is no t received correctly or if the checksum fails, the module will reply with a module status frame in dicating the nature of the failure. api operation - with escape characters (ap parameter = 2) this mode is only available on the uart, not on the spi serial port. when this api mode is enabled (ap = 2), the uart data frame structure is defined as follows: uart ? data ? frame ? structure ?\? with ? escape ? control ? characters: msb ? = ? most ? significant ? byte, ? lsb ? = ? least ? significant ? byte escape characters . when sending or receiving a uart data fram e, specific data valu es must be escaped (flagged) so they do not interfere with the data fr ame sequencing. to escape an interfering data byte, insert 0x7d and follow it with the byte to be escaped xor?d with 0x20. length (bytes 2-3) checksum (byte n + 1) msb lsb 1 byte start delimiter (byte 1) 0x7e frame data (bytes 4- n ) api-specific structure start delimiter (byte 1) length (bytes 2-3) frame data (bytes 4-n) checksum (byte n + 1) 0x7e msb lsb api-specific structure 1 byte characters escaped if needed
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 97 data bytes that need to be escaped: ?0x7e ? frame delimiter ?0x7d ? escape ?0x11 ? xon ?0x13 ? xoff example - raw uart data frame (before escaping interfering bytes): ? 0x7e 0x00 0x02 0x23 0x11 0xcb 0x11 needs to be escaped which results in the following frame: ? 0x7e 0x00 0x02 0x23 0x7d 0x31 0xcb note: in the above example, the length of the ra w data (excluding the checksum) is 0x0002 and the checksum of the non-escaped da ta (excluding frame delimiter and length) is calculated as: ? 0xff - (0x23 + 0x11) = (0xff - 0x34) = 0xcb. length the length field has a two-byte value that specifies the number of bytes that will be contained in the frame data field. it does not include the checksum field. frame data frame data of the serial port data frame forms an api-specific structure as follows: serial ? port ? data ? frame ? & ? api \ specific ? structure: the cmdid frame (api-identifier) in dicates which api messages will be contained in the cmddata frame (identifier-specific data). note that multi-byte valu es are sent big endian.the xbee modules support the following api frames: api ? frame ? names ? and ? va l u e s api frame names api id at command 0x08 at command - queue parameter value 0x09 zigbee transmit request 0x10 explicit addressing zigbee command frame 0x11 remote command request 0x17 create source route 0x21 at command response 0x88 modem status 0x8a zigbee transmit status 0x8b zigbee receive packet (ao=0) 0x90 zigbee explicit rx indicator (ao=1) 0x91 zigbee io data sample rx indicator 0x92 xbee sensor read indicator (ao=0) 0x94 node identification indicator (ao=0) 0x95 remote command response 0x97 over-the-air firmware update status 0xa0 route record indicator 0xa1 many-to-one route request indicator 0xa3 length (bytes 2-3) checksum (byte n + 1) msb lsb 1 byte start delimiter (byte 1) 0x7e frame data (bytes 4- n ) api-specific structure identifier-specific data cmddata api identifier cmdid
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 98 checksum to test data integrity, a checksum is ca lculated and verified on non-escaped data. to calculate : not including frame delimiters and length, add all bytes keeping only the lowest 8 bits of the result and subtract the result from 0xff. to verify : add all bytes (include checksum, but not the delimiter and length). if the checksum is correct, the sum will equal 0xff. api examples example : create an api at command frame to configure an xb ee to allow joining (set nj to 0xff). the frame should look like: 0x7e 0x00 0x05 0x08 0x01 0x4e 0x4a 0xff 5f where 0x0005 = length 0x08 = at command api frame type 0x01 = frame id (set to non-zero value) 0x4e4a = at command ('nj') 0xff = value to set command to 0x5f = checksum the checksum is calculated as [0xff - (0x08 + 0x01 + 0x4e + 0x4a + 0xff)] example : send an nd command to discover the device s in the pan. the frame should look like: 0x7e 0x00 0x04 0x08 0x01 0x4e 0x44 0x64 where 0x0004 = length 0x08 = at command api frame type 0x01 = frame id (set to non-zero value) 0x4e44 = at command ('nd') 0x64 = checksum the checksum is calculated as [0xff - (0x08 + 0x01 + 0x4e + 0x44)] example : send a remote command to the coordinator to se t ad1/dio1 as a digital input (d1=3) and apply changes to force the io update. the api remote command frame should look like: 0x7e 0x00 0x10 0x17 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xfe 0x02 0x44 0x31 0x03 0x70 where 0x10 = length (16 bytes excluding checksum) 0x17 = remote command api frame type 0x01 = frame id 0x0000000000000000 = coordinator's address (can be replaced with coordinator's actual 64-bit address if known) 0xfffe = 16- bit destination address 0x02 = apply changes (remote command options) 0x4431 = at command ('d1') 0x03 = command parameter (the parameter could also be sent as 0x0003 or 0x00000003) 0x70 = checksum
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 99 api serial port exchanges at commands the following image shows the api frame exchange that takes place at the serial port when sending an at command request to read or set a modu le parameter. the response can be di sabled by setting the frame id to 0 in the request. transmitting and receiving rf data the following image shows the api exchanges that take plac e at the serial port when sending rf data to another device. the transmit status fr ame is always sent at the end of a data tr ansmission unless the frame id is set to 0 in the transmit request. if the pack et cannot be delivered to the destinat ion, the transmit status frame will indicate the cause of failure. the received data frame (0x90 or 0x91) is set by the ap command. remote at commands the following image shows the api frame exchanges that take place at the serial port when sending a remote at command. a remote command re sponse frame is not sent out the serial port if the remote device does not receive the remote command.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 100 source routing the following image shows the api frame exchanges that ta ke place at the serial po rt when sending a source routed transmission. supporting the api applications that support the api should make provisions to deal with new api frames that may be introduced in future releases. for example, a section of code on a host microprocessor that handles received serial api frames (sent out the module's dout pin) might look like this: api frames the following sections illustrate the types of frames encountere d while using the api. at command frame type: 0x08 ? used to query or set module parameters on the local device. this api command appl ies changes after executing the command. (changes made to module parameters take effect once changes are applied.) the api example below illustrates an api frame when modify ing the nj parameter value of the module void xbee _ handlerxapiframe ( _ apiframeunion * papiframe ) { switch(papiframe->api_id){ case rx_rf_data_frame: //process received rf data frame break; case rx_io_sample_frame: //process io sample frame break; case node_identification_frame: //process node identification frame break; default: //discard any other api frame types that are not being used break; } }
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 101 the above example illustrates an at command when querying an nj value. at command - queu e parameter value frame type: 0x09 ? this api type allows module paramete rs to be queried or set. in contra st to the ?at command? api type, new parameter values are queued and not applied until either the ?at command? (0x08) api type or the ac (apply changes) command is issued. register queries (rea ding parameter values) ar e returned immediately. example: send a command to change the baud rate (bd) to 115200 baud, but don't apply changes yet. (module will continue to operate at the previous baud rate until changes are applied.) note : in this example, the parameter could have been sent as a zero-p added 2-byte or 4-byte value. zigbee transmit request frame type: 0x10 a transmit request api frame causes th e module to send data as an rf pa cket to the specified destination. the 64-bit destination address should be set to 0x000000000000ffff for a broadcast transmission (to all devices). the coordinator can be addr essed by either setting the 64-bit address to all 0x00s and the 16-bit address to 0xfffe, or by setting the 64-bit address to the coordinator's 64-bit address and the 16-bit address to 0x0000. for all other transmissions, setting the 16-bit address to the correct 16-bit address can help improve performance when transmit ting to multiple destinations. if a 16-bit address is not known, this field should be set to 0xfffe (unknown). the transmit status frame (0x8b) will indicate the discovered 16-bit address, if successful. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x04 frame-specific data frame type 30x08 frame id 4 0x52 (r) identifies the serial port data frame for the host to correlate with a subsequent ack (acknowledgement). if set to 0, no response is sent. at command 50x4e (n) command name - two ascii characters that identify the at command. 60x4a (j) parameter value (optional) if present, indicates the requested parameter value to set the given register. if no characters present, register is queried. checksum 7 0x0d 0xff - the 8 bit sum of bytes from offset 3 to this byte. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x05 frame-specific data frame type 30x09 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent ack (acknowledgement). if set to 0, no response is sent. at command 5 0x42 (b) command name - two ascii characters that identify the at command. 6 0x44 (d) parameter value ? (atbd7 = 115200 baud) 70x07 if present, indicates the requested parameter value to set the given register. if no characters present, register is queried. checksum 8 0x68 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 102 the broadcast radius can be set from 0 up to nh. if set to 0, the value of nh specifies the broadcast radius (recommended). this parameter is on ly used for broadcast transmissions. the maximum number of payload bytes can be read with the np command. note : if source routing is used, the rf payload will be reduced by two bytes per intermediate hop in the source route. this example shows if escaping is disabled (ap=1). example : the example above shows how to send a transmission to a module where escaping is disabled (ap=1) with destination address 0x0013a200 40014011, payload "txdata1b". if escaping is enabled (ap=2), the frame should look like: frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x16 frame-specific data frame type 30x10 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent ack (acknowledgement). if set to 0, no response is sent. 64-bit destination address msb 5 0x00 set to the 64-bit address of the destination device. the following addresses are also supported: 0x0000000000000000 - reserved 64-bit address for the coordinator 0x000000000000ffff - broadcast address 60x13 70xa2 80x00 90x40 10 0x0a 11 0x01 lsb 12 0x27 16-bit destination network address msb 13 0xff set to the 16-bit address of the destination device, if known. set to 0xfffe if the address is unknown, or if sending a broadcast. lsb 14 0xfe broadcast radius 15 0x00 sets maximum number of hops a broadcast transmission can occur. if set to 0, the broadcast radius will be set to the maximum hops value. options 16 0x00 bitfield of supported transm ission options. supported values include the following: 0x01 - disable ack 0x20 - enable aps encryption (if ee=1) 0x40 - use the extended transmission timeout for this destination enabling aps encryption decreases the maximum number of rf payload bytes by 4 (below the value reported by np). setting the extended timeout bit causes the stack to set the extended transmission timeout for the destination address. (see chapter 4.) all unused and unsupported bits must be set to 0. rf data 17 0x54 data that is sent to the destination device 18 0x78 19 0x44 20 0x61 21 0x74 22 0x61 23 0x30 24 0x41 checksum 25 0x13 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 103 0x7e 0x00 0x16 0x10 0x01 0x00 0x7d 0x33 0xa2 0x00 0x40 0x0a 0x01 0x27 0xff 0xfe 0x00 0x00 0x54 0x78 0x44 0x61 0x74 0x61 0x30 0x41 0x7d 0x33 the checksum is calculated (on all non-escaped bytes) as [0xff - (sum of all bytes from api frame type through data payload)]. example : send a transmission to the coordinator without specifying the coordinator's 64-bit address. the api transmit request frame should look like: 0x7e 0x00 0x16 0x10 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xfe 0x00 0x00 0x54 0x78 032 0x43 0x6f 0x6f 0x72 0x64 0xfc where 0x16 = length (22 bytes excluding checksum) 0x10 = zigbee tr ansmit request api frame type 0x01 = frame id (set to non-zero value) 0x0000000000000000 = coordinator's address (can be replaced with coordinator's actual 64-bit address if known 0xfffe = 16-bit destination address 0x00 = broadcast radius 0x00 = options 0x547832436f6f7264 = data payload ("tx2coord") 0xfc = checksum explicit addressing zigbee command frame frame type: 0x11 allows zigbee application layer fiel ds (endpoint and cluster id) to be specified for a data transmission. similar to the zigbee transmit reques t, but also requires zigbee applicat ion layer addressing fields to be specified (endpoints, cluster id, profil e id). an explicit addressing request api fr ame causes the module to send data as an rf packet to the specified destination, using the specif ied source and destination endpoints, cluster id, and profile id. the 64-bit destination address should be set to 0x000000000000ffff for a broadcast transmission (to all devices). the coordinator can be addr essed by either setting the 64-bit address to all 0x00s and the 16-bit address to 0xfffe, or by setting the 64-bit address to the coordinator's 64-bit address and the 16-bit address to 0x0000. for all other transmissions, setting the 16-bit address to the correct 16-bit address can help improve performance when transmit ting to multiple destinations. if a 16-bit address is not known, this field should be set to 0xfffe (unknown). the transmit status frame (0x8b) will indicate the discovered 16-bit address, if successful. the broadcast radius can be set from 0 up to nh. if set to 0, the value of nh specifies the broadcast radius (recommended). this parameter is on ly used for broadcast transmissions. the maximum number of payload bytes can be read with the np command. note: if source routing is used, the rf payload will be reduced by two bytes per intermediate hop in the source route.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 104 example: send a data transmission to the coordinator (6 4-bit address of 0x00s) using a source endpoint of 0xa0, destination endpoint 0xa1, cluster id =0x1554, and profile id 0xc105. payload will be "txdata". frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x1a frame-specific data frame type 30x11 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent ack (acknowledgement). if set to 0, no response is sent. 64-bit destination address msb 5 0x00 set to the 64-bit address of the destination device. the following addresses are also supported: 0x0000000000000000 - reserved 64-bit address for the coordinator 0x000000000000ffff - broadcast address 60x00 70x00 80x00 90x00 10 0x00 11 0x00 12 0x00 16-bit destination network address msb 13 0xff set to the 16-bit address of the destination device, if known. set to 0xfffe if the address is unknown, or if sending a broadcast. lsb 14 0xfe source endpoint 15 0xa0 source endpoint for the transmission. destination endpoint 16 0xa1 destination endpoint for the transmission. cluster id 17 0x15 cluster id used in the transmission 18 0x54 profile id 19 0xc1 profile id used in the transmission 20 0x05 broadcast radius 21 0x00 sets the maximum number of hops a broadcast transmission can traverse. if set to 0, the transmission radius will be set to the network maximum hops value. transmit options 22 0x00 bitfield of supported transm ission options. supported values include the following: 0x01 - disable ack 0x20 - enable aps encryption (if ee=1) 0x40 - use the extended transmission timeout for this destination enabling aps encryption decreases the maximum number of rf payload bytes by 4 (below the value reported by np). setting the extended timeout bit causes the stack to set the extended transmission timeout for the destination address. (see chapter 4.) all unused and unsupported bits must be set to 0. data payload 23 0x54 data that is sent to the destination device 24 0x78 25 0x44 26 0x61 27 0x74 28 0x61 checksum 29 0x3a 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 105 remote at co mmand request frame type: 0x17 used to query or set module parameters on a remote device. for para meter changes on the remote device to take effect, changes must be applied, either by setting the apply changes options bit, or by sending an ac command to the remote. example: send a remote command to change the broadcast hops re gister on a remote device to 1 (broad- casts go to 1-hop neighbors only), and apply change s so the new configuration value immediately takes effect. in this example, the 64-bit address of th e remote is 0x0013a200 40401122, and the destination 16- bit address is unknown. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x10 frame-specific data frame type 30x17 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent ack (acknowledgement). if set to 0, no response is sent. 64-bit destination address msb 5 0x00 set to the 64-bit address of the destination device. the following addresses are also supported: 0x0000000000000000 - reserved 64-bit address for the coordinator 0x000000000000ffff - broadcast address 60x13 70xa2 80x00 90x40 10 0x40 11 0x11 lsb 12 0x22 16-bit destination network address msb 13 0xff set to the 16-bit address of the destination device, if known. set to 0xfffe if the address is unknown, or if sending a broadcast. lsb 14 0xfe remote command options 15 0x02 (apply changes) bitfield to enable various remote command options. supported values include: 0x01 - disable ack 0x02 - apply changes on remote. (if not set, ac command must be sent before changes will take effect.) 0x40 - use the extended transmission timeout for this destination. setting the extended timeout bit causes the stack to set the extended transmission ti meout for the destination address (see chapter 4). all unused and unsupported bits must be set to 0. at command 16 0x42 (b) name of the command 17 0x48 (h) command parameter 18 0x01 if present, indicates the requested parameter value to set the given register. if no characters present, the register is queried. checksum 19 0xf5 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 106 create source route frame type: 0x21 this frame creates a source route in the module. a source route specifies the complete route a packet should traverse to get from source to destin ation. source routing should be used with many-to-one routing for best results. note: both the 64-bit and 16-bit destin ation addresses are required when creating a source route. these are obtained when a route record indi cator (0xa1) frame is received. example: intermediate hop addresses must be ordered starting with the ne ighbor of the destination, and working closer to the source. for example, suppose a route is foun d between a and e as shown below. a ' b ' c ' d ' e if device e has the 64-bit and 16-bit addresses of 0x0013a200 40401122 and 0x3344, and if devices b, c, and d have the following 16-bit addresses: b = 0xaabb c = 0xccdd d = 0xeeff the example above shows how to send the create source route frame to establish a source route between a and e. frame fields offset example description start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x14 frame-specific data frame type 30x21 frame id 4 0x00 the frame id should always be set to 0. 64-bit destination address msb 5 0x00 set to the 64-bit address of the destination device. the following addresses are also supported: 0x0000000000000000 - reserved 64-bit address for the coordinator 0x000000000000ffff - broadcast address 60x13 70xa2 80x00 90x40 10 0x40 11 0x11 lsb 12 0x22 16-bit destination network address msb 13 0x33 set to the 16-bit address of the destination device, if known. set to 0xfffe if the address is unknown, or if sending a broadcast. lsb 14 0x44 route command options 15 0x00 set to 0. number of addresses 16 0x03 the number of addresses in the source route (excluding source and destination). if this number is 0 or greater than the source route table si ze (40), this api frame will be silently discarded. however, there is no use in including more than 11 intermediate hops because a frame with more hops than that will be discarded. address 1 17 0xee (neighbor of destination) 18 0xff address 2 (closer hop 19 0xcc address of intermediate hop 20 0xdd address 3 21 0xaa (neighbor of source) 22 0xbb checksum 23 0x01 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 107 at command response frame type: 0x88 ? in response to an at command mess age, the module will send an at command response message. some commands will send back multiple frames (f or example, the nd (node discover) command). example: suppose the bd parameter is changed on the local device with a frame id of 0x01. if successful (parameter was valid), the above response would be received. modem status frame type: (0x8a) ? rf module status messages ar e sent from the module in resp onse to specific conditions. example: the following api frame is returned wh en an api coordinator forms a network. note : new modem status codes may be a dded in future fi rmware releases. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x05 frame type 30x88 frame id 40x01 identifies the serial port data frame being reported. note: if frame id = 0 in at command mode, no at command response will be given. at command 5 ?b? = 0x42 command name - two ascii characters that identify the at command. 6 ?d? = 0x44 command status 70x00 0 = ok 1 = error 2 = invalid command 3 = invalid parameter 4 = tx failure command data register data in binary format. if the register was set, then this field is not returned, as in this example. checksum 8 0xf0 0xff - the 8 bit sum of bytes from offset 3 to this byte. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x02 frame-specific data frame type 30x8a status 40x06 0 = hardware reset 1 = watchdog timer reset 2 =joined network (routers and end devices) 3 =disassociated 6 =coordinator started 7 = network security key was updated 0x0d = voltage supply limit exceeded (pro only) 0x11 = modem configuration changed while join in progress 0x80+ = ember zigbee stack error checksum 5 0x6f 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 108 zigbee transmit status frame type: 0x8b ? when a tx request is completed, the module sends a tx status message. this message will indicate if the packet was transmitted successfully or if there was a failure. example: suppose a unicast data transmission was sent to a destination device with a 16-bit address of 0x7d84. (the transmission could have been sent with the 16-bit address set to 0x7d84 or 0xfffe.) frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x07 frame type 30x8b frame id 40x01 identifies the serial port data frame being reported. note: if frame id = 0 in at command mode, no at command response will be given. 16-bit address of destination 5 0x7d 16-bit network address the packet was delivered to (if success). if not success, this address matches the destination network address that was provided in the transmit request frame. 60x84 transmit retry count 70x00 the number of application transmission retries that took place. delivery status 80x00 0x00 = success 0x01 = mac ack failure 0x02 = cca failure 0x15 = invalid destination endpoint 0x21 = network ack failure 0x22 = not joined to network 0x23 = self-addressed 0x24 = address not found 0x25 = route not found 0x26 = broadcast source failed to hear a neighbor relay the message 0x2b = invalid binding table index 0x2c = resource error lack of free buffers, timers, etc. 0x2d = attempted broadcast with aps transmission 0x2e = attempted unicast with aps transmission, but ee=0 0x32 = resource error lack of free buffers, timers, etc. 0x74 = data payload too large 0x75 = indirect message unrequested discovery status 90x01 0x00 = no discovery overhead 0x01 = address discovery 0x02 = route discovery 0x03 = address and route 0x40 = extended timeout discovery checksum 10 0x71 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 109 zigbee receive packet frame type: (0x90) when the module receives an rf packet, it is se nt out the serial port using this message type. example: suppose a device with a 64-bit address of 0x0013a200 40522baa, and 16-bit address 0x7d84 sends a unicast data transmission to a remote device with payload "rxdata". if ao=0 on the receiving device, it would send the above ex ample frame out its serial port. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x11 frame type 30x90 64-bit source address msb 4 0x00 50x13 64-bit address of sender. set to 0xffffffffffffffff (unknown 64-bit address) if t he sender's 64-bit address is unknown. 60xa2 70x00 80x40 90x52 10 0x2b lsb 11 0xaa 16-bit source network address msb 12 0x7d 16-bit address of sender lsb 13 0x84 receive options 14 0x01 0x01 - packet acknowledged 0x02 - packet was a broadcast packet 0x20 - packet encryp ted with aps encryption 0x40 - packet was sent from an end device (if known) received data 15 0x52 received rf data 16 0x78 17 0x44 18 0x61 19 0x74 20 0x61 checksum 21 0x0d 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 110 zigbee explicit rx indicator frame type:0x91 when the modem receives a zigbee rf packet it is se nt out the serial port usin g this message type (when ao=1). example: suppose a device with a 64-bit address of 0x0013a200 40522baa, and 16-bit address 0x7d84 sends a broadcast data transmission to a remote device with payload "rxdata". suppose the transmission was sent with source and destination endpoints of 0xe0, cluster id=0x2211, and profile id=0xc105. if ao=1 on the receiving device , it would send the above frame out its serial port. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x18 frame-specific data frame type 30x91 64-bit source address msb 4 0x00 64-bit address of sender. set to 0xffffffffffffffff (unknown 64-bit address) if t he sender's 64-bit address is unknown. 50x13 60xa2 70x00 80x40 90x52 10 0x2b lsb 11 0xaa 16-bit source network address msb 12 0x7d 16-bit address of sender. lsb 13 0x84 source endpoint 14 0xe0 endpoint of the source that initiated the transmission destination endpoint 15 0xe0 endpoint of the destination the message is addressed to. cluster id 16 0x22 cluster id the packet was addressed to. 17 0x11 profile id 18 0xc1 profile id the packet was addressed to. 19 0x05 receive options 20 0x02 0x01 ? packet acknowledged 0x02 ? packet was a broadcast packet 0x20 - packet encryp ted with aps encryption 0x40 - packet was sent from an end device (if known) received data 21 0x52 received rf data 22 0x78 23 0x44 24 0x61 25 0x74 26 0x61 checksum 27 0x52 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 111 zigbee io data sample rx indicator frame type: 0x92 when the module receives an i/o samp le frame from a remote device, it se nds the sample out the serial port using this frame type (when ao=0). only modules running in api mode wi ll send i/o samples out the serial port. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x14 frame type 30x92 64-bit source address msb 4 0x00 64-bit address of sender 50x13 60xa2 70x00 80x40 90x52 10 0x2b lsb 11 0xaa 16-bit source network address msb 12 0x7d 16-bit address of sender. lsb 13 0x84 receive options 14 0x01 0x01 - packet acknowledged 0x02 - packet was a broadcast packet number of samples 15 0x01 number of sample sets included in the payload. (always set to 1) digital channel mask* 16 0x00 bitmask fiel d that indicates which digital io lines on the remote have sampling enabled (if any). 17 0x1c analog channel mask** 18 0x02 bitmask field t hat indicates which analog io lines on the remote have sampling enabled (if any). digital samples (if included) 19 0x00 if the sample set includes any digital io lines (digital channel mask > 0), these two bytes contain samples for all enabled digital io lines. dio lines that do not have sampling enabled return 0. bits in these 2 bytes map the same as they do in the digital channels mask field. 20 0x14 analog sample 21 0x02 if the sample set includes any analog input lines (analog channel mask > 0) , each enabled analog input returns a 2-byte value indicating the a/d measurement of that input. analog samples are ordered sequentially from ad0/dio0 to ad3/dio3, to the supply voltage. 22 0x25 checksum 23 0xf5 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 112 example: suppose an io sample is received with analog and digital io, from a remote with a 64-bit address of 0x0013a200 40522baa and a 16-bit address of 0x7d84. if pin ad1/dio1 is enabled as an analog input, ad2/dio2 and dio4 are enabled as a digital inputs (currently high), and ad3/dio3 is enabled as a digital output (low) the io sample is shown in the api example in the table above. xbee sensor read indicator frame type: 0x94 when the module receives a sensor samp le (from a digi 1-wire sensor adapte r), it is sent out the serial port using this message type (when ao=0). frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x17 frame type 30x94 64-bit source address msb 4 0x00 64-bit address of sender 50x13 60xa2 70x00 80x40 90x52 10 0x2b lsb 11 0xaa 16-bit source network address msb 12 0xdd 16-bit address of sender. lsb 13 0x6c receive options 14 0x01 0x01 - packet acknowledged 0x02 - packet was a broadcast packet 1-wire sensors 15 0x03 0x01 = a/d sensor read 0x02 = temperature sensor read 0x60 = water present (module cd pin low) a/d values 16 0x00 indicates a two-byte value fo r each of four a/d sensors (a, b, c, d) set to 0xffffffffffffffff if no a/ds are found. 17 0x02 18 0x00 19 0xce 20 0x00 21 0xea 22 0x00 23 0x52 temperature read 24 0x01 indicates the two-byte value read from a digital thermometer if present. set to 0xffff if not found. 25 0x6a checksum 26 0x8b 0xff - the 0x8 bit sum of bytes from offset 3 to this byte. n/a n/a n/a cd/dio 12 pwm/di o11 rssi/di o10 n/a n/a cts/di o7 rts/di o6 assoc/ dio5 dio4 ad3/di o3 ad2/di o2 ad1/di o1 ad0/di o0 supply voltage n/a n/a n/a ad3 ad2 ad1 ad0 * **
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 113 example: suppose a 1-wire sensor sample is received from a device with a 64-bit address of 0x0013a200 40522baa and a 16-bit address of 0xdd6c. if the sensor sample was taken from a 1-wire humidity sensor, the api frame could look like this (if ao=0): for convenience, let's label the a/d and temperature readin gs as ad0, ad1, ad2, ad3, and t. using the data in this example: ad0 = 0x0002 ad1 = 0x00ce ad2 = 0x00ea ad3 = 0x0052 t = 0x016a to convert these to temperature and humidity values, the following equations should be used. temperature (c) = (t / 16), for t < 2048 = - (t & 0x7ff) / 16, for t >= 2048 vsupply = (ad2 * 5.1) / 255 voutput = (ad3 * 5.1) / 255 relative humidity = ((voutput / vsupply) - 0.16) / (0.0062) true humidity = relative humidity / (1.0546 - (0.00216 * temperature (c))) looking at the sample data, we have: vsupply = (234 * 5.1 / 255) = 4.68 voutput = (82 * 5.1 / 255) = 1.64 temperature = (362 / 16) = 22.625c relative h = (161.2903 * ((1.64/4.68) - 0.16)) = 161.2903 * (0.19043) = 30.71% true h = (30.71 / (1.0546 - (0.00216 * 22.625))) = (30.71 / 1.00573) = 30.54%
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 114 node identification indicator frame type: 0x95 this frame is received when a module transmits a node identification mess age to identify itself (when ao=0). the data portion of this frame is similar to a ne twork discovery response frame (see nd command). example: if the commissioning push button is pressed on a remote ro uter device with 64-bit address 0x0013a200 40522baa, 16-bit address 0x7d84, and defaul t ni string, the following node identification indicator would be received. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x20 frame type 30x95 64-bit source address msb 4 0x00 64-bit address of sender 50x13 60xa2 70x00 80x40 90x52 10 0x2b lsb 11 0xaa 16-bit source network address msb 12 0x7d 16-bit address of sender. lsb 13 0x84 receive options 14 0x02 0x01 - packet acknowledged 0x02 - packet was a broadcast packet source 16-bit address 15 0x7d set to the 16-bit network address of the remote. set to 0xfffe if unknown. 16 0x84 64-bit network address 17 0x00 indicates the 64-bit address of the remote module that transmitted the node identification frame. 18 0x13 19 0xa2 20 0x00 21 0x40 22 0x52 23 0x2b 24 0xaa ni string 25 0x20 node identifier string on the remote device. the ni-string is terminated with a null byte (0x00). 26 0x00 parent 16-bit address 27 0xff indicates the 16-bit address of the remote's parent or 0xfffe if the remote has no parent. 28 0xfe device type 29 0x01 0 = coordinator 1 = router 2 = end device source event 30 0x01 1 = frame sent by node identification pushbutton event (see d0 command) 2 = frame sent after joining event occurred (see jn command). 3 = frame sent after power cycle event occurred (see jn command). digi profile id 31 0xc1 set to digi's application profile id. 32 0x05 manufacturer id 33 0x10 set to digi's manufacturer id. 34 0x1e checksum 35 0x1b 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 115 remote command response frame type: 0x97 if a module receives a remote co mmand response rf data frame in response to a remote at command request, the module will send a remote at command response message out the serial port. some commands may send back multiple frames--for ex ample, node discover (nd) command. example: if a remote command is sent to a remote de vice with 64-bit address 0x0013a200 40522baa and 16-bit address 0x7d84 to query the sl command, and if the frame id=0x55, the response is shown in the example api frame in the table above. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x13 frame-specific data frame type 30x97 frame id 40x55 this is the same value passed in to the request. . 64-bit source (remote) address msb 5 0x00 the address of the remote radio returning this response. 60x13 70xa2 80x00 90x40 10 0x52 11 0x2b lsb 12 0xaa 16-bit source (remote) address msb 13 0x7d set to the 16-bit network address of the remote. set to 0xfffe if unknown. lsb 14 0x84 at commands 15 0x53 name of the command 16 0x4c command status 17 0x00 0 = ok 1 = error 2 = invalid command 3 = invalid parameter 4 = remote command transmission failed command data 18 0x40 register data in binary format. if the register was set, then this field is not returned. 19 0x52 20 0x2b 21 0xaa checksum 22 0xf0 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 116 over-the-air firmware update status frame type: 0xa0 the over-the-air firmware update stat us frame provides a status indication of a firmware update transmission attempt. if a query command (0x01 0x51) is sent to a target with a 64-bit address of 0x0013a200 40522baa through an updater with 64-bit address 0x0013a200403e07 50 and 16-bit address 0x0000, the following is the expected response. if a query request returns a 0x15 (nack) status, the target is likely waiting for a firmware update image. if no messages are se nt to it for about 75 seconds, the target will timeout and accept new query messages. if a query returns a 0x51 (query) stat us, then the target's bootloader is not active and will not respond to query messages. a p i p a c k e t frame fields offset example description start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x16 frame-specific data frame type 30xa0 64-bit source (remote) address msb 4 0x00 the address of the remote radio returning this response. 50x13 60xa2 70x00 80x40 90x3e 10 0x07 lsb 11 0x50 16-bit destination address 12 0x00 16-bit address of the updater device 13 0x00 receive options 14 0x01 0x01 - packet acknowledged. 0x02 - packet was a broadcast. bootloader message type 15 0x52 0x06 - ack 0x15 - nack 0x40 - no mac ack 0x51 - query (received if the bootloader is not active on the target) 0x52 - query response block number 16 0x00 block number used in the update request. set to 0 if not applicable. 64-bit target address 17 0x00 64-bit address of remote device that is being updated (target). 18 0x13 19 0xa2 20 0x00 21 0x40 22 0x52 23 0x2b 24 0xaa checksum 25 0x66 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 117 route record indicator frame type: 0xa1 the route record indicator is received whenever a device sends a zigb ee route record command. this is used with many-to-one routing to create sour ce routes for devices in a network. example: suppose device e sends a route record that traver ses multiple hops en ro ute to data collector device a as shown below. a b c d e if device e has the 64-bit and 16-bit addresses of 0x0013a200 40401122 and 0x3344, and if devices b, c, and d have the following 16-bit addresses: b = 0xaabb c = 0xccdd d = 0xeeff the data collector will send the ab ove api frame out its serial port. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x13 frame-specific data frame type 30xa1 64-bit source address msb 4 0x00 64-bit address of the device that initiated the route record. 50x13 60xa2 70x00 80x40 90x40 10 0x11 lsb 11 0x22 source (updater) 16-bit address 12 0x33 16-bit address of the device that initiated the route record. 13 0x44 receive options 14 0x01 0x01 - packet acknowledged. 0x02 - packet was a broadcast. number of addresses 15 0x03 the number of addresses in the source route (excluding source and destination). address 1 16 0xee (neighbor of destination) 17 0xff address 2 (closer hop 18 0xcc address of intermediate hop 19 0xdd address n (neighbor of source) 20 0xaa two bytes per 16-bit address. 21 0xbb checksum 22 0x80 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 118 many-to-one route request indicator frame type: 0xa3 the many-to-one route request indica tor frame is sent out the serial port whenever a many-to-one route request is received example : suppose a device with a 64-bit address of 0x0013a200 40401122 and 16-bit address of 0x0000 sends a many-to-one route request. al l remote routers operating in api mode that receive the many-to-one broadcast would send the above example api frame out their serial port. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum lsb 2 0x0c frame-specific data frame type 30xa3 64-bit source address msb 4 0x00 64-bit address of the device that sent the many-to-one route request 50x13 60xa2 70x00 80x40 90x40 10 0x11 lsb 11 0x22 source 16-bit address msb 12 0x00 16-bit address of the device th at initiated the many-to-one route request. lsb 13 0x00 reserved 14 0x00 set to 0. checksum 15 0xf4 0xff - the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 119 sending zigbee device objects (zdo) commands with the api zigbee device objects (zdos) are defined in the zigbee specification as part of the zigbee device profile. these objects provide functionality to manage and map out th e zigbee network and to di scover services on zigbee devices. zdos are typically required when developing a zigbee product that will interoperate in a public profile such as home automation or smart energy, or when commun icating with zigbee devices from other vendors. the zdo can also be used to perform several management functions such as frequency agility (e nergy detect and channel changes - mgmt network update reques t), discovering ro utes (mgmt routin g request) and neighbors (mgmt lqi request), and managing devi ce connectivity (mgmt leave and permit join request). the following table shows some of the more prominent zd os with their respective cl uster identifier. each zdo command has a defined payload. see the "zigbee device profile" section of the zigbee specification for details. the explicit transmit api frame (0x11) is used to send zigbee device objects commands to devices in the network. sending zdo commands with the explicit transmit api frame requires some fo rmatting of the data payload field. when sending a zdo command with the api, all multiple byte values in the zdo command (api payload) (e.g. u16, u32, 64-bit addresses) must be sent in little endian byte order for the co mmand to be executed correctly on a remote device. for an api xbee to receive zdo response s, the ao command must be set to 1 to enable the explicit receive api frame. the following table shows how the explicit api frame can be used to send an "active en dpoints" request to discover the active endpoints on a device with a 16-bit address of 0x1234. zdo command cluster id network address request 0x0000 ieee address request 0x0001 node descriptor request 0x0002 simple descriptor request 0x0004 active endpoints request 0x0005 match descriptor request 0x0006 mgmt lqi request 0x0031 mgmt routing request 0x0032 mgmt leave request 0x0034 mgmt permit joining request 0x0036 mgmt network update request 0x0038
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 120 frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x17 frame type 30x11 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent transmit status. if set to 0, no transmit status frame will be sent out the serial port. 64-bit destination address msb 5 0x00 64-bit address of the destination device (big endian byte order). for unicast transmi ssions, set to the 64-bit address of the destination device, or to 0x0000000000000000 to send a unicast to the coordinator. set to 0x000000000000ffff for broadcast. 60x00 70x00 80x00 90x00 10 0x00 11 0xff 12 0xff 16-bit destination network address msb 13 0xff 16-bit address of the destination device (big endian byte order). set to 0xfffe for broadcast, or if the 16-bit address is unknown. lsb 14 0xfe source endpoint 15 0x00 set to 0x00 for zdo transmissions (endpoint 0 is the zdo endpoint). destination endpoint 16 0x00 set to 0x00 for zdo transmissions (endpoint 0 is the zdo endpoint). cluster id msb 17 0x00 set to the cluster id that corresponds to the zdo command being sent. 0x0005 = active endpoints request lsb 18 0x05 profile id msb 19 0x00 set to 0x0000 for zdo transmissions (profile id 0x0000 is the zigbee device profile that supports zdos). lsb 20 0x00 broadcast radius 21 0x00 sets the maximum number of hops a broadcast transmission can traverse. if set to 0, the transmission radius will be set to the network maximum hops value. transmit options 22 0x00 all bits must be set to 0. data payload transaction sequence number 23 0x01 the required payload for a zd o command. all multi-byte zdo parameter values (u16, u32, 64-bit address) must be sent in little endian byte order. the active endpoints request includes the following payload: [16-bit nwkaddrofinterest] note the 16-bit address in the api example (0x1234) is sent in little endian byte order (0x3412). zdo payload 24 0x34 25 0x12 checksum 26 0xa6 0xff minus the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 121 sending zigbee cluster library (zcl) commands with the api the zigbee cluster library defi nes a set of attributes and commands (clusters) that can be supported in multiple zigbee profiles. the zcl commands are ty pically required when developing a zigb ee product that will interoperate in a public profile such as home automa tion or smart energy, or when commun icating with zigbee devices from other vendors. applications that are not desi gned for a public profile or for intero perability applicatio ns can skip this section. the following table shows some prominent clusters with their respective attributes and commands. the zcl defines a number of profile-wide commands that can be supported on any profile, also known as general commands. these commands include the following. the explicit transmit api frame (0x11) is used to send zcl commands to devices in the network. sending zcl commands with the explicit transm it api frame requires some formatting of the data payload field. when sending a zcl command with the ap i, all multiple byte values in the zcl command (api payload) (e.g. u16, u32, 64-bit addresses) must be sent in little endian byte order for the co mmand to be executed correctly on a remote device. note : when sending zcl commands, the ao command should be set to 1 to enable the explicit receive api frame. this will provide indication of the source 64- and 16-bit addresses, cluster id, profil e id, and endpoint information for each received packet. this information is required to pr operly decode received data. cluster (cluster id) attributes (attribute id) cluster id basic (0x0000) application version (0x0001) hardware version (0x0003) model identifier (0x0005) -reset to defaults (0x00) identify (0x0003) identify time (0x0000) identify (0x00) identify query (0x01) time (0x000a) time (0x0000) time status (0x0001) time zone (0x0002) thermostat (0x0201) local temperature (0x0000) occupancy (0x0002) -setpoint raise / lower (0x00) command (command id) description read attributes (0x00) used to read one or more attributes on a remote device. read attributes response (0x01) generated in response to a read attributes command. write attributes (0x02) used to change one or more attributes on a remote device. write attributes response (0x04) sent in response to a write attributes command. configure reporting (0x06) used to configure a device to automatically report on the values of one or more of its attributes. report attributes (0x0a) used to report attributes when report conditions have been satisfied. discover attributes (0x0c) used to discover the attribute identifiers on a remote device. discover attributes response (0x0d) sent in response to a discover attributes command.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 122 the following table shows how the explicit api frame can be used to read the hardwa re version attribute from a device with a 64-bit address of 0x0013a200 40401234 (unknown 16-bit address). this example uses arbitrary source and destination endpoints. recall the hardware version attribute (attribute id 0x0003) is part of the basic cluster (cluster id 0x0000). the read attribute general command id is 0x00. frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x19 frame type 30x11 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent transmit status. if set to 0, no transmit status frame will be sent out the serial port. 64-bit destination address msb 5 0x00 64-bit address of the destination device (big endian byte order). for unicast transmi ssions, set to the 64-bit address of the destination device, or to 0x0000000000000000 to send a unicast to the coordinator. set to 0x000000000000ffff for broadcast. 60x13 70xa2 80x00 90x40 10 0x40 11 0x12 12 0x34 16-bit destination network address msb 13 0xff 16-bit address of the destination device (big endian byte order). set to 0xfffe for broadcast, or if the 16-bit address is unknown. lsb 14 0xfe source endpoint 15 0x41 set to the source endpoint on the sending device. (0x41 arbitrarily selected). destination endpoint 16 0x42 set to the destination endpoint on the remote device. (0x42 arbitrar ily selected) cluster id msb 17 0x00 set to the cluster id that corresponds to the zcl command being sent. 0x0000 = basic cluster lsb 18 0x00 profile id msb 19 0xd1 set to the profile id supported on the device. (0xd123 arbitrarily selected). lsb 20 0x23 broadcast radius 21 0x00 sets the maximum number of hops a broadcast transmission can traverse. if set to 0, the transmission radius will be set to the network maximum hops value. transmit options 22 0x00 all bits must be set to 0. data payload zcl frame header frame control 23 0x00 bitfield that defines the command type and other relevant information in the zcl command. see the zcl specification for details. transaction sequence number 24 0x01 a sequence number used to correlate a zcl command with a zcl response. (the hardware version response will include this byte as a sequence number in the response.) the value 0x01 was arbitrarily selected. command id 25 0x00 since the frame control "frame type" bits are 00, this byte specifies a general command. command id 0x00 is a read attributes command. zcl payload attribute id 26 0x03 the payload for a "read attributes" command is a list of attribute identifiers that are being read. note the 16-bit attribute id (0x0003) is sent in little endian byte order (0x0300). all multi-byte zcl header and payload values must be sent in little endian byte order. 27 0x00 checksum 28 0xfa 0xff minus the 8 bit sum of bytes from offset 3 to this byte.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 123 in the above example, the frame control fi eld (offset 23) was constructed as follows: see the zigbee cluster librar y specification for details. sending public profile commands with the api commands in public profiles such as smart energy and home automation can be sent with the xbee api using the explicit transmit api frame (0x11). send ing public profile commands with the explicit transmit api frame requires some formatting of the data payload field. most of the public profile commands fit into the zigbee cluster library (zcl) architecture as described in the previous section. the following table shows how the explicit api frame can be used to send a demand response and load control message (cluster id 0x701) in the smart energy profil e (profile id 0x0109) in th e revision 14 smart energy specification. the message will be a "load control event" (c ommand id 0x00) and will be sent to a device with 64- bit address of 0x0013a200 40401234 with a 16-bit address of 0x5678. the event will start a load control event for water heaters and smart appliances, for a du ration of 1 minute, starting immediately. note : when sending public profile commands, the ao command should be set to 1 to enable the explicit receive api frame. this will provide indication of the source 64- and 16-bit addresses, cluste r id, profile id, and endpoint information for each received packet . this information is required to properly decode received data. name bits example value description frame type 0-1 00 - command acts across the entire profile manufacturer specific 2 0 - the manufacturer code field is omitted from the zcl frame header. direction 3 0 - the command is being sent from the client side to the server side. disable default response 4 0 - default response not disabled reserved 5-7 set to 0.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 124 frame fields offset example description a p i p a c k e t start delimiter 00x7e length msb 1 0x00 number of bytes between the length and the checksum frame-specific data lsb 2 0x19 frame type 30x11 frame id 40x01 identifies the serial port data frame for the host to correlate with a subsequent transmit status. if set to 0, no transmit status frame will be sent out the serial port. 64-bit destination address msb 5 0x00 64-bit address of the destination device (big endian byte order). for unicast transmi ssions, set to the 64-bit address of the destination device, or to 0x0000000000000000 to send a unicast to the coordinator. set to 0x000000000000ffff for broadcast. 60x13 70xa2 80x00 90x40 10 0x40 11 0x12 12 0x34 16-bit destination network address msb 13 0x56 16-bit address of the destination device (big endian byte order). set to 0xfffe for broadcast, or if the 16-bit address is unknown. lsb 14 0x78 source endpoint 15 0x41 set to the source endpoint on the sending device. (0x41 arbitrarily selected). destination endpoint 16 0x42 set to the destination endpoint on the remote device. (0x42 arbitrar ily selected) cluster id msb 17 0x07 set to the cluster id that corresponds to the zcl command being sent. 0x0701 = demand response and load control cluster id lsb 18 0x01 profile id msb 19 0x01 set to the profile id supported on the device. 0x0109 = smart energy profile id. lsb 20 0x09 broadcast radius 21 0x00 sets the maximum number of hops a broadcast transmission can traverse. if set to 0, the transmission radius will be set to the network maximum hops value. transmit options 22 0x00 all bits must be set to 0. data payload zcl frame header frame control 23 0x09 bitfield that defines the command type and other relevant information in the zcl command. see the zcl specification for details. transaction sequence number 24 0x01 a sequence number used to correlate a zcl command with a zcl response. (the hardware version response will include this byte as a sequence number in the response.) the value 0x01 was arbitrarily selected. 25 0x00 since the frame control "frame type" bits are 01, this byte specifies a cluster-specific command. command id 0x00 in the demand response and load control cluster is a load control event command. (see smart energy specification.)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 125 in the above example, the frame control fi eld (offset 23) was constructed as follows: zcl payload - load control event data issuer event id 26 0x78 4-byte unique identifier. note the 4-byte id is sent in little endian byte order (0x78563412). the event id in this example (0x12345678) was arbitrarily selected. 27 0x56 28 0x34 29 0x12 device class 30 0x14 to apply the load control event. a bit value of 0x0014 enables smart appliances and water heaters. note the 2-byte bit field value is sent in little endian byte order. 31 0x00 utility enrollment group 32 0x00 used to identify sub-groups of devices in the device- class. 0x00 addresses all groups. start time 33 0x00 utc timestamp representing when the event should start. a value of 0x00000000 indicates "now". 34 0x00 35 0x00 36 0x00 duration in minutes 37 0x01 this 2-byte value must be sent in little endian byte order. 38 0x00 criticality level 39 0x04 indicates the criticality level of the event. in this example, the level is "voluntary". cooling temperature 40 0xff requested offset to apply to the normal cooling set point. a value of 0xff indicates the temperature offset value is not used. heating temperature offset 41 0xff requested offset to apply to the normal heating set point. a value of 0xff indicates the temperature offset value is not used. cooling temperature set point 42 0x00 requested cooling set point in 0.01 degrees celsius. a value of 0x8000 means the set point field is not used in this event. note the 0x80000 is sent in little endian byte order. 43 0x80 heating temperature set point 44 0x00 requested heating set point in 0.01 degrees celsius. a value of 0x8000 means the set point field is not used in this event. note the 0x80000 is sent in little endian byte order. 45 0x80 average load adjustment percentage 46 0x80 maximum energy usage limit. a value of 0x80 indicates the field is not used. duty cycle 47 0xff defines the maximum "on" duty cycle. a value of 0xff indicates the duty cycle is not used in this event. duty cycle event control 48 0x00 a bitmap describing event options. checksum 49 0x5b 0xff minus the 8 bit sum of bytes from offset 3 to this byte. name bits example value description frame type 0-1 01 - command is specific to a cluster manufacturer specific 2 0 - the manufacturer code field is omitted from the zcl frame header. direction 3 1 - the command is being sent fr om the server side to the client side. disable default response 4 0 - default response not disabled reserved 5-7 set to 0. frame fields offset example description
? ? 2010 ? digi ? international, ? inc. ????? 126 10. ?? xbee ? command ? reference ? tables addressing addressing ? commands at ? command name and description parameter range default dh destination address high .set/get the upper 32 bits of the 64-bit destination address. when combined with dl, it defines the 64-b it destination address for data transmission. special definitions for dh and dl include 0x000000000000ffff (broadcast) and 0x0000000000000000 (coordinator). 0 - 0xffffffff 0 dl destination address low . set/get the lower 32 bits of the 64-bit destination address. when combined with dh, it defines t he 64-bit destination address for data transmissions. special definitions for dh and dl include 0x000000000000ffff (broadcast) and 0x0000000000000000 (coordinator). 0 - 0xffffffff 0xffff(coordinator) 0 (router/end device) my 16-bit network address . read the 16-bit network address of the module. a value of 0xfffe means the module has not joined a zigbee network 0 - 0xfffe ? [read-only] 0xfffe mp 1 6-bit parent network address . read the 16-bit network address of the module's parent. a value of 0xfffe means the module does not have a parent. 0 - 0xfffe ? [read-only] 0xfffe nc number of remaining children . read the number of end device children that can join the device. if nc returns 0, then the device cannot allow any more end device children to join. 0 - max_children (maximum varies) read-only sh serial number high . read the high 32 bits of the module's unique 64-bit address. 0 - 0xffffffff ? [read-only] factory-set sl serial number low . read the low 32 bits of the module's unique 64-bit address. 0 - 0xffffffff ? [read-only] factory-set ni node identifier. stores a string identifier. the r egister only accepts printable ascii data. in at command mode, a string can not start with a space. a carriage return ends the command. command will automatically end when maximum bytes for the string have been entered. this string is returned as part of the nd (node discover) command. this identifier is also used with the dn (destination node) command. in at command mode, an ascii comma (0x2c) cannot be used in the ni string 20-byte printable ? ascii string ascii space character (0x20) se source endpoint . set/read the zigbee application layer source endpoint value. this value will be used as the source endpoint for all data transmissions. se is only used in transparent mode.the default value 0xe8 (d ata endpoint) is the digi data endpoint 0 - 0xff 0xe8 de destination endpoint . set/read zigbee application layer destination id value. this value will be used as the destina tion endpoint all data transmissions. de is only used in transparent mode.the default value (0 xe8) is the digi data endpoint. 0 - 0xff 0xe8 ci cluster identifier . set/read zigbee application layer clus ter id value. this value will be used as the cluster id for all data transmissions. ci is only used in transparent mode.the default value0x11 (transparent data cluster id). 0 - 0xffff 0x11 np maximum rf payload bytes . this value returns the maximum number of rf payload bytes that can be sent in a unicast transmission. if aps encryption is used (api transmit option bit enabled), the maximum payload size is reduced by 9 bytes. if source routing is used (ar < 0xff), the maximum payload size is reduced further. note : np returns a hexadecimal value. (e.g. if np returns 0x54, this is equivalent to 84 bytes) 0 - 0xffff [read-only] dd device type identifier . stores a device type value. this value can be used to differentiate different xbee- based devices. digi reserves the range 0 - 0xffffff. for the xbee zb smt module, the device type is 0xa0000. 0 - 0xffffffff 0xa0000
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 127 networking networking ? commands at ? command name and description parameter range default ch operating channel . read the channel number used for transmitting and receiving between rf modules. uses 802.15.4 channel numbers. a value of 0 means the device has not joined a pan and is not operating on any channel. xbee 0, 0x0b - 0x1a xbee-pro 0, 0x0b - 0x19 (channels 11-25) [read-only] ce coordinator enabl e. set/read whether module is a coordinator. 0 - not a coordinator 1 - coordinator (sm must be 0 in order to set ce to 1.) 0 id extended pan id . set/read the 64-bit ext ended pan id. if set to 0, the coordinator will select a random extended pan id, and the router / end device will join any extended pan id. changes to id should be written to non-volatile memory using the wr command to preserve the id setting if a power cycle occurs. 0 - 0xffffffffffffffff 0 op operating extended pan id . read the 64-bit extended pan id. the op value reflects the operating extended pan id that the module is running on. if id > 0, op will equal id. 0x01 - 0xffffffffffffffff [read-only] nh maximum unicast hops . set / read the maximum hops limit. this limit sets the maximum broadcast hops value (bh) and determines the unicast timeout. the timeout is computed as (50 * nh) + 100 ms. the default unicast timeout of 1.6 seconds (nh=0x1e) is enough time for data and the acknowledgment to traverse about 8 hops. 0 - 0xff 0x1e bh broadcast hops. set/read the maximum number of hops for each broadcast data transmission. setting this to 0 will use the maximum number of hops. 0 - 0x1e 0 oi operating 16-bit pan id . read the 16-bit pan id. the oi value reflects the actual 16- bit pan id the module is running on. 0 - 0xffff [read-only] nt node discovery timeout . set/read the node discovery timeout. when the network discovery (nd) command is issued, the nt value is included in the transmission to provide all remote devices with a response timeout. remote devices wait a random time, less than nt, before sending their response. 0x20 - 0xff [x 100 msec] 0x3c (60d) no network discovery options. set/read the options value for the network discovery command. the options bitfield value can change the behavior of the nd (network discovery) command and/or change what optio nal values are returned in any received nd responses or api node identification frames. options include: 0x01 = append dd value (to nd responses or api node identification frames) 002 = local device sends nd response frame when nd is issued. 0 - 0x03 [bitfield] 0 sc scan channels . set/read the list of channels to scan. coordinator - bit field list of channels to choos e from prior to starting network. router/end device - bit field list of channels that will be scanned to find a coordinator/ router to join. changes to sc should be written using wr command to preserve the sc setting if a power cycle occurs. bit (channel): 0 (0x0b) 4 (0x0f) 8 (0x13) 12 (0x17) ? 1 (0x0c) 5 (0x10) 9 (0x14) 13 (0x18) ? 2 (0x0d) 6 (0x11) 10 (0x15) 14 (0x19) ? 3 (0x0e) 7 (0x12) 11 (0x16) 15 (0x1a) xbee 1 - 0xffff [bitfield] xbee-pro 1-0x7fff (bit 15 is not allowed) 7fff sd scan duration . set/read the scan duration exponent. changes to sd should be written using wr command. ? coordinator - duration of the active and energy scans (on each channel) that are used to determine an acceptable channel and pan id for the coordinator to startup on. ? router / end device - duration of active scan (on each channel) used to locate an available coordinator / router to join during association. scan time is measured as:(# channels to scan) * (2 ^ sd) * 15.36ms - the number of channels to scan is determined by the sc parameter. the xbee can scan up to 16 channels (sc = 0xffff). sample scan duration times (13 channel scan): ? if sd = 0, time = 0.200 sec ? sd = 2, time = 0.799 sec ? sd = 4, time = 3.190 sec ? sd = 6, time = 12.780 sec note : sd influences the time the mac listens for beacons or runs an energy scan on a given channel. the sd time is not a good estima te of the router/end device joining time requirements. zigbee joining adds additi onal overhead including beacon processing on each channel, sending a join request, etc. that extend the actual joining time. 0 - 7 [exponent] 3 zs zigbee stack profile . set / read the zigbee stack profile value. this must be set the same on all devices that should join the same network. 0 - 2 0
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 128 nj node join time . set/read the time that a coordinator/router allows nodes to join. this value can be changed at run time with out requiring a coordi nator or router to restart. the time starts once the coordinator or router has started. the timer is reset on power-cycle or when nj changes. for an end device to enable rejoining, nj should be set less than 0xff on the device that will join. if nj < 0xff, the device assumes the network is not allowing joining and first tries to join a network using rejoining. if multiple re joining attempts fail, or if nj=0xff, the device will attempt to join using association. 0 - 0xff ? [x 1 sec] 0xff ? (always allows joining) jv channel verification . set/read the channel verification parameter. if jv=1, a router will verify the coordinator is on its operatin g channel when joining or coming up from a power cycle. if a coordinator is not detected, the router will leave its current channel and attempt to join a new pan. if jv=0, the router will continue operating on its current channel even if a coordinator is not detected. 0 - channel verification disabled 1 - channel verification enabled 0 nw network watchdog timeout . set/read the network watchdog timeout value. if nw is set > 0, the router will monitor communication from the coordinator (or data collector) and leave the network if it cannot communica te with the coordinator for 3 nw periods. the timer is reset each time data is received from or sent to a coordinator, or if a many- to-one broadcast is received. 0 - 0x64ff [x 1 minute] (up to over 17 days) 0 (disabled) jn join notification . set / read the join notification setting. if enabled, the module will transmit a broadcast node identification packet on power up and when joining. this action blinks the associate led rapidly on a ll devices that receive the transmission, and sends an api frame out the serial port of api devices. this feature should be disabled for large networks to prevent excessive broadcasts. 0 - 1 0 ar aggregate routing notification . set/read time between consecutive aggregate route broadcast messages. if used, ar should be set on only one device to enable many-to- one routing to the device. setting ar to 0 only sends one broadcast 0 - 0xff 0xff networking ? commands at ? command name and description parameter range default
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 129 security rf interfacing security ? commands at ? command name and description parameter range default ee encryption enable . set/read the encryption enable setting. 0 - encryption disabled 1 - encryption enabled 0 eo encryption options. configure options for encryption. unused option bits should be set to 0. options include: 0x01 - send the security key uns ecured over-the- air during joins 0x02 - use trust center (coordinator only 0 - 0xff nk network encryption key . set the 128-bit aes network encryption key. this command is write-only; nk cannot be read. if set to 0 (default), the module will select a random network key. 128-bit value 0 ky link key . set the 128-bit aes link key. this command is write only; ky cannot be read. setting ky to 0 will cause the coordinator to transmit the network key in the clear to joining devices, and will cause joining devices to acquire the network key in the clear when joining. 128-bit value 0 rf ? interfacing ? commands at ? command name and description parameter range default pl power level . select/read the power level at which the rf module transmits conducted power. for xbee-pro (s2b) power level 4 is calibrated and the other power levels are approximate. calibration occurs every 15 seconds based on radio characteristics determined at manufacturing time, the ambient temperature, and how far off the voltage is from the typical 3.3 v. if the input voltage is too high, the module will reset. for the regular xbee, when operating on channel 26, no pl/pm selection will allow greater than +3 dbm output. xbee (boost mode disabled) 0 = -5 dbm 1 = -1 dbm 2 = +1 dbm 3 = +3 dbm 4 = +5 dbm xbee-pro (boost mode enabled) 4 =+18 dbm 3 = +16 dbm (approx.) 2 = +14 dbm (approx.) 1 = +12 dbm (approx.) 0 = 0 dbm (approx.) 4 pm power mode (xbee only). set/read the power mode of the device. enabling boost mode will improve the receive sensitivity by 2db and increase the transmit power by 3db note:this command is disabled on the xbee-pro. it is forced on by the software to provide the extra sensitivity. boost mode imposes a slight increase in current draw. see section 1.2 for details. 0-1, ? 0= -boost mode disabled, 1= boost mode enabled. 1 db received signal strength . this command reports the received signal strength of the last received rf data packet or aps ack nowledgment. the db command only indicates the signal strength of the last hop. it does not provide an accurate quality measurement for a multihop link. db can be set to 0 to clear it. the db command value is measured in -dbm. for example if db returns 0x50, then the rssi of the last packet received was -80dbm. 0 - 0xff observed range for xbee-pro: 0x1a - 0x58 for xbee: 0x 1a - 0x5c pp peak power. read the dbm output when maximum power is selected (pl4). 0x0-0x12 [read only]
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 130 serial interfacing (i/o) serial ? interfacing ? commands at ? command name and description parameter range default ap api enable. enable api mode. this command is ignored when using spi. api mode 1 is always used. 0 = api-disabled (operate in ? transparent mode) ? 1 = api-enabled ? 2 = api-enabled ? (w/escaped control ? characters) 1 ao api options . configure options for api. current opti ons select the type of receive api frame to send out the uart for received rf data packets. 0 - default receive api indicators enabled 1 - explicit rx data indicator api frame enabled (0x91) 3 - enable zdo passthrough of zdo requests to the serial port which are not supported by the stack, as well as simple_desc_req, active_ep_req, and match_desc_req. 0 bd interface data rate . set/read the serial interface data rate for communication between the module serial port and host. any value above 0x07 will be interpreted as an actual baud rate. when a value above 0x07 is sent, the closest interface data rate r epresented by the number is stored in the bd register. 0 - 7 (standard baud rates) 0 = 1200 bps 1 = 2400 2 = 4800 3 = 9600 4 = 19200 5 = 38400 6 = 57600 7 = 115200 0x80 - 0xe1000 (non-standard rates up to 921kbps) 3 nb serial parity . set/read the serial parity setting on the uart. 0 = no parity 1 = even parity 2 = odd parity 3 = mark parity 0 sb stop bits . set/read the number of stop bits for the uart. (two stop bits are not supported if mark parity is enabled.) 0 = 1 stop bit 1 = 2 stop bits 0 ro packetization timeout . set/read number of character times of inter-character silence required before packetization. set (ro=0) to transmit characters as they arrive instead of buffering them into one rf packet the ro command is only supported when operating in transparent mode. 0 - 0xff ? [x character times] 3 d7 dio7 configuration . select/read options for the dio7 line of the rf module. 0 = unmonitored digital input 1 = cts flow control 3 = digital input 4 = digital output, low 5 = digital output, high 6 = rs-485 transmit enable (low enable) 7 = rs-485 transmit enable (high enable) 1 d6 dio6 configuration. configure options for the dio6 line of the rf module. 0 = unmonitored digital input 1 = rts flow control 3 = digital input 4 = digital output, low 5 = digital output, high 0
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 131 i/o commands i/o ? commands at ? command name and description parameter range default ir i/o sample rate . set/read the i/o sample rate to enable periodic sampling. for periodic sampling to be enabled, ir must be set to a non-zero value, and at least one module pin must have analog or digital i/ o functionality enabled (see d0-d9, p0-p4 commands). the sample rate is measured in milliseconds. 0, 0x32:0xffff (ms) 0 ic i/o digital change detection . set/read the digital i/o pins to monitor for changes in the i/o state. ic works with the individual pin configuration commands (d0-d9, p0-p4). if a pin is enabled as a digital input/output, the ic command can be used to force an immediate i/o sample transmission when the dio state changes. ic is a bitmask that can be used to enable or disable edge detec tion on individual channels. unused bits should be set to 0. bit (io pin): 0 (dio0)4 (dio4)8 (dio8) 1 (dio1) 5 (dio5) 9 (dio9) 2 (dio2) 6 (dio6) 10 (dio10) 3 (dio3) 7 (dio7) 11 (dio11) : 0 - 0xffff 0 p0 pwm0 configuration . select/read function for pwm0. 0 = unmonitored digital input 1 = rssi pwm 3 - digital input, monitored 4 - digital output, default low 5 - digital output, default high 1 p1 pwm1 / dio11 configuration . configure options for the dio11 line of the rf module. 0 - unmonitored digital input 1 - output 50% duty cycle clock at 32.787 khz 3- digital input, monitored 4- digital output, default low 5- digital output, default high 0 p2 dio12 configuration . configure options for the dio12 line of the rf module. 0 - unmonitored digital input 3- digital input, monitored 4- digital output, default low 5- digital output, default high 0 p3 dio13 / dout configuration . set/read function for dio13. configure options for the dio13 line of the rf module. 0 ? unmonitored digital input 1 ? data out for uart 3 ? monitored digital input 4 ? digital output low 5 ? digital output high 1 p4 dio14 / din . set/read function for dio14. 0 ? unmonitored digital input 1 ? data in for uart 3 ? digital input 4 ? digital output low 5 ? digital output high 1 p5 dio15 / spi_miso . set/read function for dio15. 0 ? unmonitored digital input 1 ? output from spi port 1 p6 dio16 / spi_mosi . set/read function for dio16. 0 ? unmonitored digital input 1 ? input to spi port 1 p7 dio17 / spi_ssel . set/read function for dio17. 0 ? unmonitored digital input 1 ? input to to select the spi port 1 p8 dio18 / spi_sclk . set/read function for dio18. 0 ? unmonitored digital input 1 ? spi clock input 1
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 132 p9 dio19 / spi_attn / pti_data . set/read function for dio19. 0 ? unmonitored digital input 1 - spi data available indicator 6 ? packet trace interface data output. must be set along with d1=6 to output traces for ota sniffing. 1 d0 ad0/dio0 configuration . select/read function for ad0/dio0. 0 - unmonitored digital input 1 - commissioning button enabled 2 - analog input, single ended 3 - digital input 4 - digital output, low 5 - digital output, high 1 d1 ad1/dio1 / pti_en configuration . select/read function for ad1/dio1. 0 ? unmonitored digital input 2 - analog input, single ended 3 ? digital input 4 ? digital output, low 5 ? digital output, high 6 - packet trace interface enable. must be set along with p9=6 to output traces for ota sniffing. 0 d2 ad2/dio2 configuration. select/read function for ad2/dio2. 0 ? unmonitored digital input 2 - analog input, single ended 3 ? digital input 4 ? digital output, low 5 ? digital output, high 0 d3 ad3/dio3 configuration . select/read function for ad3/dio3. 0 ? unmonitored digital input 2 - analog input, single ended 3 ? digital input 4 ? digital output, low 5 ? digital output, high 0 d4 dio4 configuration . select/read function for dio4. 0 ? unmonitored digital input 3 ? digital input 4 ? digital output, low 5 ? digital output, high 0 d5 dio5 / associate configuration . configure options for the di o5 line of the rf module. 0 - unmonitored digital input 1 - associated indication led 3 - digital input 4 - digital output, default low 5 - digital output, default high 1 d8 dio8 / dtr / slp_rq . set/read function for dio8. 0 ? unmonitored digital input 1 ? input to sleep and wake module 3 ? digital input 4 ? digital output, low 5 ? digital output, high lt assoc led blink time . set/read the associate led blink time. if the associate led functionality is enabled (d5 command), this value determines the on and off blink times for the led when the module has joined a network. if lt=0, the default blink rate will be used (500ms coordinator, 250ms router/end device). for all other lt values, lt is measured in 10ms. 0, 0x0a - 0xff (100 - 2550 ms) 0 i/o ? commands at ? command name and description parameter range default
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 133 pr pull-up/down resistor . set/read the bit field that configures the internal pull-up/down resistor status for the i/o lines. "1" specif ies the pull-up/down resistor is enabled. "0" specifies no internal resistors ar e used. the input will be floating. bits:" 0 - dio4 (pin 24) 1 - ad3 / dio3 (pin 30) 2 - ad2 / dio2 (pin 31) 3 - ad1 / dio1 (pin 32) 4 - ad0 / dio0 (pin 33) 5 - rts / dio6 (pin 29) 6 - dtr / sleep request / dio8 (pin 10) 7 - din / config (pin 4) 8 - associate / dio5 (pin 28) 9 - on/sleep / dio9 (pin 26) 10 - dio12 (pin 5) 11 - pwm0 / rssi / dio10 (pin 7) 12 - pwm1 / dio11 (pin 8) 13 - cts / dio7 (pin 25) 14 - dout / dio13 (pin 3) 0 - 0x7fff 0x1fff pd pull-up / down direction . set/read an internal pull-up or pull-down resistor for the corresponding bits in the pr command. if the bit is set, an internal pull-up resistor is used. if it is clear, an internal pull-down resistor is used. see the pr command for the bit order. 0 - 0x7fff 0x1fbf rp rssi pwm timer. time the rssi signal will be output on the pwm after the last rf data reception or aps acknowl edgment.. when rp = 0xff , output will always be on. 0 - 0xff [x 100 ms] 0x28 (40d) %v supply voltage. reads the voltage on the vcc pin in mv. -0x-0xffff [read only] - v+ voltage supply monitoring. the voltage supply threshold is set with the v+ command. if the measured supply voltage falls below or equal to this threshold, the supply voltage will be included in the io sample set. v+ is set to 0 by default (do not include the supply voltage).the units of this command are mv. for example, to include a measurement of the supply voltage when it exceeds 3.3 v, set v+ to 3300 = 0xce4. 0-0xffff 0 tp reads the module temperature in degr ees celsius. accuracy +/- 7 degrees. 1 c = 0x0001 and -1 c = 0xffff. command is only available on pro module. 0x0-0xffff - i/o ? commands at ? command name and description parameter range default
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 134 diagnostics at command options diagnostics ? commands at ? command name and description parameter range default vr firmware version . read firmware version of the module as a 4-digit hex number. 0 - 0xffff [read-only] factory-set vl version long . shows detailed version information, module type, a time stamp for the build, ember stack version, and bootloader version. n/a n/a hv hardware version . read the hardware version of the module.version of the module. this command can be used to distinguish am ong different hardware platforms. the upper byte returns a value that is unique to each module type. the lower byte indicates the hardware revision. the regular xbee returns a value of 0x22xx for this command. the xbee-pro returns a value of 0x21xx. 0 - 0xffff [read-only] factory-set ai association indication . read information regarding last node join request: 0x00 - successfully formed or joined a networ k. (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) 0x24 - no joinable beacons were found 0x25 - unexpected state, node should not be attempting to join at this time ? 0x27 - node joining attempt failed (typically due to incompatible security settings) 0x2a - coordinator start attempt failed? 0x2b - checking for an existing coordinator 0x2c - attempt to leave the network failed 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) note : new non-zero ai values may be added in later firmware versions. applications should read ai until it returns 0x00, indicating a successful startup (coordinator) or join (routers and end devices) 0 - 0xff ? [read-only] -- at ? command ? options ? commands at ? command name and description parameter range default ct command mode timeout. set/read the period of inactivity (no valid commands received) after which the rf module automatically exits at command mode and returns to idle mode. 2 - 0x028f [x 100 ms] 0x64 (100d) cn exit command mode. explicitly exit the module from at command mode. -- -- gt guard times . set required period of silence before and after the command sequence characters of the at command mode sequence (gt + cc + gt). the period of silence is used to prevent inadvertent entrance into at command mode. 1 - 0x0ce4 [x 1 ms] ? (max of 3.3 decimal sec) 0x3e8 ? (1000d) cc command sequence character . set/read the ascii character value to be used between guard times of the at command mode sequence (gt + cc + gt). the at command mode sequence enters the rf module into at command mode. 0 - 0xff 0x2b ? (?+? ascii)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 135 sleep commands execution commands where most at commands set or query register values, execution commands cause an action to be executed on the module. execution commands are executed immediately and do not require changes to be applied. sleep ? commands at ? command name and description parameter range default sm sleep mode sets the sleep mode on the rf module. when sm>0, the module operates as an end device. however, ce must be 0 before sm can be set to a value greater than 0 to turn the module into an end device. changing a device from a router to an end device (or vice versa) forces the device to leave the network and attempt to join as the new device type when changes are applied. 0-sleep disabled (router) 1-pin sleep enabled 4-cyclic sleep enabled 5 - cyclic sleep, pin wake 0 - router 4 - end device sn number of sleep periods. sets the number of sleep periods to not assert the on/sleep pin on wakeup if no rf data is waiting for the end device. this command allows a host application to sleep for an extended time if no rf data is present 1 - 0xffff 1 sp sleep period. this value determines how long the end device will sleep at a time, up to 28 seconds. (the sleep time can effectively be extended past 28 seconds using the sn command.) on the parent, this value determi nes how long the parent will buffer a message for the sleeping end device. it should be set at least equal to the longest sp time of any child end device. 0x20 - 0xaf0 x 10ms (quarter second resolution) 0x20 st time before sleep sets the time before sleep timer on an end device.the timer is reset each time serial or rf data is received. once the timer expires, an end device may enter low power operation. applicable fo r cyclic sleep end devices only. 1 - 0xfffe (x 1ms) 0x1388 (5 seconds) so command sleep options . configure options for sleep. unus ed option bits should be set to 0. sleep options include: 0x02 - always wake for st time 0x04 - sleep entire sn * sp time sleep options should not be used for most applications. see chapter 6 for more information. 0 - 0xff 0 wh wake host . set/read the wake host timer value. if the wake host timer is set to a non- zero value, this timer specifies a time (in millisecond units) that the device should allow after waking from sleep before sending data out the serial port or transmitting an i/o sample. if serial characters are rece ived, the wh timer is stopped immediately. 0 - 0xffff (x 1ms) si sleep immediately . see execution commands table below.. po polling rate . set/read the end device poll rate. setting this to 0 (default) enables polling at 100 ms (default rate). adaptive polling may allow the end device to poll more rapidly for a short time when receiving rf data. 0 - 0x3e8 0x00 (100 msec) execution ? commands at ? command name and description parameter range default ac apply changes . applies changes to all command registers causing queued command register values to be applied. for example, changing the serial interface rate with the bd command will not change the uart interface ra te until changes are applied with the ac command. the cn command and 0x08 api command frame also apply changes. - wr write . write parameter values to non-volatile memory so that parameter modifications persist through subsequent resets. note: once wr is issued, no additional char acters should be sent to the module until after the "ok\r" response is received. the wr command should be used sparingly. the em357 supports a limited number of write cycles. -- -- re restore defaults . restore module parameters to factory defaults. -- -- fr software reset. reset module. responds immediat ely with an ok status, and then performs a software reset about 2 seconds later. -- -- nr network reset . reset network layer parameters on one or more modules within a pan. responds immediately with an ?ok? then causes a network restart. all network configuration and routing inform ation is consequently lost. if nr = 0 : resets network layer parameters on the node issuing the command. if nr = 1 : sends broadcast transmission to reset network layer parameters on all nodes in the pan. 0 - 1 -- si sleep immediately . cause a cyclic sleep module to sl eep immediately rather than wait for the st timer to expire. -- cb commissioning pushbutton . this command can be used to simulate commissioning button presses in software. the parameter value should be set to the number of button presses to be simulated. for example, sending the atcb1 comm and will execute the action associated with 1 co mmissioning button press.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 136 nd node discover. discovers and reports all rf modules found. the following information is reported for each module discovered. ? my ? sh ? sl ? ni (variable length) ? parent_network address (2 bytes) ? device_type (1 byte: 0=coord, 1=router, 2=end device) ? status (1 byte: reserved) ? profile_id (2 bytes) ? manufacturer_id (2 bytes) ? ? after (nt * 100) milliseconds, the command ends by returning a . nd also accepts a node identifier (ni) as a param eter (optional). in this case, only a module that matches the supplied identifier will respond. if nd is sent through the api, each response is returned as a separate at_cmd_response packet. the data consists of the above listed bytes without the carriage return delimiters. the ni string will end in a "0x00" null character. the radius of the nd command is set by the bh command. optional 20-byte ? ni or my value -- dn destination node. resolves an ni (node identifier) string to a physical address (case- sensitive). the following events occur after the destination node is discovered: ? 1. dl & dh are set to the extended (64-bit) address of the module with the matching ? ni (node identifier) string. ? 2. ok (or error)\r is returned. ? 3. command mode is exited to allow immediate communication ? 1. the 16-bit network and 64-bit ext ended addresses are returned in an api ? command response frame. if there is no response from a module within (nt * 100) milliseconds or a parameter is not specified (left blank), the command is terminated and an ?error? message is returned. in the case of an error, command mode is not exited. the radius of the dn command is set by the bh command. up to 20-byte printable ascii string -- is force sample forces a read of all enabled digital and analog input lines. -- -- execution ? commands at ? command name and description parameter range default
? ? 2010 ? digi ? international, ? inc. ????? 137 11. ? module ? support this chapter provides customization inform ation for the xbee. in addition to prov iding an extremely flexible and powerful api, xbee modules are a robust developm ent platform that have passed fcc and etsi testing. developers can customize default parameters, or even write or load custom firmware for ember's em357 chip. x-ctu configuration tool digi provides a windows x-ctu configuration tool for co nfiguring module parameters and updating firmware. the xctu has the capability to do the following: ?discover all xbee devices in the network ?update firmware on a local module (requires usb or se rial connection) ?read or write module configuration parameters on a local or remote device ?save and load configuration profile s containing customized settings. contact digi support for more information about the x-ctu. customizing xbee zb firmware once module parameters are tested in an application an d finalized, digi can manufac ture modules with specific, customer-defined configurations for a nominal fee. these cust om configurations can lock in a firmware version or set command values when the modules are manufactured, el iminating the need for cust omers to adjust module parameters on arrival. alternatively, digi can program cu stom firmware, including embe r's ezsp uart image, into the modules during manufacturing. contact digi to create a custom configuration. design considerations fo r digi drop-in networking xbee rf modules contain a variety of fe atures that allow for in teroperability with digi's full line of drop-in networking products. interoperability with ot her "din" products can offer these advantages: ?add ip-connectivity to your network via cellular, ethernet or wifi with a connectport x gateway. ?extend the range of your network with the xbee wall router. ?make deployment easy by enabling the commissioning pu shbutton (pin 20) and associateled (pin 15) to oper- ate with the network commi ssioning tool software. ?interface with standard rs-232, usb, analog & digita l i/o, rs-485, and other industrial devices using xbee adapters. ?monitor and manage your netw ork securely from remote lo cations with idigi platform. ?we encourage you to contact our technical representatives for consideration, implementation, or design review of your product for interoperability with digi's drop-in networking solutions. xbee bootloader xbee modules use a modified version of ember?s bootload er. this bootloader version supports a custom entry mechanism that uses module pins din (pin 4), dtr / sleep_rq (pin 10), and rts (pin 29). to invoke the bootloader, do the following: 1. set dtr / sleep_rq low (ttl 0v) and rts high. 2. send a serial break to the din pi n and power cycle or reset the module. 3. when the module powers up, dtr / sleep_rq and din should be low (ttl 0v) and rts should be high. 4. terminate the serial break and send a carriage return at 115200bps to the module. 5. if successful, the module will send the embe r bootloader menu out th e dout pin at 115200bps. 6. commands can be sent to the bootloader at 115200bps. note : hardware flow control should be disabled when entering and communicat ing with the em250 boot- loader.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 138 programming xbee modules firmware on the xbee module s can be updated serially. serial firmware updates serial firmware updates make use of the xbee custom bootloader which ships in all units. this modified bootloader is based on ember's stan dalone bootloader, but with a modifi ed entry mechanism. the modified entry mechanism uses module pins 4, 10, and 29 (din, dtr, and rts respectively). the x-ctu program can update firm ware serially on the xbee. co ntact digi support for details. if an application requires custom firmware to update the xbee firmwa re serially, the following steps are required. invoke xbee bootloader see the "xbee bootloader" section above for steps to invoke the bootloader using rs-232 signals. the bootloader may also be invoked by issuing a command via x-ctu. then the application makes an explicit call to the bootloader, which does not return. if there is no valid application, the bootloader will always run. send firmware image after invoking the bootloader, the ember bootloader will send the bootloader menu characters out the serial port, which may be the uart at 115200 bps or the spi, wh ere the attached spi master provides the clock rate. the application should do the foll owing to upload a firmware image. 1. look for the bootloader prompt "bl >" to ensure the bootloader is active 2. send an ascii "1" character to initiate a firmware update 3. after sending a "1", the em357 wait s for an xmodem crc upload of an .e bl image over the serial line at 115200 bps. the .ebl file must be sent to the em357 in order. if the firmware image is su ccessfully loaded, the bootloader will output a ?complete? string. then the newly loaded firmware can be invoked by sending a ?2? to the module. if the firmware image is not successfully loaded, the boot loader will output an ?aborted? string. then it will return to the main b ootloader menu. some causes for failure are: ? over 1 minute passes after the command to send th e firmware image and the fi rst block of the image has not yet been sent. ? a power cycle or reset event o ccurs during the firmware load. ? a file error or a flash error oc curs during the firmware load. writing custom firmware the xbee module can be used as a ha rdware development platform for the em 357. custom firmware images can be developed around the emberznet 4. 2.xx mesh stacks (for the em3 57) and uploaded to the xbee. warning: if programming firmware through the jtag interface , please be aware that doing so can potentially erase the xbee bootloader. if this occurs, serial firmware updates will not work. regulatory compliance xbee modules are fcc and etsi certified for operation on all 16 channels. the em 357 output power can be configured up to 8 dbm with boost mode enabled. xbee-pro modules are certified for operation on 15 of the 16 band channels (channels 11 - 25). the scan channels mask of xbee-pro devices must be set in the application to disabl e the upper channel (e.g. 0x03fff800). the xbee-pro contains a power compensation method to adjust the output power near 18 dbm. for best results, the em357 should be configured with an output power level of -4 db m with boost mode is enabled. the end product is responsible to adhere to these requirements.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 139 enabling gpio 1 and 2 most of the remaining sections in this chapter describe how to configure gp ios to function correctly in custom applications that run on the xbee modu les. in order for gpio pins to be configurable, the application must set the gpio_pxcfg registers to enable th e appropriate gpio. the following ta ble lists values for configuring the gpio pins. other functional ity is affected by these settings. see the em357 da tasheet from ember for a complete listing of functionality. for more information on configuring and setting gpios, consult the em357 specification. detecting xbee vs. xbee-pro for some applications, it may be nece ssary to determine if the code is r unning on an xbee or an xbee-pro device. the pc7 pin on the em357 is used to identify the module type (see chapte r 1). pc7 is connected to ground on the xbee module. the following code could be used to determine if a mo dule 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 firmwa re 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 indica tes 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 ass ociate / dio5 to the gate of a mosfet which drives the led). gpio mode gpio_pxcfgh/l description analog 0x0 analog input or output. when in analog mode, the digital input (gpio_pxin) always reads 1. input (floating) 0x4 digital input without an inte rnal pull-up or pull-down. output is disabled. input (pull-up or pull-down) 0x8 digital input with an internal pu ll-up or pull-down . a set bit in gpio_pxout selects pull-up and a cleared bit selects pull-down. output is disabled output (push- pull) 0x1 push-pull output. gpio_pxout controls the output. output (open- drain) 0x5 open-drain output. gpio_pxout controls the output. if a pull-up is required, it must be external. alternate output (push-pull) 0x9 push-pull output. an on-board peripheral controls the output. alternate output (open-drain) 0xd open-drain output. an on- board peripheral controls the output. if a pull- up is required, it must be external.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 140 jtag pin name primary xbee pin secondary xbee pin secondary pin name jtck 18 n/a n/a jtdo 19 26 on / sleep / dio9 jtdi 20 28 associate / dio5 jtms 21 5 dio12
? ? 2010 ? digi ? international, ? inc. ????? 141 appendix ? a: ? agency ? certifications united states fcc the xbee rf module complies with part 15 of the fcc rules and regulati ons. compliance with the labeling requirements, fcc notice s and antenna usage guidelines is required. to fulfill fcc certification, the oem must comply with the following regulations: 1.the system integrator must en sure that the text on the exte rnal label provided with this device is placed on the ou tside of the final product. 2.xbee rf module may only be used with antennas that have been tested and approved for use with this module [refer to the antenna tables in this section]. oem labeling requirements warning: the original equipment manufacturer (o em) must ensure that fcc labeling requirements are met. this includes a clearly visible label on the outside of the final product enclosure that displays the cont ents shown in the figure below. required fcc label for oe m products containing the xbee s2c rf module required fcc label for oem products containing the xbee-pro s2c rf module fcc notices important: the xbee and xbee-pro rf module have be en certified by the fcc for use with other products without any further cert ification (as per fcc section 2.109 1). modifications not expressly approved by digi could void the user 's authority to operate the equipment. important: oems must test final product to comply with unintentional radiators (fcc section 15.107 & 15.109) before declaring compli ance of their final product to part 15 of the fcc rules. important: the rf module has been certified for remote an d base radio applications . if the module will be used for portable applications, the device must undergo sar testing. this equipment has been tested and found to comply with the limits for a class b di gital device, pursuant to part 15 of the fcc rules. these li mits are designed to provide reas onable protection against harmful interference in a residential installation. this equi pment generates, uses and can radiate radio frequency energy and, if not installed and used in accordance with the instructions, may ca use harmful interference to radio communications. however, there is no guarantee that interference will not occur in a particular installation. if this equipment does cause harmful interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one or more of the following measures: re-orient or reloca te the receiving antenna, increase the separation between the equipment and receiver, connect equipment and receiver to outlets on different circuits, or consult the dealer or an experien ced radio/tv technician for help. contains fcc id: mcq-xbs2c this device complies with part 15 of the fcc rules. operation is subject to the following two conditions: (1 . ) this device may not caus e harmful interference and (2 . ) this device must ac cept any interference received, including interference th at may cause undesired operation. contains fcc id:mcq-xbps2c this device complies with part 15 of the fcc rules. operation is subject to the following two conditions: (1 . ) this device may not caus e harmful interference and (2 . ) this device must ac cept any interference received, including interference th at may cause undesired operation.
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 142 fcc-approved antennas (2.4 ghz) the xbee and xbee-pro rf module can be installe d utilizing antennas and cables constructed with standard connectors (type-n, sma, tnc, etc.). the modules are fcc approved for fixed base station an d mobile applications for the channels indicated in the tables below. if the antenna is mounted at least 20cm (8 in.) from nearby persons, th e application is considered a mobile application. ante nnas not listed in the table must be tested to comply with fcc section 15.203 (unique antenna connectors) and section 15.247 (emissions). xbee rf modules : xbee rf modules have been tested and approved for use with all the antennas listed in the tables below. (cable-loss is required when using gain antennas as shown below.) the antennas in the tables below have been approved for use with this module. digi does not carry all of these antenna variants. contact di gi sales for available antennas. antennas ? approved ? for ? use ? with ? the ? xbee?/xbee \ pro? ? rf ? modules ? (cable ? loss ? is ? not ? required.) ???? antennas ? approved ? for ? use ? with ? the ? xbee? ? rf ? module ? (cable ? loss ? is ? not ? required.) ? omni-directional antennas for all available channels part number type (description) gain application min separation minimum cable loss/power reduction/ attenuation required 29000313 integral pcb antenna 0.0 dbi fixed/mobile 20 cm n/a a24-hasm-450 dipole (half-wa ve articulated rpsma - 4.5?) 2.1 dbi fixed 20 cm n/a a24-habsm dipole (art iculated rpsma) 2.1 dbi fixed 20 cm n/a 29000095 dipole (half-wave articulated rpsma - 4.5?) 2.1 dbi fixed/moblie 20 cm n/a a24-habuf-p5i dipole (half-wave articulat ed bulkhead mount u.fl. w/ 5? pigtail) 2.1 dbi fixed/mobile 20 cm n/a a24-hasm-525 dipole (half-wa ve articulated rpsma - 5.25") 2.1 dbi fixed 20 cm n/a a24-qi monopole (integrated whip) 1.5 dbi fixed/mobile 20 cm n/a a24-f2nf omni-directional (fiberglass base station) 2.1 dbi fixed/mobile 20 cm n/a a24-f3nf omni-directional (fiberglass base station) 3.0 dbi fixed/mobile 20 cm n/a a24-f5nf omni-directional (fiberglass base station) 5.0 dbi fixed 20 cm n/a a24-f8nf omni-directional (fiberglass base station) 8.0 dbi fixed 2 m n/a a24-f9nf omni-directional (fiberglass base station) 9.5 dbi fixed 2 m n/a a24-f10nf omni-directional (fibergl ass base station) 10 dbi fixed 2 m n/a a24-f12nf omni-directional (fibergl ass base station) 12 dbi fixed 2 m n/a a24-w7nf omni-directional (fibergl ass base station) 7.2 dbi fixed 2 m n/a a24-m7nf omni-directional (mag-moun t base station) 7.2 dbi fixed 2 m n/a panel class antennas for all available channels part number type (description) gain application min. separation ? required cable-loss a24-p8sf flat panel 8.5 dbi fixed 2 m n/a a24-p8nf flat panel 8.5 dbi fixed 3 m n/a a24-p13nf flat panel 13.0 dbi fixed 4 m n/a a24-p14nf flat panel 14.0 dbi fixed 5 m n/a omni-directional antennas fo r all available channels part number type (description) gain application min. separation ? required cable-loss a24-f15nf omni-directional (fiberglass base station) 15.0 dbi fixed 2 m n/a
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 143 antennas ? approved ? for ? use ? with ? the ? xbee? ? rf ? modules ? (channels ? 11 \ 25) ? antennas ? approved ? for ? use ? with ? the ? xbee? ? rf ? modules ? (channel ? 26) yagi and panel class antennas for channels 11 - 25 part number type (descr iption) gain application* min. separation ? required cable-loss a24-y6nf yagi (6-element) 8.8 dbi fixed 2 m n/a a24-y7nf yagi (7-element) 9.0 dbi fixed 2 m n/a a24-y9nf yagi (9-element) 10.0 dbi fixed 2 m n/a a24-y10nf yagi (10-element) 11.0 dbi fixed 2 m n/a a24-y12nf yagi (12-element) 12.0 dbi fixed 2 m n/a a24-y13nf yagi (13-element) 12.0 dbi fixed 2 m n/a a24-y15nf yagi (15-element) 12.5 dbi fixed 2 m n/a a24-y16nf yagi (16-element) 13.5 dbi fixed 2 m n/a a24-y16rm yagi (16-element, rpsm a connector) 13.5 dbi fixed 2 m n/a a24-y18nf yagi (18-element) 15.0 dbi fixed 2 m n/a a24-p15nf flat panel 15.0 dbi fixed 2 m n/a a24-p16nf flat panel 16.0 dbi fixed 2 m n/a a24-p19nf flat panel 19.0 dbi fixed 2 m n/a yagi and panel class antennas for channel 26 part number type (description) ga in application* min. separation minimum cable loss/ power reduction/ attenuation required a24-y6nf yagi (6-element) 8.8 dbi fixed 2 m n/a a24-y7nf yagi (7-element) 9.0 dbi fixed 2 m n/a a24-y9nf yagi (9-element) 10.0 dbi fixed 2 m n/a a24-y10nf yagi (10-element) 11.0 dbi fixed 2 m n/a a24-y12nf yagi (12-element) 12.0 dbi fixed 2 m n/a a24-y13nf yagi (13-element) 12.0 dbi fixed 2 m 0.5 db a24-y15nf yagi (15-element) 12.5 dbi fixed 2 m 1.0 db a24-y16nf yagi (16-element) 13.5 dbi fixed 2 m 2.0 db a24-y16rm yagi (16-element, rpsma connector) 13.5 dbi fixed 2 m 7.5 db a24-y18nf yagi (18-element) 15.0 dbi fixed 2 m 9.0 db a24-p15nf flat panel 15.0 dbi fixed 2 m 4.5 db a24-p16nf flat panel 16.0 dbi fixed 2 m 10.0 db a24-p19nf flat panel 19.0 dbi fixed 2 m 13.0 db
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 144 antennas ? approved ? for ? use ? with ? the ? xbee \ pro? ? rf ? module * if using the rf module in a portable application (for example - if the module is used in a handheld device and the antenna is less than 20cm from the human body when the device is in operation): the integrator is responsible for passing additional sar (specific absorption rate) testing based on fcc rules 2.1091 and fcc guidelines for human exposure to radio frequency electromagnetic fiel ds, oet bulletin and supplement c . the testing results will be submitted to the fcc for appr oval prior to selling the integrated unit. the required sar testing measures emissions from the module and how they affect the person. rf exposure warning: to satisfy fcc rf exposure requir ements for mobile transmitting de vices, a separation distance of 20 cm or more should be maintained between the antenna of this device and persons during device operation. to ensure compliance, operations at closer than this distance are not re commended. the antenna used for this transmitter must not be co-located in conjunction with any other antenna or transmitter. the preceding statement must be included as a caution statement in oem product manuals in order to alert users of fcc rf exposu re compliance. europe (etsi) the xbee rf modules (excluding the pro) have been ce rtified for use in several european countries. for a complete list, refer to www.digi.com if the xbee rf modules are incorporated into a produc t, the manufacturer must ensure compliance of the final product to the european harmonized emc and low-voltage/safety standa rds. a declaration of conformity must be issued for each of these standards and kept on fi le as described in annex ii of the r&tte directive. furthermore, the ma nufacturer must maintain a copy of the xb ee user manual documentation and ensure the final product does not exceed the specified power ratings, antenna specificat ions, and/or installation requirements as specified in the user manual. if any of these specifications are exceeded in the final product, a submission must be made to a notified body for compliance testing to all required standards. panel class antennas for channels 11- 25 part number type (description) gain application min. separation ? required cable-loss a24-p8sf flat panel 8.5 dbi fixed 2 m n/a a24-p8nf flat panel 8.5 dbi fixed 2 m n/a a24-p13nf flat panel 13.0 dbi fixed 2 m 4.3 db a24-p14nf flat panel 14.0 dbi fixed 2 m 5.3 db a24-p15nf flat panel 15.0 dbi fixed 2 m 6.3 db a24-p16nf flat panel 16.0 dbi fixed 2 m 7.3 db a24-p19nf flat panel 19.0 dbi fixed 2 m 10.3 db omni-directional antennas for channels 11- 25 part number type (description) gain application min. separation ? required cable-loss a24-f15nf omni-directional (fiberglass base station) 15.0 dbi fixed 2 m 1 db yagi class antennas for channels 11 - 25 part number type (descr iption) gain application* min. separation ? required cable-loss a24-y6nf yagi (6-element) 8.8 dbi fixed 2 m n/a a24-y7nf yagi (7-element) 9.0 dbi fixed 2 m n/a a24-y9nf yagi (9-element) 10.0 dbi fixed 2 m n/a a24-y10nf yagi (10-element) 11.0 dbi fixed 2 m 0.1 db a24-y12nf yagi (12-element) 12.0 dbi fixed 2 m 1.1 db a24-y13nf yagi (13-element) 12.0 dbi fixed 2 m 1.1 db a24-y15nf yagi (15-element) 12.5 dbi fixed 2 m 1.6 db a24-y16nf yagi (16-element) 13.5 dbi fixed 2 m 2.6 db a24-y16rm yagi (16-element, rpsma connector) 13.5 dbi fixed 2 m 2.6 db a24-y18nf yagi (18-element) 15.0 dbi fixed 2 m 4.1 db
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 145 oem labeling requirements the 'ce' marking must be affixed to a visible location on the oem product. ce ? labeling ? requirements the ce mark shall consist of the init ials "ce" taking the following form: ?if the ce marking is reduced or enlarged, the prop ortions given in the above graduated drawing must be respected. ?the ce marking must have a height of at least 5mm except where this is not possible on account of the nature of the apparatus. ?the ce marking must be affixed visibly, legibly, and indelibly. restrictions france: outdoor use limited to 10 mw ei rp within the band 2454-2483.5 mhz. norway: norway prohibits operation near ny-alesund in svalbard. more information can be found at the norway posts and telecommunications site (www.npt.no). italy: for private use, a general authorization is requ ired if was/rlans are used outside own premises. for public use, a general authorization is required. russian federation: ? maximum mean eirp density is 2 mw/mhz, maximum 100 mw eirp. ? maximum mean eirp density is 20 mw/mhz, maximum 100 mw eirp permitted to use srd for outdoor applications only, for purposes of gathering telemetry information for automated monitoring and resources accounting systems or security systems. ? maximum mean eirp density is 10 mw/mhz, maximum 100 mw eirp for indoor applications. ukraine: eirp must be less than or equal to 100 mw with built-in antenna, with amplification factor up to 6 dbi. declarations of conformity digi has issued declarations of conformity for the xb ee rf modules concerning emissions, emc and safety. files can be obtained by contacting digi support. important note: digi does not list the entire set of standards that must be met for each country. digi customers assume full responsibility for learning and meeting the required guidelines for each country in their distribution market. for more information relating to european compli ance of an oem product incorporating the xbee rf module, contact digi, or refe r to the following web sites: cept erc 70-03e - technical requirements, european re strictions and general re quirements: available at www.ero.dk/. r&tte directive - equipment requirements, placement on market: available at www.ero.dk/. xbee rf module the following antennas have been tested and approved for use with the embedded xbee rf module: - dipole (2.1 dbi, omni-directional, articu lated rpsma, digi part number a24-habsm) - pcb antenna (0.0 dbi) - monopole whip (1.5 dbi)
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 146 canada (ic) labeling requirements labeling requirements for industry canada are similar to those of the fcc. a clearly visible label on the outside of the final product enclosur e must display the following text: contains model xbee radio, ic: 1846a-xbs2c the integrator is responsible for its product to co mply with ic ices-003 & fcc part 15, sub. b - unintentional radiators. ices-003 is the same as f cc part 15 sub. b and industry canada accepts fcc test report or cispr 22 test repo rt for compliance with ices-003. if it contains an xbee-pro rf module, the clearly visible label on the outside of the final product enclosure must display the following text: contains model xbee pro radio, ic: 1846a-xbps2c transmitters for detachable antennas this device has been designed to operate with the antennas listed in the previous table and having a maximum of 19 db. antennas not included in this list or having a gain greater than 19 db are strictly prohibited for use with this device. the required antenna impedance is 50 ohms. detachable antenna to reduce potential radio in terference to other users, th e antenna type and gain sh ould be so chosen that the equivalent, istropically radiated power (eirp) is not more than permitted for successful communication. australia (c-tick) these modules comply with requiremen ts to be used in end products in australia. all products with emc and radio communications must have a registered c-tick mark. registration to use the compliance mark will only be accepted from austra lian manufacturers or importers, or their agent, in australia. in order to have a c-tick mark on an end prod uct, a company must comply with a or b below. a. have a company presence in australia. b. have a company/distributor/agent in australia that will sponsor the importing of the end ? product. contact digi for question s related to locating a contact in australia.
? ? 2010 ? digi ? international, ? inc. ????? 147 appendix ? b: ? migrating ? from ? xbee ? zb ? to ? xbee ? zb ? smt the xbee zb smt modules are designed to be compatible wi th the xbee zb. the zb smt modules have all the features of the zb modules, and offer th e increased feature set describe d in this user?s guide. for further information on the zb, see the xbee?/xbee-pro? zb rf modules user?s guide available at www.digi.com . pin mapping mapping of the zb smt pins to the zb pins is shown in the table below. the pin names are from the s2c smt module. zb smt pin # name zb pin # 1 gnd 2vcc1 3 dout / dio13 2 4 din / config / dio14 3 5 dio12 4 6reset 5 7 rssi pwm / dio10 6 8 pwm1 / dio11 7 9 [reserved] 8 10 dtr / sleep_rq / dio8 9 11 gnd 10 12 spi_attn / bootmode / dio19 13 gnd 14 spi_clk / dio18 15 spi_ssel / dio17 16 spi_mosi / dio16 17 spi_miso / dio15 18 [reserved] 19 [reserved] 20 [reserved] 21 [reserved] 22 gnd 23 [reserved] 24 dio4 11 25 cts / dio7 12 26 on / sleep / dio9 13 27 vref 14
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 148 mounting one of the important differences betw een the zb smt and the zb modules is the way they mount to the pcb. the zb is designed with th rough-hole pins, while the zb smt is designed with surface mount technology (smt). as such, different mounting techniques are required. digi international has designed a footpr int which will allow either module to be attached to a pcb. the layout is shown below. all dimensions are in inches. 28 associate / dio5 15 29 rts / dio6 16 30 ad3 / dio3 17 31 ad2 / dio2 18 32 ad1 / dio1 19 33 ad0 / dio0 20 34 [reserved] 35 gnd 36 rf 37 [reserved] zb smt pin # name zb pin #
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 149 the round holes in the diagram are for the zb through-ho le design, and the semi-ova l pads are for the zb smt design. pin 1 of the through-hole design is lined up with pin 1 of the zb smt design, but the pins are actually offset by one pad (see pin mapping ab ove). by using diagonal traces to co nnect the appropriate pins, the layout will work for both modules. information on attaching th e zb smt module is included in appendix c below.
? ? 2010 ? digi ? international, ? inc. ????? 150 appendix ? c: ? manufacturing ? information the xbee is designed for surfa ce mount on the oem pcb. it has castellate d pads to allow for easy solder attach inspection. the pads are all located on the edge of the module, so that there are no hidden solder joints on these modules. recommended solder reflow cycle the recommended solder reflow cycle is shown below. the chart shows the temperature setting and the time to reach the temperature. the cooling cycle is not shown. the maximum temperature should not exceed 260 degrees celsius. the module will reflow during this cycle, and therefore must not be reflowed updsid e down. care should be taken not to jar the module while the solder is molten , as parts inside the module can be removed from their required locations. hand soldering is possible and should be do ne in accordance with approved standards. time (seconds) temperature (degrees c) 30 65 60 100 90 135 120 160 150 195 180 240 210 260
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 151 recommended footprint it is recommended that you use the pcb footprint shown below for surface mounting. dimensions are in inches. the solder footprint should be matched to the copper pads, but may need to be adjusted depending on the specific needs of assembly and product standards. while the underside of the module is mostly coated with solder resist, it is recommended that the copper layer directly below the module be left open to avoid unintended contacts. copp er or vias must not interfere with the three exposed rf test points on th e bottom of the module (see below). furthermore, these modules have a ground plane in the middle on the ba ck side for shielding purposes, whic h can be affected by copper traces directly below the module. ?   
 
 
   

xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 152 flux and cleaning it is recommended that a ?no clean? so lder paste be used in assembling these modules. this will eliminate the clean step and ensure unwanted residual flux is not left under the module where it is difficult to remove. in addition: ? cleaning with liquids can result in liquid rema ining under the shield or in the gap between the module and the oem pcb. this can lead to un intended connections be tween pads on the mod- ule. ? the residual moisture and flux residue under the module are not easily seen during an inspec- tion process. factory recommended best practice is to use a ?no clean? solder paste to avoid the issues above and ensure proper module operation. reworking rework should never be performed on the module itself. the module has been optimized to give the best possible performance, and reworking th e module itself will void warranty coverage and certifications. we recognize that some customers will ch oose to rework and void the warranty ; the following information is given as a guideline in such cases to increase the chances of success during rework, thou gh the warranty is still voided. the module may be removed from the oem pcb by the use of a hot air rework station, or hot plate. care should be taken not to overheat the module. during rework, the module temperature may rise above its internal solder melting point and care should be taken not to dislo dge internal components fro m their intended positions.
? ? 2010 ? digi ? international, ? inc. ????? 153 appendix ? d: ? warranty ? information xbee rf modules from digi inte rnational, inc. (the ?product?) are warran ted against defects in materials and work- manship under normal use, for a period of 1-year from the date of purchase . in the event of a product failure due to materials or workmanship, digi will re pair or replace the defective product. for warranty service, return the defec- tive product to digi international, shipping prepaid, for prompt repair or replacement. the foregoing sets forth the fu ll extent of digi international?s warranties regarding the product. repair or replace- ment at digi international?s option is the exclusive re medy. this warranty is given in lieu of all other war- ranties, express or implied, and digi specifically disclaims all warranties of merchantability or fitness for a particular purpose. in no event shal l digi, its suppliers or licensors be liable for damages in excess of the purchase price of the pr oduct, for any loss of use, loss of time, incon- venience, commercial loss, lost profits or savi ngs, or other incidental, special or consequen- tial damages arising out of the use or inability to use the product, to the full extent such may be disclaimed by law. some states do not allow th e exclusion or limitation of incidental or con- sequential damages. therefore, the foregoing exclus ions may not apply in all cases. this warranty provides specific legal rights . other rights which vary from state to state may also apply.
? ? 2010 ? digi ? international, ? inc. ????? 154 appendix ? e: ? definitions definitions zigbee node types coordinator a node that has the unique f unction of forming a network. the coor- dinator is responsible for establis hing the operating channel and pan id for an entire network. once established, the coordinator can form a network by allowing routers and en d devices to join to it. once the network is formed, the coordinator f unctions like a router (it can par- ticipate in routing pack ets and be a source or destination for data packets). -- one coordinator per pan ? -- establishes/organizes pan ? -- can route data pa ckets to/from other nodes ? -- can be a data packet source and destination ? -- mains-powered refer to the xb ee coordinator section for more information. router a node that creates/maintains network information and uses this information to determin e the best route for a data packet. a router must join a network before it can allow other routers and end devices to join to it. a router can participate in routing packets and is intended to be a mains-powered node. -- several routers can operate in one pan ? -- can route data pa ckets to/from other nodes ? -- can be a data packet source and destination ? -- mains-powered refer to the xbee router se ction for more information. end device end devices must always interact with thei r parent to receive or transmit data. (see ?joining defini tion.) they are intended to sleep periodically and therefore have no routing capacity. an end device can be a source or destination for data packets but cannot route packets. end devices can be battery-powered and offer low-power operation. -- several end devices can operate in one pan ? -- can be a data packet source and destination ? -- all messages are relayed through a coordinator or router ? -- lower power modes
xbee?/xbee \ pro? ? zb ? smt ? rf ? modules ? ? ? 2010 ? digi ? international, ? inc. ????? 155 zigbee protocol pan personal area network - a data communication network that includes a coordinator and one or more routers/end devices. joining the process of a node becomi ng part of a zigbee pan. a node becomes part of a network by joining to a coordinator or a router (that has previously joined to the network). during the process of joining, the node that allowed jo ining (the parent) assigns a 16-bit address to the joining node (the child). network address the 16-bit address assigned to a node after it has joined to another node. the coordinato r always has a network address of 0. operating channel the frequency selected for data communications between nodes. the operating channel is selected by the coordinator on power-up. energy scan a scan of rf channels that detects the amount of energy present on the selected channels. the coordinator uses the energy scan to determine the operating channel. route request broadcast transmission sent by a coordinator or router throughout the network in attempt to establish a route to a destination node. route reply unicast transmission sent back to the originator of the route request. it is initiated by a node when it receives a route request packet and its address matches the destinatio n address in the route request packet. route discovery the process of establishing a route to a destin ation node when one does not exist in the routing table. it is based on the aodv (ad-hoc on-demand distance vect or routing) protocol. zigbee stack zigbee is a published specif ication set of high-level communication protocols for use with small, low- power modules. the zigbee stack provides a layer of network functionality on top of the 802.15.4 spec- ification. for example, the mesh and routing capabilities avai lable to zigbee solutions are absent in the 802.15.4 protocol.


▲Up To Search▲   

 
Price & Availability of XB24CZ7RIS-004

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X