Here is how i got it to work.
You will need:
XBee SDK - http://www.digi.com/support/getasset?fn=40003003&tp=10
Codewarrior (option to install as part of SDK setup)
USB XBee adapters (i didn’t have the recommended XBIB board)
XMODEM transfer application - I used ‘sx’ under linux
XCTU-NG - The new/current version of XCTU
So as there is a separate processor in between the radio and the serial connection, we want to upload a program that allows us to passthrough commands direct to the radio, I’m assuming this is what XCTU-NG does when it communicates with programmable radios.
After the XBee SDK and codewarrior are installed, open up code warrior and select the following:
File > New > XBee sample application project > (select your XBee model) > XBee - Serial Bypass > Next & Finish
Then select the following:
Project > Build All
Find you workspace folder and in there there should be a folder called serial_bypass, within this there should be a file called serial_bypass.abs.bin either in the Debug or Release folder. This is the program we need to upload to the processor to allow us to talk directly to the radio.
Now we can prepare a script to write the bin file via the xmodem protocol, dump the following in file, modify to your specific port and make it executable:
#!/bin/bash
sx -vv $1 < /dev/ttyUSB1 > /dev/ttyUSB1
Now open XCTU and connect you radio(s), the first thing we want to do is change the baud rate to 115200 and write the changes.
We need to now get the radio(s) into file upload mode, this can be done via the following:
Go to console mode in XCTU
Set the DTS to on, the RTS to off and BREAK to on
Reset the radio with the reset button on the USB shield
A series of ‘0’ characters should repeat in the console window
Set BREAK to off
In the console window on the left hand side enter a ‘B’ (capital) and press enter
This should present the bootloader menu (might take a few attempts to the sequence right)
Press ‘f’ to put the processor into upload mode and the radio should repeat ‘C’ in the console window
Disconnect the serial console in XCTU (the radio will still be waiting for the file transfer)
Open up a command prompt and use the script we created with the binary we compiled earlier:
./xmodemsend.sh serial_bypass.abs.bin
Repeat the process for any other radios.
Now we can test using the python XBee library, create the two following python scripts:
Send:
from xbee import ZigBee
from serial import Serial
PORT = ‘/dev/ttyUSB0’
BAUD = 115200
dal = ‘\x00\x00\x00\x00\x00\x00\xFF\xFF’
da = ‘\xFF\xFF’
ser = Serial(PORT, BAUD)
xbee = ZigBee(ser)
xbee.send(“tx”,data="Hello World
",dest_addr_long=dal,dest_addr=da)
ser.close()
Recieve:
from xbee import ZigBee
from serial import Serial
PORT = ‘/dev/ttyUSB1’
BAUD = 115200
ser = Serial(PORT, BAUD)
xbee = ZigBee(ser)
while True:
try:
print “waiting”
response = xbee.wait_read_frame()
print response
except KeyboardInterrupt:
break
ser.close()