Zakie Mashiah
unread,Aug 26, 2011, 12:26:05 PM8/26/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to xbee-api
I am using 2 similar modules XBee2 (2mw) modules. Data is sent from
Arduino (Stalker to be precise) to PC.
The data seems to arrive to the PC very nicely with no issues aside
from the fact readPacket called after the xbee.send(zbTx) returns and
no response is getting back to the Arduino.
When looking at the packet on the PC using X-CTU I see the following
7E 00 29 90 00 7D ...
Which means the frameId is set to 0?
Although I even called zbTx.setFrameId(30); (or any other than 0
value) before the call to send, it did not change the fact I got X-CTU
to show the frameId as 0 and still the readPacket failed.
So, is X-CTU or coordinator XBee (on the PC) will always set the
frameID to 0 or is there something else I am missing?
Code is pretty much taken from the sample but repeated here (Console
is a NewSoftSerial assigned to pins 3, 9):
static void SendOnXBee(void)
{
uint8_t rc;
GetWeatherSample(); // Fill the communication buffer
Console.println("XBEE: Sending over XBee");
xbee.send(zbTx); // Send via the XBee
// after sending a tx request, we expect a status response
// wait up to half second for the status response
Console.println("XBEE:: Getting response...");
if (xbee.readPacket(500))
{
// got a response!
// should be a znet tx status
rc = xbee.getResponse().getApiId() ;
if (rc == ZB_TX_STATUS_RESPONSE)
{
xbee.getResponse().getZBTxStatusResponse(txStatus);
Console.println("XBEE:: Got response");
// get the delivery status, the fifth byte
if ( txStatus.isSuccess() )
{
// success. time to celebrate
Console.println("XBEE:: Got success");
FlashLed(8, 100);
}
else
{
// the remote XBee did not receive our packet. is it
powered on?
Console.println("XBEE:: is remore unit powered on?");
FlashLed(3, 300);
}
}
else
Console.println("XBEE:: What I got is not a response");
}
else
{
// readPacket returned 0
if (xbee.getResponse().isError())
{
Console.print("Error reading packet. Error code: ");
Console.println(xbee.getResponse().getErrorCode());
}
else
{
// local XBee did not provide a timely TX Status Response -- should
not happen
Console.println("XBEE:: local XBee did not provide TX Status,
should not happen");
FlashLed(2, 200);
}
}
}