How is this function returning xbee.getResponse().isAvailable() = false, even before the timeout has expired?

I’m using a pair of Xbee S1 802.15.4. I modeled this function after the library Rx example. It’s supposed to classify the types of frames that are coming in. Thing is, I’ll frequently get a frame that triggers the else{} part of the function, indicating that no frame is available. But I know that the frame was somehow received because the timeout hasn’t expired yet! And when I plug the receiver into XCTU, The frames arrive looking just fine.

There must be something I’m doing wrong here with my syntax.Can anyone spot my mistake? I couldn’t find any good way to post code here, so I made a duplicate post on a different forum and linked it here: https://www.reddit.com/r/xbee/comments/4zqyjj/how_is_this_function_returning/

What are the API frames you are receiving? Can you provide the full frame?

Thanks for asking, my transmitting Xbee is in AT mode, and my payload is 13 characters long, counting the terminating zero (or 14, if you count the line return) . It arrives at the receiving end as frame type 81 (RX (RECEIVE) PACKET 16-BIT ADDRESS).

I can’t share the payload with you, but it’s just a string of 14 ascii numbers and characters. I’ll replace them here with XX’s:

RX (Receive) Packet 16-bit Address (API 2)

7E 00 7D 33 81 00 33 30 00 60 30 24 20 32 2E 33 30 31 32 37 2A 0D 0A A9

Start delimiter: 7E
Length: 00 13 (19)
Frame type: 81 (RX (Receive) Packet 16-bit Address)
16-bit source address: 00 33
RSSI: 30
Options: 00
RF data: XX XX XX XX XX XX XX XX XX XX XX XX XX XX
Checksum: A9

I’d also like to add that I’m having a strange problem with “invalid frames”, which occurs when I either close and reopen my serial terminal in XCTU, or if I take the receiver out of range and back in again. I don’t think this is related, but I thought I’d mention it. I’ll probably make a post for it.

Sounds like you have other issues that may be connected. How are you connecting this 3V XBee to your device? What voltage does that device operate at?

I’m using the Seeedstudio Xbee shield V2.2, which provides 3.3V.

http://wiki.seeedstudio.com/wiki/XBee_Shield_V2.0

I made a separate post here on this forum describing the problem.

http://www.digi.com/support/forum/58181/invalid-frames-problem?show=58190#a58190