We are using XU-A11 X-STICK 2.4GHZ USB TO XBEE and XU3-A11 XBEE3 USB ADAPTER sticks. And the xbee-java library version 1.3.0
We created a test where we send the same data every 100ms. We see that we get the TransmitException about once a minute. Detail of the exception: "There was a problem transmitting the XBee API packet. > Error: No acknowledgement received (0x01)"
Is there a way to avoid getting this exception?
Code snippet:
while (true) {
localDevice.sendData(xBee64BitAddress, data);
Thread.sleep(100);
}
Config:
serialPort = /dev/ttyUSB0
baudRate = 9600
dataBits = 8
stopBits = 1
serialParityConfiguration = NONE
Note that you're sending 10 packets/second at 9600 baud, so you're data (with overhead) needs to be 96 bytes or less (9600 bits/sec is about 960 bytes/sec). Try increasing your baud rate for a start.
It might not be possible to avoid the exception entirely. What if the other device is offline or rebooting? Write an exception handler to log the error, and then act on that error as appropriate. Maybe having one error each second is acceptable, but if there's a sequence of more than 4 errors you want to do something about it.