I am trying to use the Rabbit board as a web to ZigBee interface. I have the following code running on the BL4S100 board:
#class auto
//
#define XBEE_ROLE NODE_TYPE_ROUTER
#define DEFAULT_PANID 0x1234
#define NODEID_STR "My Router"
#define STDIO_DEBUG_SERIAL SADR
#define STDIO_DEBUG_BAUD 9600
#define STDIO_DEBUG_ADDCR
#define XBEE_DEFAULT_CHANNELS 0xfff
#define CLUSTER_ID 1
char * proto;
#memmap xmem
//Includes:
#use "xbee_api.lib"
/***********************************
* Configuration *
* ------------- *
* All fields in this section must *
* be altered to match your local *
* network settings. */
int incomingString(){
return 0;
}
RabbitClusterIDList_t const StringInCluster = {
{ CLUSTER_ID },
{ incomingString }
};
ENDPOINT_TABLE_BEGIN
ENDPOINT_TABLE_ENTRY(1, 0, 1, 1, 0, 1, 0, &StringInCluster, NULL)
ENDPOINT_TABLE_END
int join_start;
int initres;
//char * proto;
int main(){
brdInit();
printf("Protocal is: %s", xbee_protocol());
join_start = 0;
while ( (initres = xbee_init()) == -EBUSY){
if (! join_start){
join_start = SEC_TIMER;
printf("Waiting for sleeping XBee to wake before continuing.");
}
if (join_start != SEC_TIMER){
join_start = SEC_TIMER;
printf( ".");
}
}
printf( "
");
if (initres){
printf("xbee_init failed");
exit(1);
}
printf("Waiting to join network...
");
join_start = MS_TIMER;
while (ZB_JOINING_NETWORK()) {
// If unable to join a network, timeout after arbitrary time
if (MS_TIMER - join_start > XBEE_JOIN_TIMEOUT) {
printf("
*** Error ***
");
printf("Timed out while trying to join a network.
");
exit(-ETIME);
}
}
printf("Done (%s network)
", xbee_protocol());
}
I have a ZigBee network with a PAN ID of 0x1234. (I have one Coordinator)
No matter what I do, I cannot get the Rabbit to connect to it. It keeps timing out.
I tried connecting the XBee via serial port to X-CTU. It does not show up. I then set the Baud rate to 11520 with Hardware flow control and enabled the API. It recognizes a serial modem but does not let me read any values, or update the firmware.
Next, I tried putting in an XBee module that I know works into the Rabbit board. The code now fails in the initialization stage. I suspect it is trying to communicate at the wrong Baud rate.
Should I try to put a different firmware version on the other XBee modules on my network that is the same as the Rabbit provided XBee? (How??)
Is there a way to change the Baud rate Dynamic C compiles the board to use when communicating to the XBee?
Any help would be greatly appreciated.